Thread View: gnu.bash.bug
2 messages
2 total messages
Started by Emil M. Scoffone
Fri, 21 Jul 1989 22:14
bash bug report
Author: Emil M. Scoffone
Date: Fri, 21 Jul 1989 22:14
Date: Fri, 21 Jul 1989 22:14
227 lines
6526 bytes
6526 bytes
To: bug-bash@ai.mit.edu
GNU program: Bash 1.02
Machine: Compaq Deskpro 386/16
Operating System: System V/386 Release 3.2
(vendor: Bell Technologies)
Compiler: GNU C, version 1.35, with GNU as and ld.
****************************************
These are bugs I found while installing bash:
----------------------------------------
in `shell.c':
on line 305: 'job_control' undefined.
Fix:
changed line 304 from
#ifndef JOB_CONTROL
to
#ifndef NOJOBS
----------------------------------------
in `variables.c' and `readline.c':
`struct pwd' should be `struct passwd'
----------------------------------------
in `readline.c':
`sigsetmask' is referenced, but there is no such
system call on my UNIX.
Fix:
I defined a dummy `sigsetmask' that does nothing. I
was too lazy to write one that mimicks the behaviour of
BSD `sigsetmask'
----------------------------------------
in 'glob.c':
I added an #ifdef to use the GNU builtin alloca.
----------------------------------------
****************************************
These are bugs I found while running bash:
----------------------------------------
The shell does incorrectly reports exit codes from a killed job.
This is because a couple of masks were defined incorrectly in
`jobs.h'. I also parenthesized two expressions in 'nojobs.h'.
----------------------------------------
I get segmentation violations or memory errors, and the shell
bombs, when I hit ^D. This is the same bug I reported a couple
of days ago on a Sun 3/160, and I fixed it the same way
(added a few lines to 'parse.y').
----------------------------------------
****************************************
The following is a list of modifications to the source files:
------------------------------------------------------------
diff -c shell.c shell.c~
*** shell.c Tue Jul 11 20:33:11 1989
--- shell.c~ Fri Jul 21 15:01:20 1989
***************
*** 301,307 ****
else
{
interactive = 0;
! #ifndef NOJOBS
job_control = 0;
#endif
}
--- 301,307 ----
else
{
interactive = 0;
! #ifndef JOB_CONTROL
job_control = 0;
#endif
}
------------------------------------------------------------
diff -c variables.c variables.c~
*** variables.c Tue Jul 11 21:02:14 1989
--- variables.c~ Fri Jul 21 15:01:20 1989
***************
*** 26,31 ****
--- 26,35 ----
#include "flags.h"
#include "version.h"
+ #ifdef SYSV
+ struct pwd *getpwuid (), *getpwent ();
+ #endif
+
/* The list of shell variables that the user has created, or that came from
the environment. */
SHELL_VAR *variable_list;
------------------------------------------------------------
diff -c ./lib/readline.c ./lib/readline.c~
*** ./lib/readline.c Fri Jul 21 15:07:21 1989
--- ./lib/readline.c~ Fri Jul 21 15:02:42 1989
***************
*** 58,63 ****
--- 58,66 ----
#include <sys/stat.h>
#include <pwd.h>
+ #ifdef SYSV
+ struct pwd *getpwuid (), *getpwent ();
+ #endif
#define HACK_TERMCAP_MOTION
***************
*** 272,284 ****
*old_ttou = (Function *)NULL,
*old_ttin = (Function *)NULL,
*old_cont = (Function *)NULL;
-
- #ifdef SYSV
- void sigsetmask(mask)
- int mask;
- {
- }
- #endif SYSV
/* Handle an interrupt character. */
static
--- 275,280 ----
------------------------------------------------------------
diff -c jobs.h jobs.h~
*** jobs.h Mon Jul 17 22:14:14 1989
--- jobs.h~ Fri Jul 21 15:01:20 1989
***************
*** 17,26 ****
#define WSTOPPED 0177
#define w_status word
! #define w_termsig bytes.low & 0x7f
! #define w_coredump bytes.low & ~0x7f
#define w_stopsig bytes.high
#define w_retcode bytes.high
#define WIFEXITED(wstat) ((wstat).bytes.low == 0)
#define WIFSTOPPED(wstat) ((wstat).bytes.low == 0177)
#define WIFTERMINATED(wstat) ((wstat).bytes.high == 0)
--- 17,26 ----
#define WSTOPPED 0177
#define w_status word
! #define w_termsig bytes.low & ~0x7f
#define w_stopsig bytes.high
#define w_retcode bytes.high
+ #define w_coredump w_termsig & 0x7f
#define WIFEXITED(wstat) ((wstat).bytes.low == 0)
#define WIFSTOPPED(wstat) ((wstat).bytes.low == 0177)
#define WIFTERMINATED(wstat) ((wstat).bytes.high == 0)
------------------------------------------------------------
diff -c nojobs.c nojobs.c~
*** nojobs.c Mon Jul 17 22:14:43 1989
--- nojobs.c~ Fri Jul 21 15:11:22 1989
***************
*** 144,151 ****
/* Default return value. */
return_val = status.w_retcode & 0x7f;
! if ((status.w_termsig) != 0 &&
! (status.w_termsig) != WSTOPPED) {
#ifndef SYSV
extern char *sys_siglist[];
fprintf (stderr, "%s", sys_siglist[status.w_termsig]);
--- 144,151 ----
/* Default return value. */
return_val = status.w_retcode & 0x7f;
! if (status.w_termsig != 0 &&
! status.w_termsig != WSTOPPED) {
#ifndef SYSV
extern char *sys_siglist[];
fprintf (stderr, "%s", sys_siglist[status.w_termsig]);
------------------------------------------------------------
diff -c glob.c glob.c~
*** glob.c Tue Jul 11 21:35:20 1989
--- glob.c~ Fri Jul 21 15:02:19 1989
***************
*** 51,63 ****
#ifdef sparc
#include <alloca.h>
#else
-
- #ifdef __GNUC__
- #define alloca __builtin_alloca
- #else
extern char *alloca ();
- #endif
-
#endif /* sparc */
extern char *malloc (), *realloc ();
--- 51,57 ----
------------------------------------------------------------
diff -c parse.y parse.y~
*** parse.y Mon Jul 17 22:19:06 1989
--- parse.y~ Fri Jul 21 15:11:03 1989
***************
*** 429,440 ****
else
current_readline_line = readline (current_readline_prompt);
- if (current_readline_line == (char *) EOF)
- {
- current_readline_line = (char *)NULL;
- return (EOF);
- }
-
current_readline_line_index = 0;
current_readline_line =
(char *)xrealloc (current_readline_line,
--- 429,434 ----
bash bug report
Author: Brian Fox
Date: Fri, 21 Jul 1989 22:30
Date: Fri, 21 Jul 1989 22:30
145 lines
5237 bytes
5237 bytes
Date: Fri, 21 Jul 89 15:14:08 PDT
From: emil%chem@ucsd.edu (Emil M. Scoffone)
To: bug-bash@ai.mit.edu
GNU program: Bash 1.02
Machine: Compaq Deskpro 386/16
Operating System: System V/386 Release 3.2
(vendor: Bell Technologies)
Compiler: GNU C, version 1.35, with GNU as and ld.
****************************************
These are bugs I found while installing bash:
----------------------------------------
The shell does incorrectly reports exit codes from a killed job.
This is because a couple of masks were defined incorrectly in
`jobs.h'. I also parenthesized two expressions in 'nojobs.h'.
----------------------------------------
Thank you for your clear bug report.
I recently received a fix for the 386 problems. It has to do with the
byte order defined in the "wait" structure. Please try using this
jobs.h file, and tell me if it works.
----------------------------------------
File: /usr/gnu/src/bash/jobs.h
----------------------------------------
/* jobs.h -- structures and stuff used by the jobs.c file. */
#if !defined (SYSV) || defined (UNIXPC)
#include <sys/wait.h>
#else
#if defined (i386) || defined (ATT3B) || defined (ATT386)
union wait {
struct {
unsigned char low;
unsigned char high;
}
bytes;
short word;
};
#define WSTOPPED 0177
#define w_status word
#define w_termsig bytes.low & ~0x7f
#define w_stopsig bytes.high
#define w_retcode bytes.high
#define w_coredump w_termsig & 0x7f
#define WIFEXITED(wstat) ((wstat).bytes.low == 0)
#define WIFSTOPPED(wstat) ((wstat).bytes.low == 0177)
#define WIFTERMINATED(wstat) ((wstat).bytes.high == 0)
#else /* i386 || ATT3B || ATT386 */
#ifdef HPUX
union wait
{
int w_status; /* used in syscall */
/* Terminated process status. */
struct
{
unsigned short
w_Fill1 : 16, /* high 16 bits unused */
w_Retcode : 8, /* exit code if w_termsig==0 */
w_Coredump : 1, /* core dump indicator */
w_Termsig : 7; /* termination signal */
} w_T;
/* Stopped process status. Returned
only for traced children unless requested
with the WUNTRACED option bit. */
struct
{
unsigned short
w_Fill2 : 16, /* high 16 bits unused */
w_Stopsig : 8, /* signal that stopped us */
w_Stopval : 8; /* == W_STOPPED if stopped */
} w_S;
};
#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 /* HPUX */
#endif /* i386 || ATT3B || ATT386 */
#endif /* !defined (SYSV) || defined (UNIXPC) */
/* I looked it up. For pretty_print_job (). The real answer is 24. */
#define LONGEST_SIGNAL_DESC 20
/* We keep an array of jobs. Each entry in the array is a linked list
of processes that are piped together. The first process encountered is
the group leader. */
/* Each child of the shell is remembered in a STRUCT PROCESS. A chain of
such structures is a pipeline. The chain is circular. */
typedef struct process {
struct process *next; /* Next process in the pipeline. A circular chain. */
int pid; /* Process ID. */
union wait status; /* The status of this command as returned by wait. */
int running; /* Non-zero if this process is running. */
char *command; /* The particular program that is running. */
} PROCESS;
/* A description of a pipeline's state. */
typedef enum { JRUNNING, JSTOPPED, JDEAD, JMIXED } JOB_STATE;
#define JOBSTATE(job) (jobs[(job)]->state)
typedef struct job {
char *wd; /* The working directory at time of invocation. */
PROCESS *pipe; /* The pipeline of processes that make up this job. */
int pgrp; /* The process ID of the process group (necessary). */
int foreground; /* Non-zero if this is running in the foreground. */
int notified; /* Non-zero if already notified about job state. */
JOB_STATE state; /* The state that this job is in. */
#ifdef JOB_CONTROL
COMMAND *deferred; /* Commands that will execute when this job is done. */
#endif
} JOB;
#define NO_JOB -1 /* An impossible job array index. */
#define DUP_JOB -2 /* A possible return value for get_job_spec (). */
/* Stuff from the jobs.c file. */
extern int last_made_pid;
extern int current_job, previous_job;
extern int asynchronous_notification;
extern JOB **jobs;
extern int job_slots;
----------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads