From nate@cs.hmc.edu  Tue Jun 22 08:57:17 2004
Return-Path: <nate@cs.hmc.edu>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 1BF2316A4CE; Tue, 22 Jun 2004 08:57:17 +0000 (GMT)
Received: from turing.cs.hmc.edu (turing.cs.hmc.edu [134.173.42.99])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 0FB7743D39; Tue, 22 Jun 2004 08:57:17 +0000 (GMT)
	(envelope-from nate@cs.hmc.edu)
Received: by turing.cs.hmc.edu (Postfix, from userid 26983)
	id A73335477C; Tue, 22 Jun 2004 01:57:04 -0700 (PDT)
Message-Id: <20040622085704.A73335477C@turing.cs.hmc.edu>
Date: Tue, 22 Jun 2004 01:57:04 -0700 (PDT)
From: Nate Eldredge <nge+freebsd@cs.hmc.edu>
Reply-To: Nate Eldredge <nge+freebsd@cs.hmc.edu>
To: FreeBSD-gnats-submit@freebsd.org
Cc: trevor@freebsd.org, nge+freebsd@cs.hmc.edu
Subject: xdiskusage is broken, workaround found
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         68194
>Category:       ports
>Synopsis:       xdiskusage is broken, workaround found
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    anders
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 22 09:00:33 GMT 2004
>Closed-Date:    Sat Feb 26 15:56:04 GMT 2005
>Last-Modified:  Sat Feb 26 15:56:04 GMT 2005
>Originator:     Nate Eldredge
>Release:        FreeBSD 5.2.1-RELEASE-p5 i386
>Organization:
>Environment:
System: FreeBSD mercury.lan 5.2.1-RELEASE-p5 FreeBSD 5.2.1-RELEASE-p5 #0: Sat Apr 24 12:48:27 PDT 2004 nate@mercury.lan:/medium/obj/medium/src/sys/MERCURY i386

xdiskusage-1.46_2
fltk-1.1.4

	
>Description:
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.

>How-To-Repeat:
	
>Fix:
--- Makefile.foo	Tue Jun 22 00:57:08 2004
+++ Makefile	Tue Jun 22 00:44:14 2004
@@ -2,7 +2,7 @@
 # Date created:				2000-09-23
 # Whom:					Trevor Johnson
 #
-# $FreeBSD: /repoman/r/pcvs/ports/x11-fm/xdiskusage/Makefile,v 1.17 2004/06/21 21:27:45 kris Exp $
+# $FreeBSD: ports/x11-fm/xdiskusage/Makefile,v 1.16 2004/03/03 04:43:38 trevor Exp $
 #
 
 PORTNAME=	xdiskusage
@@ -12,9 +12,7 @@
 MASTER_SITES=	http://xdiskusage.sourceforge.net/
 EXTRACT_SUFX=	.tgz
 
-IGNORE=		only works with 'du' output, e.g. du | xdiskusage -
-EXPIRATION_DATE=2004-08-20
-DEPRECATED=	${IGNORE}
+#IGNORE=		only works with 'du' output, e.g. du | xdiskusage -
 MAINTAINER=	trevor@FreeBSD.org
 COMMENT=	Show where disk space is taken up
 
@@ -31,7 +29,7 @@
 .endfor
 	${CXX} ${CXXFLAGS} -L${X11BASE}/lib -o \
 		${WRKSRC}/xdiskusage ${WRKSRC}/panels.o \
-		${WRKSRC}/xdiskusage.o -lfltk -lm -lXext -lX11
+		${WRKSRC}/xdiskusage.o -lfltk -lm -lXext -lX11 -static
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/xdiskusage ${PREFIX}/bin



>Release-Note:
>Audit-Trail:

From: Nate Eldredge <nge@cs.hmc.edu>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc: Nate Eldredge <nge+freebsd@cs.hmc.edu>, trevor@freebsd.org
Subject: Re: ports/68194: xdiskusage is broken, workaround found
Date: Tue, 22 Jun 2004 02:42:56 -0700 (PDT)

 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

From: Nate Eldredge <nge@cs.hmc.edu>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc: Nate Eldredge <nge+freebsd@cs.hmc.edu>, trevor@freebsd.org
Subject: Re: ports/68194: xdiskusage is broken, workaround found
Date: Tue, 22 Jun 2004 02:47:11 -0700 (PDT)

 Oh, and incidentally, xdiskusage is now at version 1.47.
 
 -- 
 Nate Eldredge
 nge@cs.hmc.edu
Responsible-Changed-From-To: freebsd-ports-bugs->trevor 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Jun 22 14:50:33 GMT 2004 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68194 

From: Nate Eldredge <nge@cs.hmc.edu>
To: anders@freebsd.org
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: ports/68194: xdiskusage is broken, workaround found
Date: Wed, 1 Sep 2004 22:30:39 -0700 (PDT)

 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
Responsible-Changed-From-To: trevor->anders 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Sep 2 23:46:01 GMT 2004 
Responsible-Changed-Why:  
Reassign to new volunteer maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68194 

From: Anders Nordby <anders@FreeBSD.org>
To: Nate Eldredge <nge@cs.hmc.edu>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: ports/68194: xdiskusage is broken, workaround found
Date: Sat, 4 Sep 2004 09:35:34 +0200

 --UlVJffcvxoiEqYs2
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 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.
 
 --UlVJffcvxoiEqYs2
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="xdiskusage.diff"
 
 diff -Nur xdiskusage.old/Makefile xdiskusage/Makefile
 --- xdiskusage.old/Makefile	Sat Sep  4 09:32:24 2004
 +++ xdiskusage/Makefile	Sat Sep  4 09:29:58 2004
 @@ -19,6 +19,14 @@
  MAN1=		xdiskusage.1
  USE_GMAKE=	yes
  USE_X_PREFIX=	yes
 +OPTIONS=	THREADS	"Threads support, necessary with threaded fltk" off
 +
 +.include <bsd.port.pre.mk>
 +
 +.if defined(WITH_THREADS)
 +CXXFLAGS+=	${PTHREAD_CFLAGS}
 +LDFLAGS+=	${PTHREAD_LIBS}
 +.endif
  
  do-build:
  .for i in panels xdiskusage
 @@ -27,7 +35,7 @@
  .endfor
  	${CXX} ${CXXFLAGS} -L${X11BASE}/lib -o \
  		${WRKSRC}/xdiskusage ${WRKSRC}/panels.o \
 -		${WRKSRC}/xdiskusage.o -lfltk -lm -lXext -lX11
 +		${WRKSRC}/xdiskusage.o -lfltk -lm -lXext -lX11 ${LDFLAGS}
  
  do-install:
  	${INSTALL_PROGRAM} ${WRKSRC}/xdiskusage ${PREFIX}/bin
 @@ -37,4 +45,4 @@
  	${INSTALL_DATA} ${WRKSRC}/README ${PREFIX}/share/doc/xdiskusage
  .endif
  
 -.include <bsd.port.mk>
 +.include <bsd.port.post.mk>
 
 --UlVJffcvxoiEqYs2--
State-Changed-From-To: open->closed 
State-Changed-By: anders 
State-Changed-When: Sat Feb 26 15:55:38 GMT 2005 
State-Changed-Why:  
I have added a knob/option to support threaded fltk library. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68194 
>Unformatted:
