Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 484809

Summary: [RHEL5] bash includes Control-D in "bad ELF interpreter" message
Product: Red Hat Enterprise Linux 5 Reporter: John W. Lockhart <lockhart>
Component: bashAssignee: Roman Rakus <rrakus>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: low    
Version: 5.3CC: bnater, drepper, jan.kratochvil, mhusnain, rvokal, tsmetana
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: bash-3.2-27.el5 Doc Type: Bug Fix
Doc Text:
Bash attempted to interpret the NOBITS .dynamic section of the ELF header. This resulted in a "^D: bad ELF interpreter: No such file or directory" message. This is fixed to ensure that the invalid "^D" does not appear in the error message.
Story Points: ---
Clone Of:
: 516039 (view as bug list) Environment:
Last Closed: 2011-07-21 10:38:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 516039    

Description John W. Lockhart 2009-02-10 00:26:58 UTC
Description of problem:

# ldd /usr/lib/debug/usr/bin/foomatic-combo-xml.debug
/usr/bin/ldd: /usr/lib/debug/usr/bin/foomatic-combo-xml.debug: ^D: bad ELF interpreter: No such file or directory

That's a literal Control-D in the output.

Version-Release number of selected component (if applicable):
glibc-common-2.5-24.ia64
ldd (GNU libc) 2.5

How reproducible:

Try invoking ldd on any debug file that the file command (or eu-readelf)
considers to be a shared entity.  I used foomatic-combo-xml.debug above.

I tried it first on ia64, but was able to reproduce it on i386 easily, as well.


Actual results:
/usr/bin/ldd: /usr/lib/debug/usr/bin/foomatic-combo-xml.debug: ^D: bad ELF interpreter: No such file or directory

Expected results:
Either list the linkage of the shared object, or provide an error
message in the same format as when a statically linked executable
is found (with multiple-file input), like so:

/usr/lib/debug/usr/bin/foomatic-combo-xml.debug: 
     bad ELF interpreter: No such file or directory

The Control-D makes it a bit tricky for any tests that
are invoking ldd on likely targets (ELF entities as detected
by 'file' and/or eu-readelf) to check that all required files
are present (e.g., no unresolved symbols).

Additional information:

# eu-readelf -h /usr/lib/debug/usr/bin/foomatic-combo-xml.debug
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, little endian
  Ident Version:                     1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel IA-64
  Version:                           1 (current)
  Entry point address:               0x40000000000011e0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          49968 (bytes into file)
  Flags:                             0x10
  Size of this header:               64 (bytes)
  Size of program header entries:    56 (bytes)
  Number of program headers entries: 8
  Size of section header entries:    64 (bytes)
  Number of section headers entries: 42
  Section header string table index: 39

# readelf -Wa /usr/lib/debug/usr/bin/foomatic-combo-xml.debug 2>&1 | grep -e '\.dynamic'
readelf: Warning: the .dynamic section is not contained within the dynamic segment
ELF Header:
  [21] .dynamic          NOBITS          600000000000e330 000220 0001e0 10  WA  5   0  8

Comment from Jan Kratochvil (via IRC):
You are right there is a "bug" in ldd - it should not try to intepret NOBITS .dynamic section as it finds random garbage there.  But in fact is is not a Bug as ldd just runs ld.so and this shared libraries printing is done by the executable itself - so it is printed from the runtime information

Workaround (thanks to Jan):
  If you run `eu-readelf -S' and find .dynamic as NOBITS, do not run ldd
on the file, as that would likely trigger this particular problem.

Comment 1 Jakub Jelinek 2009-02-11 10:10:54 UTC
The dynamic linker doesn't know that .dynamic is SHT_NOBITS, section header table isn't allocated.  So it would need to be ldd shell script that would run readelf -S first.

Comment 2 Andreas Schwab 2009-06-25 14:20:49 UTC
The message comes from bash, after execve returned with an error.

Comment 3 Roman Rakus 2009-08-04 13:47:42 UTC
I can't reproduce it with bash-3.2-24.el5

Comment 4 Roman Rakus 2009-08-06 10:35:24 UTC
Now I'm able to reproduce it in RHEL 5.2 with:
bash-3.2-21.el5
glibc-common-2.5-24
foomatic-3.0.2-38.3.el5

Comment 5 Roman Rakus 2009-08-06 13:30:41 UTC
Actually there is two bugs.
1) ldd shouldn't try to execute directly /usr/lib/debug/usr/bin/foomatic-combo-xml.debug
2) bash should test if ELF is PROGBITS or NOBITS

I will clone this bug for ldd

Comment 6 RHEL Program Management 2009-11-06 18:59:01 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 8 RHEL Program Management 2010-08-09 19:06:21 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 10 Roman Rakus 2011-02-21 16:38:08 UTC
Fixed in bash-3.2-27.el5

Comment 13 Misha H. Ali 2011-04-20 08:59:58 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Bash attempted to interpret the NOBITS .dynamic section of the ELF header. This resulted in an invalid "^D: bad ELF interpreter: No such file or directory" message. This is fixed to ensure that the invalid "^D" does not appear.

Comment 14 Misha H. Ali 2011-04-21 00:12:31 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-Bash attempted to interpret the NOBITS .dynamic section of the ELF header. This resulted in an invalid "^D: bad ELF interpreter: No such file or directory" message. This is fixed to ensure that the invalid "^D" does not appear.+Bash attempted to interpret the NOBITS .dynamic section of the ELF header. This resulted in a "^D: bad ELF interpreter: No such file or directory" message. This is fixed to ensure that the invalid "^D" does not appear in the error message.

Comment 15 errata-xmlrpc 2011-07-21 10:38:22 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-1073.html