file(1) fails with "Invalid argument" on qemu-sh4-user
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
We recently discovered that file(1) fails on qemu-sh4-user when running on an ELF file:
(sid_sh4)
/bin/bash: ERROR: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV) error reading (Invalid argument)
(sid_sh4)
Running with "-d" yields more output:
(sid_sh4)
322: >> 7 byte&,=97,"(ARM)"]
0 == 97 = 0
mget(type=1, flag=0, offset=7, o=0, nbytes=863324, il=0, nc=1)
mget/96 @7: \000\000\
323: >> 7 byte&,=
0 == 184467440737095
[try softmagic 1]
[try elf -1]
/bin/bash: ERROR: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV) error reading (Invalid argument)
(sid_sh4)
It seems that the comparison above has a bogus (overflown?) value.
On actual hardware, it works:
root@tirpitz:~> file /bin/bash
/bin/bash: ELF 32-bit LSB executable, Renesas SH, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[
root@tirpitz:~>
I have uploaded a chroot with Debian unstable which allows to reproduce the issue:
The "0 == 184467440737095 51615 = 0" is actually fine, it's just printing "-1" as a 64-bit unsigned integer. Could you please upload the fill output of `file -d /bin/bash 2>&1`?