[PATCH v2] erofs-utils: lib: fix incorrect mtime under -Edot-omitted

Gao Xiang hsiangkao at linux.alibaba.com
Fri Jan 16 15:22:43 AEDT 2026



On 2026/1/16 12:07, Yifan Zhao wrote:
> `-Edot-omitted` enables `-E48bits`, which requires specific
> configurations for g_sbi.{epoch, build_time}. Currently, the call to
> `erofs_sb_set_48bit()` occurs too late in the execution flow, causing
> the aforementioned logic to be bypassed and resulting in incorrect
> mtimes for all inodes.
> 
> This patch moves `erofs_sb_set_48bit()` forward to the options parsing
> stage to resolve this issue.
> 
> Signed-off-by: Yifan Zhao <zhaoyifan28 at huawei.com>

I think instead we should move this part into lib/importer.c?

         g_sbi.fixed_nsec = 0;
         if (cfg.c_unix_timestamp != -1) {
                 mkfs_time = cfg.c_unix_timestamp;
         } else if (!gettimeofday(&t, NULL)) {
                 mkfs_time = t.tv_sec;
         }
         if (erofs_sb_has_48bit(&g_sbi)) {
                 g_sbi.epoch = max_t(s64, 0, mkfs_time - UINT32_MAX);
                 g_sbi.build_time = mkfs_time - g_sbi.epoch;
         } else {
                 g_sbi.epoch = mkfs_time;
         }

I mean adding `mkfs_time` in `erofs_importer_params`.

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list