Commit 1b1a5088 for xz
commit 1b1a508859da7cd53a0567158b0fe9143d1408c1
Author: Ali Ahmet Memiş <aliamemis@disroot.org>
Date: Sat Oct 24 21:57:29 2026 +0300
xzdiff: Fix the one-operand case with the _z suffix
The _z suffix was accepted when only one file was given, but the expr
that removes the suffix requires a - or . before it. FILE became empty:
$ xzdiff foo_z
diff: '': No such file or directory
Link: https://github.com/tukaani-project/xz/pull/258
diff --git a/src/scripts/xzdiff.in b/src/scripts/xzdiff.in
index 74c1d332..4aab4dd8 100644
--- a/src/scripts/xzdiff.in
+++ b/src/scripts/xzdiff.in
@@ -95,8 +95,10 @@ if test $# -eq 1; then
# The FILE variable is used with eval, and shellcheck doesn't see that.
# shellcheck disable=SC2034
case $1 in
- *[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4)
+ *[-.][zZ] | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4)
FILE=`LC_ALL=C expr "X$1" : 'X\(.*\)[-.][abglmostxzZ24]*$'`;;
+ *_z)
+ FILE=`LC_ALL=C expr "X$1" : 'X\(.*\)_z$'`;;
*.t[abglx]z)
FILE=`LC_ALL=C expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
*.tbz2)