bug-gzip
[Top][All Lists]
Advanced

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

bug#54290: zdiff can not handle options properly


From: Lv Ying
Subject: bug#54290: zdiff can not handle options properly
Date: Mon, 7 Mar 2022 17:29:51 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

As Bram Mertens mentioned in bug#35209:
"diff -y -W 200 /tmp/b1 /tmp/b2". But when passed to zdiff the space between "-W" and 200 causes the COLUMNS argument to be interpreted as a file:
zdiff -y -W 200 /tmp/b1 /tmp/b2
/bin/zdiff: 72: /bin/zdiff: cannot open 200: No such file

I reproduce this problem in gzip 1.11:
zdiff -y -W200 a.gz b.gz
aaaa                                                    |       bbbb
zdiff -y -W 200 a.gz b.gz
zdiff: line 66: 200: No such file or directory

Also, file before options is not supported:
zdiff a.gz b.gz -y -W200
zdiff: line 66: -y: No such file or directory
diff a b -y -W 200
aaaa                                                    |       bbbb

This is because zdiff.in implement option parse is simple. zdiff.in first parse all the options by while loop. The use cmp="$cmp --" sperate options and file arguments. It is understandable that zdiff does not want to repeat the parameter parsing work of diff. So, use the simple option parse here.

However, the usage string said "Do comparisons like 'diff' does." Such usage will misldead the user just as bug#35209 mentioned.

There are two suggestions we may discuss:
1. update usage string, add detailed restricted instructions: e.g NO space between option and option argument, all the options should come before the filename parameter.
2. rewrite options parse function make it work just like diff.

--
Thanks!
Lv Ying





reply via email to

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