mailing list of musl libc
 help / color / mirror / code / Atom feed
* Fix for tcsh
@ 2013-06-21  9:19 Paul Schutte
  2013-06-21  9:27 ` Igmar Palsenberg
  2013-06-21 15:52 ` Rich Felker
  0 siblings, 2 replies; 6+ messages in thread
From: Paul Schutte @ 2013-06-21  9:19 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 804 bytes --]

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 ?

Regards
Paul

[-- Attachment #2: Type: text/html, Size: 1191 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix for tcsh
  2013-06-21  9:19 Fix for tcsh Paul Schutte
@ 2013-06-21  9:27 ` Igmar Palsenberg
  2013-06-21 15:52 ` Rich Felker
  1 sibling, 0 replies; 6+ messages in thread
From: Igmar Palsenberg @ 2013-06-21  9:27 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]



> 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 ?

There isn't one. tcsh needs to provide a test to see if this is present, and currently has stuff hard-coded. The proper fix
would be an test added to configure.in, and remove of the hardcoded stuff in sh.proc.c



Regards,




	Igmar

[-- Attachment #2: Type: text/html, Size: 1875 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix for tcsh
  2013-06-21  9:19 Fix for tcsh Paul Schutte
  2013-06-21  9:27 ` Igmar Palsenberg
@ 2013-06-21 15:52 ` Rich Felker
  2013-06-21 20:00   ` Paul Schutte
  1 sibling, 1 reply; 6+ messages in thread
From: Rich Felker @ 2013-06-21 15:52 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix for tcsh
  2013-06-21 15:52 ` Rich Felker
@ 2013-06-21 20:00   ` Paul Schutte
  2013-06-21 20:16     ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Schutte @ 2013-06-21 20:00 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 2593 bytes --]

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 <dalias@aerifal.cx> 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
>

[-- Attachment #2: Type: text/html, Size: 3635 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix for tcsh
  2013-06-21 20:00   ` Paul Schutte
@ 2013-06-21 20:16     ` Rich Felker
  2013-06-21 20:26       ` Paul Schutte
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2013-06-21 20:16 UTC (permalink / raw)
  To: musl

On Fri, Jun 21, 2013 at 10:00:56PM +0200, Paul Schutte wrote:
> Thanks Rich.
> 
> I thought that BSDWAIT was defined in one of the standard headers.

If that were the case, you never would have had any problems, since
musl does not define it.

> 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 */

It should be simply:

#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || #defined(__lucid)

BSDWAIT (union wait instead of int) is available as a legacy
compatibility interface on glibc, but it's not desirable to use it,
much less necessary. Fixing this would eliminate the need for a
special-case excluding android, too.

Rich


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fix for tcsh
  2013-06-21 20:16     ` Rich Felker
@ 2013-06-21 20:26       ` Paul Schutte
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Schutte @ 2013-06-21 20:26 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]

Thank you very much Rich.

I really appreciate you taking the time to help with this relatively
trivial (for you guys) problem.

Regards
Paul


On Fri, Jun 21, 2013 at 10:16 PM, Rich Felker <dalias@aerifal.cx> wrote:

> On Fri, Jun 21, 2013 at 10:00:56PM +0200, Paul Schutte wrote:
> > Thanks Rich.
> >
> > I thought that BSDWAIT was defined in one of the standard headers.
>
> If that were the case, you never would have had any problems, since
> musl does not define it.
>
> > 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 */
>
> It should be simply:
>
> #if defined(_BSD) || (defined(IRIS4D) && __STDC__) || #defined(__lucid)
>
> BSDWAIT (union wait instead of int) is available as a legacy
> compatibility interface on glibc, but it's not desirable to use it,
> much less necessary. Fixing this would eliminate the need for a
> special-case excluding android, too.
>
> Rich
>

[-- Attachment #2: Type: text/html, Size: 2195 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-21 20:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-21  9:19 Fix for tcsh Paul Schutte
2013-06-21  9:27 ` Igmar Palsenberg
2013-06-21 15:52 ` Rich Felker
2013-06-21 20:00   ` Paul Schutte
2013-06-21 20:16     ` Rich Felker
2013-06-21 20:26       ` Paul Schutte

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).