From 1b1a508859da7cd53a0567158b0fe9143d1408c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20Ahmet=20Memi=C5=9F?= Date: Sat, 24 Oct 2026 21:57:29 +0300 Subject: [PATCH] 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 --- src/scripts/xzdiff.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)