Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 36991 - sys-apps/file goes into an infinite loop
Summary: sys-apps/file goes into an infinite loop
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://dev.gentoo.org/~vapier/scorche...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-01 20:35 UTC by SpanKY
Modified: 2004-01-23 20:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SpanKY gentoo-dev 2004-01-01 20:35:38 UTC
i went to emerge a new version of games-strategy/scorched3d today
while i waited i decided to shower
when i got out of the shower, i came back wearing a towel and found this:

make[1]: Entering directory `/var/tmp/portage/scorched3d-36.1/work/scorched'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/var/tmp/portage/scorched3d-36.1/work/scorched'

>>> Install scorched3d-36.1 into /var/tmp/portage/scorched3d-36.1/image/ category games-strategy

and thats it !
a quick `pstree` shows:
root@vapier 0 root # pstree `pidof python`
emerge---sandbox---ebuild.sh-+-ebuild.sh---dobin---dobin-+-file
                             |                           `-grep
                             `-tee
a quick `top` shows that file is the one wh0ring my cpu:
root@vapier 0 root # ps u `pidof file`
USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
root     19943 98.5  0.1  2532  904 pts/4    R    23:25   5:56 file src/scorched/scorched3d

so i CTRL+C the emerge process of course and go down to the directory where this evil scorched3d is found ... running `file` on it myself caused file to hang up ... i moved the file over to another machine with diff gcc/glibc and it hung ... gave it to Mr Bones who has yet another set of system specs and it hung for him too ...
thinking maybe the binary was junk, i ran it ... it works just fine & dandy !
i tried re-emerging, but the bug is reproducable on my box

systems where this happens:
Portage 2.0.50_pre9 (default-x86-1.4, gcc-3.3.2, glibc-2.3.3_pre20031222-r0, 2.6.0) (sys-apps/file-4.06)
Portage 2.0.50_pre9 (default-1.0, gcc-2.95.3, glibc-2.2.5-r9, 2.6.0) (sys-apps/file-4.06)
Portage 2.0.49-r20 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r3, 2.4.20-gentoo-r9) (sys-apps/file-4.02)
Comment 1 SpanKY gentoo-dev 2004-01-02 09:52:45 UTC
for anyone who may look into this, the loop is here:
/usr/lib/libmagic.so : src/readelf.c : dophn_exec()
there are two loops in this function ... the second one around line 631 is the
one that is constantly executed ...
for (;;) {
    if (offset >= (size_t)bufsize)
        break;
    offset = donote(ms, nbuf, offset, (size_t)bufsize, class, swap, ph_align);
}
putting in some printf()'s shows that file never breaks out of this
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2004-01-05 15:32:00 UTC
Can you maybe printf offset, and paste a log here?
Comment 3 SpanKY gentoo-dev 2004-01-23 20:18:27 UTC
jhudso just added a patch from debian to fix this (4.07-r1)

verified it works over here