commit bash-20201226 snapshot

This commit is contained in:
Chet Ramey
2020-12-30 13:17:27 -05:00
parent 3c5683a47b
commit e58dc557e2
18 changed files with 734 additions and 662 deletions
+28
View File
@@ -9232,3 +9232,31 @@ execute_cmd.c
doc/bashref.texi
- PROMPT_COMMANDS: clean up a couple of remaining instances of this
name. Report from Eli Schwartz <eschwartz@archlinux.org>
12/26
-----
subst.c
- command_substitute: make sure that the child process always has
pipeline_pgrp == shell_pgrp: if pipeline_pgrp is non-zero when we
get to the child, meaning that we're part of an already-forked
child that is, for instance, running redirections, we need to reset
shell_pgrp to it to preserve the invariant. Fixes bug with terminal
being set to the incorrect pgrp reported by oguzismailuysal@gmail.com
12/29
-----
configure.ac,builtins/shobj-conf,m4/threadlib.m4
- midnightbsd: update auto-configuration to treat MidnightBSD like
FreeBSD. From https://savannah.gnu.org/patch/?10006
12/30
-----
examples/loadables/stat.c
- stattime: use strftime with a default format or the format supplied
with the -F option to format the file time information
- stat_builtin: now takes a -F fmt option for a strftime format string;
change to function calling sequences to pass the format down to
stattime
examples/loadables/Makefile.in
- stat: now built and installed by default
+5 -1
View File
@@ -100,6 +100,10 @@ static int expand_and_print_history PARAMS((WORD_LIST *));
#define CFLAG 0x40
#define DFLAG 0x80
#ifndef TIMELEN_MAX
# define TIMELEN_MAX 128
#endif
int
history_builtin (list)
WORD_LIST *list;
@@ -328,7 +332,7 @@ histtime (hlist, histtimefmt)
HIST_ENTRY *hlist;
const char *histtimefmt;
{
static char timestr[128];
static char timestr[TIMELEN_MAX];
time_t t;
struct tm *tm;
+5 -1
View File
@@ -184,6 +184,10 @@ extern int errno;
#define SKIP1 "#'-+ 0"
#define LENMODS "hjlLtz"
#ifndef TIMELEN_MAX
# define TIMELEN_MAX 128
#endif
extern time_t shell_start_time;
#if !HAVE_ASPRINTF
@@ -449,7 +453,7 @@ printf_builtin (list)
case '(':
{
char *timefmt, timebuf[128], *t;
char *timefmt, timebuf[TIMELEN_MAX], *t;
int n;
intmax_t arg;
time_t secs;
Vendored
+3 -2
View File
@@ -8157,7 +8157,7 @@ fi
# need special flags to disable these optimizations. For example, the
# definition of 'errno' in <errno.h>.
case "$host_os" in
aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
aix* | freebsd* | midnightbsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
esac
fi
@@ -20413,7 +20413,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
;;
esac ;;
netbsd*|openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
freebsd*) LOCAL_CFLAGS='-DHEREDOC_PIPESIZE=4096' ;;
freebsd*|midnightbsd*) LOCAL_CFLAGS='-DHEREDOC_PIPESIZE=4096' ;;
*qnx[67]*) LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
@@ -20437,6 +20437,7 @@ freebsd[3-9]*)
fi ;;
freebsdelf*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
dragonfly*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
midnightbsd*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
esac
case "$host_cpu" in
+3 -2
View File
@@ -5,7 +5,7 @@ dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
# Copyright (C) 1987-2020 Free Software Foundation, Inc.
# Copyright (C) 1987-2021 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
@@ -1164,7 +1164,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
*) AC_DEFINE(PGRP_PIPE) ;;
esac ;;
netbsd*|openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
freebsd*) LOCAL_CFLAGS='-DHEREDOC_PIPESIZE=4096' ;;
freebsd*|midnightbsd*) LOCAL_CFLAGS='-DHEREDOC_PIPESIZE=4096' ;;
*qnx[[67]]*) LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
@@ -1190,6 +1190,7 @@ freebsd[[3-9]]*)
fi ;;
freebsdelf*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
dragonfly*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
midnightbsd*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
esac
case "$host_cpu" in
BIN
View File
Binary file not shown.
+25 -25
View File
@@ -1,12 +1,12 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/MacPorts 2020.54632_2) (preloaded format=etex 2020.9.3) 21 DEC 2020 09:45
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/MacPorts 2019.50896_2) (preloaded format=etex 2019.11.6) 25 DEC 2020 17:28
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**\nonstopmode \input /usr/local/src/bash/bash-20201218/doc/bashref.texi \input
/usr/local/src/bash/bash-20201218/doc/bashref.texi
(/usr/local/src/bash/bash-20201218/doc/bashref.texi
(/usr/src/local/bash/bash-20201218/doc/texinfo.tex
**\nonstopmode \input /Users/chet/src/bash/src/doc/bashref.texi \input /Users/c
het/src/bash/src/doc/bashref.texi
(/Users/chet/src/bash/src/doc/bashref.texi
(/Users/chet/src/bash/src/doc/texinfo.tex
Loading texinfo [version 2015-11-22.14]:
\outerhsize=\dimen16
\outervsize=\dimen17
@@ -162,20 +162,20 @@ This is `epsf.tex' v2.7.4 <14 February 2011>
texinfo.tex: doing @include of version.texi
(/usr/src/local/bash/bash-20201218/doc/version.texi) [1] [2]
(/usr/src/local/bash/bash-20201218/doc/bashref.toc [-1] [-2] [-3]) [-4]
Chapter 1
(/Users/chet/src/bash/src/doc/version.texi) [1] [2]
(/Users/chet/src/bash/src/doc/bashref.toc [-1] [-2] [-3]) [-4] Chapter 1
\openout0 = `bashref.toc'.
(/usr/src/local/bash/bash-20201218/doc/bashref.aux)
(/Users/chet/src/bash/src/doc/bashref.aux)
\openout1 = `bashref.aux'.
Chapter 2
[1] [2]
Chapter 2 [1] [2]
@cpindfile=@write2
\openout2 = `bashref.cp'.
[3] Chapter 3 [4] [5] [6]
[3] Chapter 3
[4] [5] [6]
@vrindfile=@write3
\openout3 = `bashref.vr'.
@@ -233,8 +233,8 @@ Chapter 7 [106] [107] [108] [109]
texinfo.tex: doing @include of rluser.texi
(/usr/local/src/bash/bash-20201218/lib/readline/doc/rluser.texi Chapter 8
[110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120]
(/Users/chet/src/bash/src/lib/readline/doc/rluser.texi Chapter 8 [110] [111]
[112] [113] [114] [115] [116] [117] [118] [119] [120]
Underfull \hbox (badness 7540) in paragraph at lines 813--819
[]@textrm In the ex-am-ple above, @textttsl C-u[] @textrm is bound to the func
-tion
@@ -295,22 +295,22 @@ Overfull \hbox (15.27109pt too wide) in paragraph at lines 2062--2062
texinfo.tex: doing @include of hsuser.texi
(/usr/local/src/bash/bash-20201218/lib/readline/doc/hsuser.texi Chapter 9
[145] [146] [147] [148] [149] [150]) Chapter 10 [151] [152] [153] [154]
[155] [156] [157] [158] Appendix A [159] Appendix B [160] [161] [162] [163]
[164] [165] Appendix C [166]
(/Users/chet/src/bash/src/lib/readline/doc/hsuser.texi Chapter 9 [145] [146]
[147] [148] [149] [150]) Chapter 10 [151] [152] [153] [154] [155] [156]
[157] [158] Appendix A [159] Appendix B [160] [161] [162] [163] [164] [165]
Appendix C [166]
texinfo.tex: doing @include of fdl.texi
(/usr/src/local/bash/bash-20201218/doc/fdl.texi
[167] [168] [169] [170] [171] [172] [173]) Appendix D [174] [175] [176]
[177] [178] [179] [180] [181] [182] [183] )
(/Users/chet/src/bash/src/doc/fdl.texi [167] [168] [169]
[170] [171] [172] [173]) Appendix D [174] [175] [176] [177] [178] [179]
[180] [181] [182] [183] )
Here is how much of TeX's memory you used:
3531 strings out of 497104
40262 string characters out of 6207074
3530 strings out of 497108
40062 string characters out of 6207178
87687 words of memory out of 5000000
4697 multiletter control sequences out of 15000+600000
4696 multiletter control sequences out of 15000+600000
34315 words of font info for 116 fonts, out of 8000000 for 9000
51 hyphenation exceptions out of 8191
16i,6n,16p,402b,942s stack positions out of 5000i,500n,10000p,200000b,80000s
16i,6n,16p,384b,942s stack positions out of 5000i,500n,10000p,200000b,80000s
Output written on bashref.dvi (189 pages, 789956 bytes).
+3 -3
View File
@@ -1,7 +1,7 @@
%!PS-Adobe-2.0
%%Creator: dvips(k) 2020.1 Copyright 2020 Radical Eye Software
%%Creator: dvips(k) 5.999 Copyright 2019 Radical Eye Software
%%Title: bashref.dvi
%%CreationDate: Mon Dec 21 14:45:17 2020
%%CreationDate: Fri Dec 25 22:28:42 2020
%%Pages: 189
%%PageOrder: Ascend
%%BoundingBox: 0 0 612 792
@@ -12,7 +12,7 @@
%DVIPSWebPage: (www.radicaleye.com)
%DVIPSCommandLine: dvips -D 600 -t letter -o bashref.ps bashref.dvi
%DVIPSParameters: dpi=600
%DVIPSSource: TeX output 2020.12.21:0945
%DVIPSSource: TeX output 2020.12.25:1728
%%BeginProcSet: tex.pro 0 0
%!
/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
+2 -2
View File
@@ -103,8 +103,8 @@ INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins -I${srcdir} \
ALLPROG = print truefalse sleep finfo logname basename dirname fdflags \
tty pathchk tee head mkdir rmdir mkfifo mktemp printenv id whoami \
uname sync push ln unlink realpath strftime mypid setpgid seq rm \
accept csv cut
OTHERPROG = necho hello cat pushd stat asort
accept csv cut stat
OTHERPROG = necho hello cat pushd asort
all: $(SHOBJ_STATUS)
+40 -16
View File
@@ -72,6 +72,13 @@ static char *arraysubs[] =
0
};
#define DEFTIMEFMT "%a %b %e %k:%M:%S %Z %Y"
#ifndef TIMELEN_MAX
# define TIMELEN_MAX 128
#endif
static char *stattime (time_t, const char *);
static int
getstat (fname, flags, sp)
const char *fname;
@@ -253,24 +260,33 @@ statmode(mode)
}
static char *
stattime (t)
stattime (t, timefmt)
time_t t;
const char *timefmt;
{
char *tbuf, *ret;
const char *fmt;
size_t tlen;
struct tm *tm;
fmt = timefmt ? timefmt : DEFTIMEFMT;
tm = localtime (&t);
ret = xmalloc (TIMELEN_MAX);
tlen = strftime (ret, TIMELEN_MAX, fmt, tm);
if (tlen == 0)
tlen = strftime (ret, TIMELEN_MAX, DEFTIMEFMT, tm);
tbuf = ctime (&t);
tlen = strlen (tbuf);
ret = savestring (tbuf);
ret[tlen-1] = '\0';
return ret;
}
static char *
statval (which, fname, flags, sp)
statval (which, fname, flags, fmt, sp)
int which;
char *fname;
int flags;
char *fmt;
struct stat *sp;
{
int temp;
@@ -296,11 +312,11 @@ statval (which, fname, flags, sp)
case ST_SIZE:
return itos (sp->st_size);
case ST_ATIME:
return ((flags & 2) ? stattime (sp->st_atime) : itos (sp->st_atime));
return ((flags & 2) ? stattime (sp->st_atime, fmt) : itos (sp->st_atime));
case ST_MTIME:
return ((flags & 2) ? stattime (sp->st_mtime) : itos (sp->st_mtime));
return ((flags & 2) ? stattime (sp->st_mtime, fmt) : itos (sp->st_mtime));
case ST_CTIME:
return ((flags & 2) ? stattime (sp->st_ctime) : itos (sp->st_ctime));
return ((flags & 2) ? stattime (sp->st_ctime, fmt) : itos (sp->st_ctime));
case ST_BLKSIZE:
return itos (sp->st_blksize);
case ST_BLOCKS:
@@ -316,11 +332,12 @@ statval (which, fname, flags, sp)
}
static int
loadstat (vname, var, fname, flags, sp)
loadstat (vname, var, fname, flags, fmt, sp)
char *vname;
SHELL_VAR *var;
char *fname;
int flags;
char *fmt;
struct stat *sp;
{
int i;
@@ -330,7 +347,7 @@ loadstat (vname, var, fname, flags, sp)
for (i = 0; arraysubs[i]; i++)
{
key = savestring (arraysubs[i]);
value = statval (i, fname, flags, sp);
value = statval (i, fname, flags, fmt, sp);
v = bind_assoc_variable (var, vname, key, value, ASS_FORCE);
}
return 0;
@@ -341,15 +358,16 @@ stat_builtin (list)
WORD_LIST *list;
{
int opt, flags;
char *aname, *fname;
char *aname, *fname, *timefmt;
struct stat st;
SHELL_VAR *v;
aname = "STAT";
flags = 0;
timefmt = 0;
reset_internal_getopt ();
while ((opt = internal_getopt (list, "A:Ll")) != -1)
while ((opt = internal_getopt (list, "A:F:Ll")) != -1)
{
switch (opt)
{
@@ -362,6 +380,9 @@ stat_builtin (list)
case 'l':
flags |= 2;
break;
case 'F':
timefmt = list_optarg;
break;
CASE_HELPOPT;
default:
builtin_usage ();
@@ -391,7 +412,7 @@ stat_builtin (list)
builtin_error ("%s: cannot create variable", aname);
return (EXECUTION_FAILURE);
}
if (loadstat (aname, v, fname, flags, &st) < 0)
if (loadstat (aname, v, fname, flags, timefmt, &st) < 0)
{
builtin_error ("%s: cannot assign file status information", aname);
unbind_variable (aname);
@@ -412,8 +433,11 @@ char *stat_doc[] = {
"by the -A option. The default array name is STAT. If the -L",
"option is supplied, stat does not resolve symbolic links and",
"reports information about the link itself. The -l option results",
"in longer-form listings for some of the fields. The exit status is 0",
"unless the stat fails or assigning the array is unsuccessful.",
"in longer-form listings for some of the fields. When -l is used,",
"the -F option supplies a format string passed to strftime(3) to",
"display the file time information.",
"The exit status is 0 unless the stat fails or assigning the array",
"is unsuccessful.",
(char *)NULL
};
+3
View File
@@ -643,6 +643,9 @@ stop_pipeline (async, deferred)
the_pipeline = (PROCESS *)NULL;
newjob->pgrp = pipeline_pgrp;
/* Invariant: if the shell is executing a command substitution,
pipeline_pgrp == shell_pgrp. Other parts of the shell assume this. */
if (pipeline_pgrp != shell_pgrp)
pipeline_pgrp = 0;
+4
View File
@@ -316,6 +316,10 @@ extern void restore_pgrp_pipe PARAMS((int *));
extern void set_maxchild PARAMS((int));
#ifdef DEBUG
extern void debug_print_pgrps (void);
#endif
extern int job_control; /* set to 0 in nojobs.c */
#endif /* _JOBS_H_ */
+1 -1
View File
@@ -94,7 +94,7 @@ changequote([,])dnl
# need special flags to disable these optimizations. For example, the
# definition of 'errno' in <errno.h>.
case "$host_os" in
aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
aix* | freebsd* | midnightbsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
esac
fi
BIN
View File
Binary file not shown.
+602 -606
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -6412,6 +6412,13 @@ command_substitute (string, quoted, flags)
/* The currently executing shell is not interactive. */
interactive = 0;
#if defined (JOB_CONTROL)
/* Invariant: in child processes started to run command substitutions,
pipeline_pgrp == shell_pgrp. Other parts of the shell assume this. */
if (pipeline_pgrp > 0 && pipeline_pgrp != shell_pgrp)
shell_pgrp = pipeline_pgrp;
#endif
set_sigint_handler (); /* XXX */
free_pushed_string_input ();
+2 -2
View File
@@ -10,7 +10,7 @@
# Chet Ramey
# chet@po.cwru.edu
# Copyright (C) 1996-2019 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This file is part of GNU Bash, the Bourne Again SHell.
#
@@ -123,7 +123,7 @@ sunos5*|solaris2*)
;;
# All versions of Linux (including Gentoo/FreeBSD) or the semi-mythical GNU Hurd.
linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*|dragonfly*)
linux*-*|gnu*-*|k*bsd*-gnu-*|midnightbsd*freebsd*|dragonfly*)
SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+1 -1
View File
@@ -1,4 +1,4 @@
BUILD_DIR=/usr/local/build/bash/bash-current
BUILD_DIR=/usr/local/build/chet/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR