🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #1165

question about nojobs.c, bash-1.04

#1165
From: Brian Fox
Date: Fri, 09 Feb 1990 20:03
67 lines
2443 bytes
   Date: 9 Feb 90 18:37:47 GMT
   From: asuvax!ncar!tank!sophist!goer@cs.utexas.edu  (Richard Goerwitz)
   Organization: University of Chicago
   Sender: bug-bash-request@prep.ai.mit.edu

   Silly question?

No.

   What is the intention here?  I'm just curious.  If the attempt is being
   made to zero out the lower seven bits of status.bytes.low, wouldn't

	  status.bytes.low &= 0x80;

   be more appropriate?

   I don't claim to be a wizard.  I'm just trying to compile Bash on my
   Xenix box.

   If this is a silly question, and I should have seen what was going on
   I'd still like to know about my mistake.

You (among others) found this bug in Bash.  The problem was a poor
description for the structure returned by wait () on little-endian
machines.  We have since fixed the description, and here it is:

#ifdef NO_WAIT_H
#ifdef LITTLE_ENDIAN
union wait
  {
    int	w_status;		/* used in syscall */

    /* Terminated process status. */
    struct
      {
	unsigned short
	  w_Termsig  : 7,	/* termination signal */
	  w_Coredump : 1,	/* core dump indicator */
	  w_Retcode  : 8,	/* exit code if w_termsig==0 */
	  w_Fill1    : 16;	/* high 16 bits unused */
      } w_T;

    /* Stopped process status.  Returned
       only for traced children unless requested
       with the WUNTRACED option bit. */
    struct
      {
	unsigned short
	  w_Stopval : 8,	/* == W_STOPPED if stopped */
	  w_Stopsig : 8,	/* actually zero on XENIX */
	  w_Fill2   : 16;	/* high 16 bits unused */
      } w_S;
  };
#endif /* LITTLE_ENDIAN */

#define	w_termsig w_T.w_Termsig
#define w_coredump w_T.w_Coredump
#define w_retcode w_T.w_Retcode
#define w_stopval w_S.w_Stopval
#define w_stopsig w_S.w_Stopsig

#define	WSTOPPED 0177
#define WIFSTOPPED(x) (((x) . w_stopval) == WSTOPPED)
#define WIFEXITED(x) ((! (WIFSTOPPED (x))) && (((x) . w_termsig) == 0))
#define WIFSIGNALED(x) ((! (WIFSTOPPED (x))) && (((x) . w_termsig) != 0))
#endif /* NO_WAIT_H */
Technical Details
Message-ID: <9002092003.AA05239@sbphy.Ucsb.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!philmtl!uunet!tut.cis.ohio-state.edu!sbphy.mit.edu!bfox
References: <7551@tank.uchicago.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!philmtl!uunet!tut.cis.ohio-state.edu!sbphy.mit.edu!bfox
From: bfox@sbphy.mit.edu (Brian Fox)
Newsgroups: gnu.bash.bug
Subject: question about nojobs.c, bash-1.04
Message-ID: <9002092003.AA05239@sbphy.Ucsb.EDU>
Date: 9 Feb 90 20:03:57 GMT
References: <7551@tank.uchicago.edu>
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: bfox@ai.mit.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 67