bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Directory Hardlink Count Bug


From: Thomas Watson
Subject: Directory Hardlink Count Bug
Date: Sat, 26 Mar 2022 17:57:46 -0500

Hi,

When creating archives, cpio relies on the value of the `stat` system call to populate the `nlink` member of each entry's header. For directories, the cpio format manual ( https://man.archlinux.org/man/cpio.5.en ) notes that "Directories always have a value of at least two here.". However, some filesystems, such as BTRFS and possibly others ( https://linux-btrfs.vger.kernel.narkive.com/oAoDX89D/btrfs-st-nlink-for-directories ), always return 1 for `nlink` of a directory. This means that archives created on such filesystems violate the format specification and are not reproducible.

It would be good to either manually set `nlink` for directories and not trust the filesystem, or at least add an option to always force the value to 1 and thus make it reproducible across different filesystems.

Thanks for your consideration,
Thomas Watson

reply via email to

[Prev in Thread] Current Thread [Next in Thread]