From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3449 Path: news.gmane.org!not-for-mail From: Paul Schutte Newsgroups: gmane.linux.lib.musl.general Subject: Re: Fix for tcsh Date: Fri, 21 Jun 2013 22:00:56 +0200 Message-ID: References: <20130621155225.GD29800@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bf0c86c570c6d04dfaf855f X-Trace: ger.gmane.org 1371844869 4040 80.91.229.3 (21 Jun 2013 20:01:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Jun 2013 20:01:09 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3453-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jun 21 22:01:11 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 1Uq7WA-00025x-6d for gllmg-musl@plane.gmane.org; Fri, 21 Jun 2013 22:01:10 +0200 Original-Received: (qmail 15478 invoked by uid 550); 21 Jun 2013 20:01:08 -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 15431 invoked from network); 21 Jun 2013 20:01:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Tkx+V9B8X2gT8j/yeYWZVwI7YoxBhgGyX9rLLGb0OHo=; b=CAgAuHDzEzNSLH9xZqY7HT2h34oFDx6V50ZdrxMMlS9L7Ko3gcaI+2i1s8P5nC6rXQ Afl2toyz6IuLvgSCJsJ4DIWX5lXPpX0ed1rr0K+OzV2JwkZNikI6EMa5KHT6H7mjO4nm y9XWajxg+T/SIWkO99brfWaoFR/vY2Lcq6uwYH51bUcSQfgKNHNEQaof7P5clFKxgezd pRqkuw7pIwR0/YV66y4TqBQNdZhBbC8WZMmVy7OqEJd8/Gqs/fb1DT8nAkLrRfd8lc97 6hAFyXJuFKo7QVGIwB9fhoAWry5GYsTK0DtbQ/myklsNF8AESwGI/ruvGBPxsgPxyWIo SbAA== X-Received: by 10.194.93.74 with SMTP id cs10mr10619443wjb.9.1371844856185; Fri, 21 Jun 2013 13:00:56 -0700 (PDT) In-Reply-To: <20130621155225.GD29800@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:3449 Archived-At: --047d7bf0c86c570c6d04dfaf855f Content-Type: text/plain; charset=ISO-8859-1 Thanks Rich. I thought that BSDWAIT was defined in one of the standard headers. You are right about where BSDWAIT is defined, but now I am back to how should I write the "ifdef" ? I could use* !(defined(__ANDROID__) || (defined(__linux__)&& !defined(__GLIBC__)))* in the place of "if !defined(__ANDROID__)", but then things might go wrong for uclibc and other libcs. If I understand you correctly, all new implementations should use int instead of union, so above ifdef should be a workable solution. #if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) *# if !defined(__ANDROID__)* # define BSDWAIT # endif #endif /* _BSD || (IRIS4D && __STDC__) || __lucid || glibc */ Regards Paul On Fri, Jun 21, 2013 at 5:52 PM, Rich Felker wrote: > 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 > --047d7bf0c86c570c6d04dfaf855f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks Rich.

I thought th= at BSDWAIT was defined in one of the standard headers.

You are= right about where BSDWAIT is defined, but now I am back to how should I wr= ite the "ifdef" ?

I could use !(defined(__ANDROID__) || (defined(__linux__)&= & !defined(__GLIBC__)))=A0 in the place of "if !defined(__ANDR= OID__)", but then things might go wrong for uclibc and other libcs.
If I understand you correctly, all new implementations should use= int instead of union, so above ifdef should be a workable solution.

#if defined(_BSD) || (defined(IRIS4D) && __STD= C__) || defined(__lucid) || defined(__linux__) || defined(__GNU__) || defin= ed(__GLIBC__)
# if !defined(__ANDROID__)
#=A0 define BSDWAIT
# endif
#end= if /* _BSD || (IRIS4D && __STDC__) || __lucid || glibc */

Regards
Paul



On Fri,= Jun 21, 2013 at 5:52 PM, Rich Felker <dalias@aerifal.cx> wr= ote:
On Fri, Jun 21, 2013 at 11:19:01AM +0200, Pa= ul 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=3D'"/usr/local/bin/tcsh= "' =A0 =A0sh.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
> =A0 =A0 union wait w;
> #else /* !BSDWAIT */
> =A0 =A0 int =A0 =A0 w;
> #endif /* !BSDWAIT */
>
>
> If I just use
>
> //#ifdef BSDWAIT
> // =A0 =A0union wait w;
> //#else /* !BSDWAIT */
> =A0 =A0 int =A0 =A0 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 w= rong;
glibc just included gcc-specific hacks in the declaration of wait and
waitpid to allow them to accept "union wait *" instead of "i= nt *" 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<= br> 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&qu= ot;
as int and cast it to (void *) when passing it to the functions.

Rich

--047d7bf0c86c570c6d04dfaf855f--