From: Sebastian Andrzej Siewior <sebast...@breakpoint.cc> xz refuses to decompress a file which has more than one hard link. It can be reproduced by (as per Vincent): |$ echo foo > file1 |$ xz file1 |$ ln file1.xz file2.xz |$ xz -dk file1.xz |xz: file1.xz: Input file has more than one hard link, skipping
This behaviour is consistent with `gzip' and `bzip2' but it is not documented. The `--force' option would ignore this restriction. I traced it back in `gzip' to the 90s but the change was not documented as why it was needed. It was moved, altered but not documented. At some point the error was restricted to <= 2 which might be related to disk quota. Ignore hard link count on input. Debian BTS: https://bugs.debian.org/975981 Reported-by: Vincent Lefevre <vinc...@vinc17.net> Signed-off-by: Sebastian Andrzej Siewior <sebast...@breakpoint.cc> --- On 2020-12-27 18:02:44 [+0100], Vincent Lefevre wrote: > Note that when I reported the bug, I used the -k option (without > it, I may understand the reason why xz refuses the operation with adjusted. src/xz/file_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xz/file_io.c b/src/xz/file_io.c index 0ba8db8fbc4cc..7703e08b75ea8 100644 --- a/src/xz/file_io.c +++ b/src/xz/file_io.c @@ -698,7 +698,7 @@ io_open_src_real(file_pair *pair) goto error; } - if (pair->src_st.st_nlink > 1) { + if (pair->src_st.st_nlink > 1 && !opt_keep_original) { message_warning(_("%s: Input file has more " "than one hard link, " "skipping"), pair->src_name); -- 2.30.0.rc2