dracut-cpio unit tests compare binary archive output with that of GNU
cpio, for the same set of input files. A recent change to upstream GNU
cpio, commit
6a94d5e ("New option --ignore-dirnlink"), causes some tests
to fail.
The failure is due to GNU cpio `--reproducible` now hardcoding directory
nlink values to 2, instead of using the st_nlink value reported by
stat().
Fix the unit tests by dropping the GNU cpio `--reproducible` alias
parameter, and instead specify `--ignore-devno --renumber-inodes`
explicitly, matching pre-
6a94d5e GNU cpio `--reproducible` behaviour.
Fixes: https://github.com/dracut-ng/dracut-ng/issues/1694
fn gnu_cpio_create(stdinput: &[u8], out: &str) {
let mut proc = Command::new("cpio")
- .args(&["--quiet", "-o", "-H", "newc", "--reproducible", "-F", out])
+ // As of GNU cpio commit 6a94d5e ("New option --ignore-dirnlink"),
+ // the --reproducible option hardcodes archived directory nlink
+ // values as 2. Omit it and use the dir.st_nlink value.
+ .args(&[
+ "--quiet",
+ "-o",
+ "-H",
+ "newc",
+ "--ignore-devno",
+ "--renumber-inodes",
+ "-F",
+ out,
+ ])
.stdin(Stdio::piped())
.spawn()
.expect("GNU cpio failed to start");
"-o",
"-H",
"newc",
- "--reproducible",
+ "--ignore-devno",
+ "--renumber-inodes",
"-F",
"gnu.cpio",
"--null",