Bug 68194

Summary: xdiskusage is broken, workaround found
Product: Ports & Packages Reporter: Nate Eldredge <nge+freebsd>
Component: Individual Port(s)Assignee: Anders Nordby <anders>
Status: Closed FIXED    
Severity: Affects Only Me CC: trevor
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
xdiskusage.diff none

Description Nate Eldredge 2004-06-22 10:00:33 UTC
xdiskusage has been broken for some time.  It hangs when you start it,
unless you pipe du output into it.  As such it has been marked IGNORE,
and recently given an expiration date.

I've just been looking into this.  It currently looks like a bug in
fltk.  xdiskusage hangs at one point when it tries to read from a pipe
(it gets piped input from df and/or du).  I have reduced the program
to nothing but this (no fltk calls) and it still hangs.  However, if
you don't link it with fltk it works.  So presumably fltk does
something offensive when its shared library loads, though what it
would be I don't know.  It may have something to do with threads.

As a workaround, however, linking with -static also fixes it.  I don't
know why; I guess this suppresses the troublesome load behavior of
fltk.  But this gives us a way to get xdiskusage working again: simply
add -static to the link command.

I'm going to keep investigating this and hopefully fix or at least
report the fltk bug.

Hopefully this will earn xdiskusage a stay of execution, it's a very
useful program.
Comment 1 Nate Eldredge 2004-06-22 10:42:56 UTC
Ah.  Figured it out.  Not a bug in fltk, it seems.

fltk can optionally be compiled with threads enabled.  If you disable
fltk's threads, xdiskusage works as is.  If you have threads enabled for
fltk, you must compile xdiskusage with -pthread (or probably at least
-lc_r or -DREENTRANT).  Otherwise xdiskusage uses the ordinary stdio calls
from libc and it doesn't correctly interact with the locking that's being
done by fltk's threading stuff, resulting in a hang.

I'll leave it to you to figure out the best way of implementing this in
the makefile...

Thanks!

-- 
Nate Eldredge
nge@cs.hmc.edu
Comment 2 Nate Eldredge 2004-06-22 10:47:11 UTC
Oh, and incidentally, xdiskusage is now at version 1.47.

-- 
Nate Eldredge
nge@cs.hmc.edu
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2004-06-22 15:50:33 UTC
Responsible Changed
From-To: freebsd-ports-bugs->trevor

Over to maintainer.
Comment 4 Nate Eldredge 2004-09-02 06:30:39 UTC
Hi Anders, it appears you are the new maintainer for xdiskusage, so you
might want to have a look at this PR 68194.  It still applies to
xdiskusage 1.47.  It's the original reason the port was scheduled to
expire.  Looks like it doesn't happen for you (since you un-expired it
with the comment "this port works"); maybe you don't have fltk compiled
with threads.  Anyway, as I mention, I know the fix but not the best way
to implement it.  Just thought I'd bring it to your attention.

Thanks for picking up xdiskusage, it's a very useful tool.

-- 
Nate Eldredge
nge@cs.hmc.edu
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2004-09-03 00:46:01 UTC
Responsible Changed
From-To: trevor->anders

Reassign to new volunteer maintainer.
Comment 6 Anders Nordby freebsd_committer freebsd_triage 2004-09-04 08:35:34 UTC
Hi,

How about you try the attached patch. I added a knob for adding threads
support to the xdiskusage port. If you have a threaded fltk library,
xdiskusage should be threaded too. At least, that way your problem does
not occur.

Cheers,

-- 
Anders.
Comment 7 Anders Nordby freebsd_committer freebsd_triage 2005-02-26 15:55:38 UTC
State Changed
From-To: open->closed

I have added a knob/option to support threaded fltk library.