From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3448 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Fix for tcsh Date: Fri, 21 Jun 2013 11:52:26 -0400 Message-ID: <20130621155225.GD29800@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1371829965 9102 80.91.229.3 (21 Jun 2013 15:52:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Jun 2013 15:52:45 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3452-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jun 21 17:52:47 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Uq3di-0005ZT-66 for gllmg-musl@plane.gmane.org; Fri, 21 Jun 2013 17:52:42 +0200 Original-Received: (qmail 18091 invoked by uid 550); 21 Jun 2013 15:52:40 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 18079 invoked from network); 21 Jun 2013 15:52:39 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:3448 Archived-At: On Fri, Jun 21, 2013 at 11:19:01AM +0200, Paul Schutte wrote: > Good day, > > I just want to know what would be right approach to fixing the compile > error in tcsh. > > I use the source code at ftp://ftp.astron.com/pub/tcsh/tcsh-6.18.01.tar.gz > > I get the following error: > gcc -c -g -O2 -I. -I. -D_PATH_TCSHELL='"/usr/local/bin/tcsh"' sh.proc.c > sh.proc.c: In function 'pchild': > sh.proc.c:155:16: error: storage size of 'w' isn't known > make: *** [sh.proc.o] Error 1 > > Those lines are: > > #ifdef BSDWAIT > union wait w; > #else /* !BSDWAIT */ > int w; > #endif /* !BSDWAIT */ > > > If I just use > > //#ifdef BSDWAIT > // union wait w; > //#else /* !BSDWAIT */ > int w; > //#endif /* !BSDWAIT */ > > it compiles and works (for months now without an issue). > > > My question really is what should the proper "ifdef" be if I want to send > the fix to the tcsh maintainers ? Where is BSDWAIT defined? That's the location of the relevant ifdef. Using "union wait" on any Linux system, glibc ones included, is wrong; glibc just included gcc-specific hacks in the declaration of wait and waitpid to allow them to accept "union wait *" instead of "int *" if necessary. I suspect defined(__linux__) leads to #define BSDWAIT, in which case this should just be fixed. With that said, using "union wait" at all is nonsensical. As the standards require the argument to be int *, any modern BSD should work fine with int *. In case there are historical ones that prototype the functions with union wait *, it might work to simply declare "w" as int and cast it to (void *) when passing it to the functions. Rich