Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1238298

Summary: zless fails to show empty gzip files
Product: [Fedora] Fedora Reporter: John Sullivan <jsrhbz>
Component: gzipAssignee: Petr Stodulka <pstodulk>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: pertusus, pstodulk
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gzip-1.6-8.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-14 15:33:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch
none
patch none

Description John Sullivan 2015-07-01 14:34:40 UTC
Found in gzip-1.6-2.fc20.x86_64
Present in gzip-1.6-8.fc23.src.rpm
So affects all intermediate releases. FC21 tagged since FC20 has just officially gone EOL.

See bug 579251 / bug 615303.

less (when used with Fedora's default LESSOPEN handler provided by the less package) used to have a bug whereby "less foo.gz" would work for non-empty compressed files, but return an error and garbage contents when run on a compressed empty file. This was because if the LESSOPEN filter ("|lessopen.sh") produced no output, less assumed that it has failed and opened the original file directly instead. This was fixed by introducing the syntax "||lessopen.sh" which means the script exit status is used to determine success or failure but empty output is otherwise to be trusted. Fedora's LESSOPEN handler in the less package uses this construct and now works.

The gzip package contains the zless script which still uses the "|gzip" construct so still suffers the same problem. "||" was introduced in less-436-7 so should be safe:

* Tue Dec 21 2010 Vojtech Vitek (V-Teq) <vvitek> - 436-7
- Fix for valid empty LESSOPEN pipe output (#579251, #615303)

(Why don't I just use less then? Well, I'm used to switching between boxes with a different distros or older versions of distros on, and fairly often the locally provided less *doesn't* provide a suitable default LESSOPEN that can handle compressed files. So my hands are just used to typing zless instead now...)

Comment 1 Petr Stodulka 2015-07-09 15:33:11 UTC
Created attachment 1050358 [details]
patch

Comment 2 Petr Stodulka 2015-07-09 16:08:19 UTC
Created attachment 1050365 [details]
patch

Comment 3 Petr Stodulka 2015-07-09 16:09:17 UTC
Thanks Jon for detailed report with solution.

Comment 4 Fedora Update System 2015-07-09 16:15:01 UTC
gzip-1.6-8.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/gzip-1.6-8.fc21

Comment 5 Fedora Update System 2015-07-09 16:15:09 UTC
gzip-1.6-8.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/gzip-1.6-8.fc22

Comment 6 Fedora Update System 2015-07-13 19:09:18 UTC
Package gzip-1.6-8.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing gzip-1.6-8.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-11390/gzip-1.6-8.fc22
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2015-07-14 15:33:31 UTC
gzip-1.6-8.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2015-07-21 08:17:19 UTC
gzip-1.6-8.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.