[PATCH v3] erofs-utils: mkfs: fix image reproducibility of `-E(all-)fragments`

Gao Xiang hsiangkao at linux.alibaba.com
Tue Jun 3 13:15:57 AEST 2025


Hi Hongbo,

On 2025/6/3 11:08, Hongbo Li wrote:
> From: Gao Xiang <hsiangkao at linux.alibaba.com>
> 
> The timestamp of the packed inode should be fixed to the build time.
> 
> Fixes: 9fa9b017f773 ("erofs-utils: mkfs: support fragments")
> Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
> [hongbo: minor adjust]
> Signed-off-by: Hongbo Li <lihongbo22 at huawei.com>
> ---
> change since v2:
>   - compare path with strcmp;
> 
> change since v1:
>   - fix time assignment (assign `i_mtime_nsec` too) [Hongbo];
> ---
>   lib/inode.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/inode.c b/lib/inode.c
> index 108aa9e..46eb686 100644
> --- a/lib/inode.c
> +++ b/lib/inode.c
> @@ -929,7 +929,8 @@ static bool erofs_should_use_inode_extended(struct erofs_inode *inode)
>   		return true;
>   	if (inode->i_nlink > USHRT_MAX)
>   		return true;
> -	if ((inode->i_mtime != inode->sbi->build_time ||
> +	if (strcmp(inode->i_srcpath, EROFS_PACKED_INODE) &&

EROFS_PACKED_INODE is a hard-coded pointer rather than
a real path name that should be compared in the string.

Otherwise, the same path name could be matched but
that is unexpected.

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list