mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: Fix for tcsh
Date: Fri, 21 Jun 2013 11:52:26 -0400	[thread overview]
Message-ID: <20130621155225.GD29800@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAKHv7phEN2Tg87WjTZ8uUJagKD+6N8VtuNzkvT-UYZxas=3AqQ@mail.gmail.com>

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


  parent reply	other threads:[~2013-06-21 15:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21  9:19 Paul Schutte
2013-06-21  9:27 ` Igmar Palsenberg
2013-06-21 15:52 ` Rich Felker [this message]
2013-06-21 20:00   ` Paul Schutte
2013-06-21 20:16     ` Rich Felker
2013-06-21 20:26       ` Paul Schutte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130621155225.GD29800@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).