GNU bug report logs - #54291
zdiff can not handle options properly

Previous Next

Package: gzip;

Reported by: CAKxHvy1w=ubGoLSKcGe8mwU36MYjHvXLW_1j3=rBi9sLJNw8UQ <at> mail.gmail.com

Date: Mon, 7 Mar 2022 12:12:02 UTC

Severity: normal

Merged with 35209, 54290, 54298

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: CAKxHvy1w=ubGoLSKcGe8mwU36MYjHvXLW_1j3=rBi9sLJNw8UQ <at> mail.gmail.com
Subject: bug#54291: closed (Re: bug#54291: zdiff can not handle options
 properly)
Date: Mon, 07 Mar 2022 17:45:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#54291: zdiff can not handle options properly

which was filed against the gzip package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 54291 <at> debbugs.gnu.org.

-- 
54291: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=54291
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: CAKxHvy1w=ubGoLSKcGe8mwU36MYjHvXLW_1j3=rBi9sLJNw8UQ <at> mail.gmail.com
Cc: fanwentao <at> huawei.com, mertensb.mazda <at> gmail.com, 54291-done <at> debbugs.gnu.org
Subject: Re: bug#54291: zdiff can not handle options properly
Date: Mon, 7 Mar 2022 09:44:06 -0800
[Message part 3 (text/plain, inline)]
On 3/7/22 01:32, Lv Ying via GNU gzip discussion and bug reports. wrote:

> 2. rewrite options parse function make it work just like diff.

Thanks for reporting the problem. I installed the attached to implement 
the above suggestion, and this should appear in the next gzip release.
[0001-zdiff-fix-arg-handling-bug.patch (text/x-patch, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Lv Ying <lvying6 <at> huawei.com>
To: <mertensb.mazda <at> gmail.com>, <eggert <at> cs.ucla.edu>
Cc: fanwentao <at> huawei.com, bug-gzip <at> gnu.org
Subject: zdiff can not handle options properly
Date: Mon, 7 Mar 2022 17:32:45 +0800
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



This bug report was last modified 3 years and 51 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.