Red Hat Bugzilla – Bug 484809
[RHEL5] bash includes Control-D in "bad ELF interpreter" message
Last modified: 2014-01-12 19:08:21 EST
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.
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.
The message comes from bash, after execve returned with an error.
I can't reproduce it with bash-3.2-24.el5
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
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
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 "?".
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.
Fixed in bash-3.2-27.el5
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.
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.
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