Bug 1522732 - readelf exit status is 0 for empty zero-length file
Summary: readelf exit status is 0 for empty zero-length file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nick Clifton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-06 10:33 UTC by Michael Stahl
Modified: 2018-03-13 23:17 UTC (History)
4 users (show)

Fixed In Version: binutils-2.29-8.fc27 binutils-2.29-13.fc27
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-13 23:17:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Sourceware 22555 0 None None None 2019-04-23 16:01:27 UTC

Description Michael Stahl 2017-12-06 10:33:49 UTC
Description of problem:

readelf exit status is 0 for empty zero-length file

Version-Release number of selected component (if applicable):

binutils-2.29-6.fc27.x86_64

How reproducible:

always

Steps to Reproduce:

from Fedora 26 to Fedora 27, the readelf exit status changed from 1
to 0 when running "readelf -d" on an empty file:

old:

> touch /tmp/foo
> readelf -d /tmp/foo 
readelf: /tmp/foo: Error: Failed to read file's magic number
> echo $?
1
> readelf --version
GNU readelf version 2.27-28.fc26
Copyright (C) 2016 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

new:

> touch /tmp/foo
> readelf -d /tmp/foo
readelf: /tmp/foo: Error: Failed to read file's magic number
> echo $?
0
> readelf --version
GNU readelf version 2.29-6.fc27
Copyright (C) 2017 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.


but readelf still prints an error - so i think it should not exit with 0.

Comment 1 Nick Clifton 2017-12-06 12:33:57 UTC
Hi Michael,

  Thanks for reporting this bug.  The problem was an error in a Fedora local
  patch that "improves" readelf so that it reports the filename in error
  messages.  (Which only really makes a difference when readelf is run on
  multiple files at the same time).

  I have checked in a patch to fix the problem, so please try the new 
  binutils-2.29-8.fc27 rpm.  (Once it finished building...)

Cheers
  Nick

Comment 2 Michael Stahl 2017-12-07 19:56:44 UTC
okay, installed rpm from koji, my script runs without spurious errors now.

https://koji.fedoraproject.org/koji/buildinfo?buildID=1007764

Comment 3 Fedora Update System 2018-03-08 14:20:59 UTC
binutils-2.29-13.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-1e994c659e

Comment 4 Fedora Update System 2018-03-08 16:24:22 UTC
binutils-2.29-13.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-1e994c659e

Comment 5 Fedora Update System 2018-03-13 23:17:49 UTC
binutils-2.29-13.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.