mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-06 03:40:50 +02:00
commit bash-20150605 snapshot
This commit is contained in:
@@ -8724,3 +8724,86 @@ lib/readline/funmap.c
|
||||
- vi-insertion-mode: make sure it maps to rl_vi_insert_mode, which is
|
||||
actually what the `i' keybinding in vi_movement_keymap maps to.
|
||||
Cosmetic fix from isabella parakiss <izaberina@gmail.com>
|
||||
|
||||
6/2
|
||||
---
|
||||
general.c
|
||||
- conf_standard_path: moved get_standard_path here from command.def; made
|
||||
public function
|
||||
|
||||
general.h
|
||||
- conf_standard_path: extern declaration
|
||||
|
||||
|
||||
6/3
|
||||
---
|
||||
parse.y
|
||||
- parse_matched_pair: make sure that command substitution constructs
|
||||
within ${...} expansions are parsed as such using parse_comsub, so the
|
||||
P_FIRSTCLOSE flag doesn't stop parsing if a right brace appears within
|
||||
the comsub. Report from Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
findcmd.c
|
||||
- search_for_command: take two new flags for FLAGS arg: CMDSRCH_STDPATH,
|
||||
which means use the command -p path, and CMDSRCH_TEMPENV, currently
|
||||
unused. Existing flag value of 1 now CMDSRCH_HASH
|
||||
- search_for_command: don't set `path' to NULL if it wasn't found in
|
||||
the temporary environment; we can use it later
|
||||
- search_for_command: look for the hashed file if temp_path == 0, not
|
||||
if we set path back to 0 (or path lookup failed)
|
||||
- search_for_command: just call find_user_command_in_path with a
|
||||
pathlist argument that's set depending on the flags passed
|
||||
- find_in_path: new function, just calls find_user_command_in_path at
|
||||
this point
|
||||
- search_for_command: don't put non-existent files into the hash table
|
||||
|
||||
findcmd.h
|
||||
- CMDSRCH_*: new flags for search_for_command
|
||||
- find_in_path: extern declaration
|
||||
|
||||
execute_cmd.c
|
||||
- execute_disk_command: check for CMD_STDPATH and call search_for_command
|
||||
with CMDSRCH_STDPATH if it's set
|
||||
|
||||
builtins/command.def
|
||||
- command_builtin: if -p given without -v or -V, set the CMD_STDPATH flag
|
||||
in the simple command we construct from the rest of the argument list.
|
||||
This fixes the command -p cmd issue with changing $PATH for the duration
|
||||
of `cmd's execution reported by <sdowdy@rap.ucar.edu>
|
||||
|
||||
builtins/common.h
|
||||
- CDESC_STDPATH: new flag for describe_command; means to use standard path
|
||||
for command -pv or -pV
|
||||
|
||||
builtins/command.def
|
||||
- command_builtin: if -p given with -v or -V, pass the CDESC_STDPATH flag
|
||||
to describe_command
|
||||
|
||||
builtins/type.def
|
||||
- describe_command: if given the CDESC_STDPATH flag, use find_in_path with
|
||||
the conf_standard_path() result. Since `all' will never be on with this
|
||||
flag, at least not yet, we can allocate and free the path list. Fixes
|
||||
the bug of a temporary environment value for PATH preceding a
|
||||
`command -pv' or `command -pV' persisting when the command finishes and
|
||||
means we use fewer unwind-protects
|
||||
|
||||
6/4
|
||||
---
|
||||
Makefile.in (plus other Makefile.ins)
|
||||
- VPATH: remove `.' from VPATH value. It's not needed any more and it
|
||||
trips a GNU make 4.1 bug on Cygwin. Report and fix from Eric Blake
|
||||
<eblake@redhat.com>
|
||||
|
||||
lib/readline/histfile.c
|
||||
- history_tempfile: new function, takes history file name as template
|
||||
and creates a temp file name including the PID
|
||||
- history_truncate_file, history_do_write: instead of creating backup
|
||||
and restoring it on failure, use history_tempfile to create a temp
|
||||
file name, write to it, then rename to original history filename
|
||||
(handling symlinks using history_restore()). Original report and
|
||||
patch from Russell Stuart <russell-savannah@stuart.id.au>
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- ulimit: clarify that -c and -f are in increments of 512 bytes when
|
||||
in posix mode. Fix from Robin Johnson <robbat2@gentoo.org> via
|
||||
<vapier@gentoo.org>
|
||||
|
||||
@@ -944,6 +944,7 @@ tests/exec6.sub f
|
||||
tests/exec7.sub f
|
||||
tests/exec8.sub f
|
||||
tests/exec9.sub f
|
||||
tests/exec10.sub f
|
||||
tests/exp.tests f
|
||||
tests/exp.right f
|
||||
tests/exp1.sub f
|
||||
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
# Makefile for bash-4.3, version 4.12
|
||||
# Makefile for bash-4.3, version 4.13
|
||||
#
|
||||
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
|
||||
|
||||
@@ -61,7 +61,7 @@ topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
top_builddir = @BUILD_DIR@
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
@SET_MAKE@
|
||||
CC = @CC@
|
||||
@@ -1453,7 +1453,8 @@ builtins/wait.o: ${BASHINCDIR}/chartypes.h pathnames.h
|
||||
builtins/complete.o: config.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h sig.h
|
||||
builtins/complete.o: unwind_prot.h variables.h arrayfunc.h conftypes.h
|
||||
builtins/complete.o: bashtypes.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
builtins/complete.o: builtins.h pathnames.h
|
||||
builtins/complete.o: builtins.h pathnames.h general.h
|
||||
builtins/complete.o: bashtypes.h ${BASHINCDIR}/chartypes.h xmalloc.h
|
||||
builtins/complete.o: pcomplete.h
|
||||
builtins/complete.o: ${DEFSRC}/common.h ${DEFSRC}/bashgetopt.h
|
||||
builtins/mapfile.o: command.h config.h ${BASHINCDIR}/memalloc.h error.h general.h xmalloc.h ${BASHINCDIR}/maxpath.h
|
||||
|
||||
@@ -36,7 +36,7 @@ EXEEXT = @EXEEXT@
|
||||
prefix = @prefix@
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
topdir = @top_srcdir@
|
||||
|
||||
datarootdir = @datarootdir@
|
||||
@@ -635,7 +635,8 @@ complete.o: ../config.h ../pathnames.h
|
||||
complete.o: ${topdir}/shell.h $(topdir)/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h ${topdir}/sig.h
|
||||
complete.o: ${topdir}/unwind_prot.h ${topdir}/variables.h
|
||||
complete.o: ${topdir}/bashtypes.h ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
complete.o: ${topdir}/builtins.h
|
||||
complete.o: ${topdir}/builtins.h ${topdir}/general.h
|
||||
complete.o: ${topdir}/bashtypes.h ${BASHINCDIR}/chartypes.h ${topdir}/xmalloc.h
|
||||
complete.o: ${topdir}/pcomplete.h
|
||||
complete.o: ${srcdir}/common.h ${srcdir}/bashgetopt.h
|
||||
mapfile.o: $(topdir)/command.h ../config.h $(BASHINCDIR)/memalloc.h
|
||||
|
||||
+7
-64
@@ -1,7 +1,7 @@
|
||||
This file is command.def, from which is created command.c.
|
||||
It implements the builtin "command" in Bash.
|
||||
|
||||
Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2015 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -63,7 +63,6 @@ extern size_t confstr __P((int, char *, size_t));
|
||||
extern int subshell_environment;
|
||||
|
||||
static void restore_path __P((char *));
|
||||
static char *get_standard_path __P((void));
|
||||
|
||||
/* Run the commands mentioned in LIST without paying attention to shell
|
||||
functions. */
|
||||
@@ -82,7 +81,7 @@ command_builtin (list)
|
||||
switch (opt)
|
||||
{
|
||||
case 'p':
|
||||
use_standard_path = 1;
|
||||
use_standard_path = CDESC_STDPATH;
|
||||
break;
|
||||
case 'V':
|
||||
verbose = CDESC_SHORTDESC|CDESC_ABSPATH; /* look in common.h for constants */
|
||||
@@ -109,30 +108,13 @@ command_builtin (list)
|
||||
}
|
||||
#endif
|
||||
|
||||
begin_unwind_frame ("command_builtin");
|
||||
|
||||
if (use_standard_path)
|
||||
{
|
||||
old_path = get_string_value ("PATH");
|
||||
/* If old_path is NULL, $PATH is unset. If so, we want to make sure
|
||||
it's unset after this command completes. */
|
||||
if (old_path)
|
||||
old_path = savestring (old_path);
|
||||
add_unwind_protect ((Function *)restore_path, old_path);
|
||||
|
||||
standard_path = get_standard_path ();
|
||||
bind_variable ("PATH", standard_path ? standard_path : "", 0);
|
||||
stupidly_hack_special_variables ("PATH");
|
||||
FREE (standard_path);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
int found, any_found;
|
||||
|
||||
for (any_found = 0; list; list = list->next)
|
||||
{
|
||||
found = describe_command (list->word->word, verbose);
|
||||
found = describe_command (list->word->word, verbose|use_standard_path);
|
||||
|
||||
if (found == 0 && verbose != CDESC_REUSABLE)
|
||||
sh_notfound (list->word->word);
|
||||
@@ -140,11 +122,12 @@ command_builtin (list)
|
||||
any_found += found;
|
||||
}
|
||||
|
||||
run_unwind_frame ("command_builtin");
|
||||
return (any_found ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
|
||||
}
|
||||
|
||||
#define COMMAND_BUILTIN_FLAGS (CMD_NO_FUNCTIONS | CMD_INHIBIT_EXPANSION | CMD_COMMAND_BUILTIN)
|
||||
begin_unwind_frame ("command_builtin");
|
||||
|
||||
#define COMMAND_BUILTIN_FLAGS (CMD_NO_FUNCTIONS | CMD_INHIBIT_EXPANSION | CMD_COMMAND_BUILTIN | (use_standard_path ? CMD_STDPATH : 0))
|
||||
|
||||
/* We don't want this to be reparsed (consider command echo 'foo &'), so
|
||||
just make a simple_command structure and call execute_command with it. */
|
||||
@@ -153,18 +136,7 @@ command_builtin (list)
|
||||
command->value.Simple->redirects = (REDIRECT *)NULL;
|
||||
command->flags |= COMMAND_BUILTIN_FLAGS;
|
||||
command->value.Simple->flags |= COMMAND_BUILTIN_FLAGS;
|
||||
#if 0
|
||||
/* This breaks for things like ( cd /tmp ; command z ababa ; echo next )
|
||||
or $(command echo a ; command echo b;) or even
|
||||
{ command echo a; command echo b; } & */
|
||||
/* If we're in a subshell, see if we can get away without forking
|
||||
again, since we've already forked to run this builtin. */
|
||||
if (subshell_environment)
|
||||
{
|
||||
command->flags |= CMD_NO_FORK;
|
||||
command->value.Simple->flags |= CMD_NO_FORK;
|
||||
}
|
||||
#endif
|
||||
|
||||
add_unwind_protect ((char *)dispose_command, command);
|
||||
result = execute_command (command);
|
||||
|
||||
@@ -189,32 +161,3 @@ restore_path (var)
|
||||
|
||||
stupidly_hack_special_variables ("PATH");
|
||||
}
|
||||
|
||||
/* Return a value for PATH that is guaranteed to find all of the standard
|
||||
utilities. This uses Posix.2 configuration variables, if present. It
|
||||
uses a value defined in config.h as a last resort. */
|
||||
static char *
|
||||
get_standard_path ()
|
||||
{
|
||||
#if defined (_CS_PATH) && defined (HAVE_CONFSTR)
|
||||
char *p;
|
||||
size_t len;
|
||||
|
||||
len = (size_t)confstr (_CS_PATH, (char *)NULL, (size_t)0);
|
||||
if (len > 0)
|
||||
{
|
||||
p = (char *)xmalloc (len + 2);
|
||||
*p = '\0';
|
||||
confstr (_CS_PATH, p, len);
|
||||
return (p);
|
||||
}
|
||||
else
|
||||
return (savestring (STANDARD_UTILS_PATH));
|
||||
#else /* !_CS_PATH || !HAVE_CONFSTR */
|
||||
# if defined (CS_PATH)
|
||||
return (savestring (CS_PATH));
|
||||
# else
|
||||
return (savestring (STANDARD_UTILS_PATH));
|
||||
# endif /* !CS_PATH */
|
||||
#endif /* !_CS_PATH || !HAVE_CONFSTR */
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ do { \
|
||||
#define CDESC_FORCE_PATH 0x020 /* type -ap or type -P */
|
||||
#define CDESC_NOFUNCS 0x040 /* type -f */
|
||||
#define CDESC_ABSPATH 0x080 /* convert to absolute path, no ./ */
|
||||
#define CDESC_STDPATH 0x100 /* command -p */
|
||||
|
||||
/* Flags for get_job_by_name */
|
||||
#define JM_PREFIX 0x01 /* prefix of job name */
|
||||
|
||||
+12
-6
@@ -1,7 +1,7 @@
|
||||
This file is type.def, from which is created type.c.
|
||||
It implements the builtin "type" in Bash.
|
||||
|
||||
Copyright (C) 1987-2011 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2015 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -204,6 +204,7 @@ type_builtin (list)
|
||||
* CDESC_FORCE_PATH force a path search for type -P
|
||||
* CDESC_NOFUNCS skip function lookup for type -f
|
||||
* CDESC_ABSPATH convert to absolute path, no ./ prefix
|
||||
* CDESC_STDPATH command -p standard path list
|
||||
*
|
||||
* CDESC_ALL says whether or not to look for all occurrences of COMMAND, or
|
||||
* return after finding it once.
|
||||
@@ -214,7 +215,7 @@ describe_command (command, dflags)
|
||||
int dflags;
|
||||
{
|
||||
int found, i, found_file, f, all;
|
||||
char *full_path, *x;
|
||||
char *full_path, *x, *pathlist;
|
||||
SHELL_VAR *func;
|
||||
#if defined (ALIAS)
|
||||
alias_t *alias;
|
||||
@@ -346,12 +347,17 @@ describe_command (command, dflags)
|
||||
/* Now search through $PATH. */
|
||||
while (1)
|
||||
{
|
||||
if (all == 0)
|
||||
if (dflags & CDESC_STDPATH) /* command -p, all cannot be non-zero */
|
||||
{
|
||||
pathlist = conf_standard_path ();
|
||||
full_path = find_in_path (command, pathlist, FS_EXEC_PREFERRED|FS_NODIRS);
|
||||
free (pathlist);
|
||||
/* Will only go through this once, since all == 0 if STDPATH set */
|
||||
}
|
||||
else if (all == 0)
|
||||
full_path = find_user_command (command);
|
||||
else
|
||||
full_path =
|
||||
user_command_matches (command, FS_EXEC_ONLY, found_file);
|
||||
/* XXX - should that be FS_EXEC_PREFERRED? */
|
||||
full_path = user_command_matches (command, FS_EXEC_ONLY, found_file); /* XXX - should that be FS_EXEC_PREFERRED? */
|
||||
|
||||
if (full_path == 0)
|
||||
break;
|
||||
|
||||
@@ -174,6 +174,7 @@ typedef struct element {
|
||||
#define CMD_COMMAND_BUILTIN 0x0800 /* command executed by `command' builtin */
|
||||
#define CMD_COPROC_SUBSHELL 0x1000
|
||||
#define CMD_LASTPIPE 0x2000
|
||||
#define CMD_STDPATH 0x4000 /* use standard path for command lookup */
|
||||
|
||||
/* What a command looks like. */
|
||||
typedef struct command {
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ RM = rm -f
|
||||
|
||||
topdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
+8
-4
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Wed May 27 14:55:39 EDT 2015
|
||||
.\" Last Change: Fri Jun 5 14:38:09 EDT 2015
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2015 May 27" "GNU Bash 4.4"
|
||||
.TH BASH 1 "2015 June 5" "GNU Bash 4.4"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -10176,7 +10176,6 @@ is assumed. Values are in 1024-byte increments, except for
|
||||
which is in seconds;
|
||||
.BR \-p ,
|
||||
which is in units of 512-byte blocks;
|
||||
and
|
||||
.BR \-P ,
|
||||
.BR \-T ,
|
||||
.BR \-b ,
|
||||
@@ -10184,7 +10183,12 @@ and
|
||||
.BR \-n ,
|
||||
and
|
||||
.BR \-u ,
|
||||
which are unscaled values.
|
||||
which are unscaled values;
|
||||
and, when in Posix mode,
|
||||
.B \-c
|
||||
and
|
||||
.BR \-f ,
|
||||
which are in 512-byte increments.
|
||||
The return status is 0 unless an invalid option or argument is supplied,
|
||||
or an error occurs while setting a new limit.
|
||||
.RE
|
||||
|
||||
Binary file not shown.
+5439
-5406
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,10 +1,10 @@
|
||||
\entry{:}{41}{\code {:}}
|
||||
\entry{.}{41}{\code {.}}
|
||||
\entry{break}{41}{\code {break}}
|
||||
\entry{break}{42}{\code {break}}
|
||||
\entry{cd}{42}{\code {cd}}
|
||||
\entry{continue}{42}{\code {continue}}
|
||||
\entry{eval}{42}{\code {eval}}
|
||||
\entry{exec}{42}{\code {exec}}
|
||||
\entry{exec}{43}{\code {exec}}
|
||||
\entry{exit}{43}{\code {exit}}
|
||||
\entry{export}{43}{\code {export}}
|
||||
\entry{getopts}{43}{\code {getopts}}
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
\initial {B}
|
||||
\entry {\code {bg}}{98}
|
||||
\entry {\code {bind}}{48}
|
||||
\entry {\code {break}}{41}
|
||||
\entry {\code {break}}{42}
|
||||
\entry {\code {builtin}}{49}
|
||||
\initial {C}
|
||||
\entry {\code {caller}}{50}
|
||||
@@ -27,7 +27,7 @@
|
||||
\entry {\code {echo}}{52}
|
||||
\entry {\code {enable}}{52}
|
||||
\entry {\code {eval}}{42}
|
||||
\entry {\code {exec}}{42}
|
||||
\entry {\code {exec}}{43}
|
||||
\entry {\code {exit}}{43}
|
||||
\entry {\code {export}}{43}
|
||||
\initial {F}
|
||||
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014/MacPorts 2014_7) (preloaded format=pdfetex 2014.11.4) 6 APR 2015 13:59
|
||||
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014/MacPorts 2014_8) (preloaded format=pdfetex 2014.11.4) 5 JUN 2015 14:39
|
||||
entering extended mode
|
||||
restricted \write18 enabled.
|
||||
file:line:error style messages enabled.
|
||||
@@ -242,7 +242,7 @@ arallel -k traceroute[]
|
||||
[16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30]
|
||||
[31] [32] [33] [34] [35] [36] [37] [38] [39] Chapter 4 [40] [41] [42] [43]
|
||||
[44] [45] [46] [47] [48] [49] [50] [51] [52] [53]
|
||||
Overfull \hbox (26.76846pt too wide) in paragraph at lines 4234--4234
|
||||
Overfull \hbox (26.76846pt too wide) in paragraph at lines 4240--4240
|
||||
[]@texttt mapfile [-d @textttsl de-lim@texttt ] [-n @textttsl count@texttt ] [
|
||||
-O @textttsl ori-gin@texttt ] [-s @textttsl count@texttt ] [-t] [-u @textttsl f
|
||||
d@texttt ][]
|
||||
@@ -256,7 +256,7 @@ d@texttt ][]
|
||||
.etc.
|
||||
|
||||
[54] [55]
|
||||
Overfull \hbox (38.26584pt too wide) in paragraph at lines 4436--4436
|
||||
Overfull \hbox (38.26584pt too wide) in paragraph at lines 4442--4442
|
||||
[]@texttt readarray [-d @textttsl de-lim@texttt ] [-n @textttsl count@texttt ]
|
||||
[-O @textttsl ori-gin@texttt ] [-s @textttsl count@texttt ] [-t] [-u @textttsl
|
||||
fd@texttt ][]
|
||||
@@ -271,7 +271,7 @@ Overfull \hbox (38.26584pt too wide) in paragraph at lines 4436--4436
|
||||
|
||||
[56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67] Chapter 5 [68]
|
||||
[69] [70] [71] [72] [73] [74] [75] [76] [77] [78] Chapter 6 [79]
|
||||
Overfull \hbox (49.43388pt too wide) in paragraph at lines 6081--6081
|
||||
Overfull \hbox (49.43388pt too wide) in paragraph at lines 6102--6102
|
||||
[]@texttt bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@t
|
||||
exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
|
||||
@@ -284,7 +284,7 @@ exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
.etc.
|
||||
|
||||
|
||||
Overfull \hbox (72.42863pt too wide) in paragraph at lines 6082--6082
|
||||
Overfull \hbox (72.42863pt too wide) in paragraph at lines 6103--6103
|
||||
[]@texttt bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@texttt
|
||||
] [-O @textttsl shopt_option@texttt ] -c @textttsl string @texttt [@textttsl ar
|
||||
-
|
||||
@@ -298,7 +298,7 @@ Overfull \hbox (72.42863pt too wide) in paragraph at lines 6082--6082
|
||||
.etc.
|
||||
|
||||
|
||||
Overfull \hbox (32.18782pt too wide) in paragraph at lines 6083--6083
|
||||
Overfull \hbox (32.18782pt too wide) in paragraph at lines 6104--6104
|
||||
[]@texttt bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@text
|
||||
tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar-
|
||||
|
||||
@@ -384,7 +384,7 @@ Appendix D [160] (./bashref.bts) [161] (./bashref.rws) (./bashref.vrs [162]
|
||||
Here is how much of TeX's memory you used:
|
||||
2745 strings out of 497110
|
||||
37296 string characters out of 6206872
|
||||
151204 words of memory out of 5000000
|
||||
151701 words of memory out of 5000000
|
||||
3523 multiletter control sequences out of 15000+600000
|
||||
32896 words of font info for 113 fonts, out of 8000000 for 9000
|
||||
51 hyphenation exceptions out of 8191
|
||||
@@ -405,10 +405,10 @@ i10.pfb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt10.p
|
||||
fb></opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt12.pfb></
|
||||
opt/local/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt9.pfb></opt/lo
|
||||
cal/share/texmf-texlive/fonts/type1/public/cm-super/sfrm1095.pfb>
|
||||
Output written on bashref.pdf (174 pages, 727272 bytes).
|
||||
Output written on bashref.pdf (174 pages, 728568 bytes).
|
||||
PDF statistics:
|
||||
2542 PDF objects out of 2984 (max. 8388607)
|
||||
2324 compressed objects within 24 object streams
|
||||
2546 PDF objects out of 2984 (max. 8388607)
|
||||
2328 compressed objects within 24 object streams
|
||||
300 named destinations out of 1000 (max. 500000)
|
||||
1125 words of extra memory for PDF output out of 10000 (max. 10000000)
|
||||
|
||||
|
||||
Binary file not shown.
+7
-2
@@ -4601,9 +4601,14 @@ When setting new limits, if neither @option{-H} nor @option{-S} is supplied,
|
||||
both the hard and soft limits are set.
|
||||
If no option is given, then @option{-f} is assumed. Values are in 1024-byte
|
||||
increments, except for @option{-t}, which is in seconds; @option{-p},
|
||||
which is in units of 512-byte blocks; and @option{-P}, @option{-T},
|
||||
which is in units of 512-byte blocks;
|
||||
@option{-P},
|
||||
@option{-T},
|
||||
@option{-b},
|
||||
@option{-k}, @option{-n} and @option{-u}, which are unscaled values.
|
||||
@option{-k},
|
||||
@option{-n} and @option{-u}, which are unscaled values;
|
||||
and, when in @sc{posix} Mode (@pxref{Bash POSIX Mode}),
|
||||
@option{-c} and @option{-f}, which are in 512-byte increments.
|
||||
|
||||
The return status is zero unless an invalid option or argument is supplied,
|
||||
or an error occurs while setting a new limit.
|
||||
|
||||
+7
-6
@@ -62,7 +62,8 @@
|
||||
\entry{EMACS}{73}{\code {EMACS}}
|
||||
\entry{ENV}{73}{\code {ENV}}
|
||||
\entry{EUID}{73}{\code {EUID}}
|
||||
\entry{FCEDIT}{73}{\code {FCEDIT}}
|
||||
\entry{EXECIGNORE}{73}{\code {EXECIGNORE}}
|
||||
\entry{FCEDIT}{74}{\code {FCEDIT}}
|
||||
\entry{FIGNORE}{74}{\code {FIGNORE}}
|
||||
\entry{FUNCNAME}{74}{\code {FUNCNAME}}
|
||||
\entry{FUNCNEST}{74}{\code {FUNCNEST}}
|
||||
@@ -70,13 +71,13 @@
|
||||
\entry{GROUPS}{74}{\code {GROUPS}}
|
||||
\entry{histchars}{74}{\code {histchars}}
|
||||
\entry{HISTCMD}{74}{\code {HISTCMD}}
|
||||
\entry{HISTCONTROL}{74}{\code {HISTCONTROL}}
|
||||
\entry{HISTCONTROL}{75}{\code {HISTCONTROL}}
|
||||
\entry{HISTFILE}{75}{\code {HISTFILE}}
|
||||
\entry{HISTFILESIZE}{75}{\code {HISTFILESIZE}}
|
||||
\entry{HISTIGNORE}{75}{\code {HISTIGNORE}}
|
||||
\entry{HISTSIZE}{75}{\code {HISTSIZE}}
|
||||
\entry{HISTTIMEFORMAT}{75}{\code {HISTTIMEFORMAT}}
|
||||
\entry{HOSTFILE}{75}{\code {HOSTFILE}}
|
||||
\entry{HOSTFILE}{76}{\code {HOSTFILE}}
|
||||
\entry{HOSTNAME}{76}{\code {HOSTNAME}}
|
||||
\entry{HOSTTYPE}{76}{\code {HOSTTYPE}}
|
||||
\entry{IGNOREEOF}{76}{\code {IGNOREEOF}}
|
||||
@@ -89,7 +90,7 @@
|
||||
\entry{LC_NUMERIC}{76}{\code {LC_NUMERIC}}
|
||||
\entry{LINENO}{76}{\code {LINENO}}
|
||||
\entry{LINES}{76}{\code {LINES}}
|
||||
\entry{MACHTYPE}{76}{\code {MACHTYPE}}
|
||||
\entry{MACHTYPE}{77}{\code {MACHTYPE}}
|
||||
\entry{MAILCHECK}{77}{\code {MAILCHECK}}
|
||||
\entry{MAPFILE}{77}{\code {MAPFILE}}
|
||||
\entry{OLDPWD}{77}{\code {OLDPWD}}
|
||||
@@ -102,8 +103,8 @@
|
||||
\entry{PROMPT_DIRTRIM}{77}{\code {PROMPT_DIRTRIM}}
|
||||
\entry{PS3}{77}{\code {PS3}}
|
||||
\entry{PS4}{77}{\code {PS4}}
|
||||
\entry{PWD}{77}{\code {PWD}}
|
||||
\entry{RANDOM}{77}{\code {RANDOM}}
|
||||
\entry{PWD}{78}{\code {PWD}}
|
||||
\entry{RANDOM}{78}{\code {RANDOM}}
|
||||
\entry{READLINE_LINE}{78}{\code {READLINE_LINE}}
|
||||
\entry{READLINE_POINT}{78}{\code {READLINE_POINT}}
|
||||
\entry{REPLY}{78}{\code {REPLY}}
|
||||
|
||||
+7
-6
@@ -83,9 +83,10 @@
|
||||
\entry {\code {enable-keypad}}{107}
|
||||
\entry {\code {ENV}}{73}
|
||||
\entry {\code {EUID}}{73}
|
||||
\entry {\code {EXECIGNORE}}{73}
|
||||
\entry {\code {expand-tilde}}{107}
|
||||
\initial {F}
|
||||
\entry {\code {FCEDIT}}{73}
|
||||
\entry {\code {FCEDIT}}{74}
|
||||
\entry {\code {FIGNORE}}{74}
|
||||
\entry {\code {FUNCNAME}}{74}
|
||||
\entry {\code {FUNCNEST}}{74}
|
||||
@@ -95,7 +96,7 @@
|
||||
\initial {H}
|
||||
\entry {\code {histchars}}{74}
|
||||
\entry {\code {HISTCMD}}{74}
|
||||
\entry {\code {HISTCONTROL}}{74}
|
||||
\entry {\code {HISTCONTROL}}{75}
|
||||
\entry {\code {HISTFILE}}{75}
|
||||
\entry {\code {HISTFILESIZE}}{75}
|
||||
\entry {\code {HISTIGNORE}}{75}
|
||||
@@ -105,7 +106,7 @@
|
||||
\entry {\code {HISTTIMEFORMAT}}{75}
|
||||
\entry {\code {HOME}}{69}
|
||||
\entry {\code {horizontal-scroll-mode}}{107}
|
||||
\entry {\code {HOSTFILE}}{75}
|
||||
\entry {\code {HOSTFILE}}{76}
|
||||
\entry {\code {HOSTNAME}}{76}
|
||||
\entry {\code {HOSTTYPE}}{76}
|
||||
\initial {I}
|
||||
@@ -126,7 +127,7 @@
|
||||
\entry {\code {LINENO}}{76}
|
||||
\entry {\code {LINES}}{76}
|
||||
\initial {M}
|
||||
\entry {\code {MACHTYPE}}{76}
|
||||
\entry {\code {MACHTYPE}}{77}
|
||||
\entry {\code {MAIL}}{69}
|
||||
\entry {\code {MAILCHECK}}{77}
|
||||
\entry {\code {MAILPATH}}{69}
|
||||
@@ -155,9 +156,9 @@
|
||||
\entry {\code {PS2}}{69}
|
||||
\entry {\code {PS3}}{77}
|
||||
\entry {\code {PS4}}{77}
|
||||
\entry {\code {PWD}}{77}
|
||||
\entry {\code {PWD}}{78}
|
||||
\initial {R}
|
||||
\entry {\code {RANDOM}}{77}
|
||||
\entry {\code {RANDOM}}{78}
|
||||
\entry {\code {READLINE_LINE}}{78}
|
||||
\entry {\code {READLINE_POINT}}{78}
|
||||
\entry {\code {REPLY}}{78}
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
Copyright (C) 1988-2015 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Wed May 27 14:56:01 EDT 2015
|
||||
@set LASTCHANGE Fri Jun 5 14:34:45 EDT 2015
|
||||
|
||||
@set EDITION 4.4
|
||||
@set VERSION 4.4
|
||||
|
||||
@set UPDATED 27 May 2015
|
||||
@set UPDATED-MONTH May 2015
|
||||
@set UPDATED 5 June 2015
|
||||
@set UPDATED-MONTH June 2015
|
||||
|
||||
@@ -31,7 +31,7 @@ datarootdir = @datarootdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
@SET_MAKE@
|
||||
CC = @CC@
|
||||
|
||||
@@ -32,7 +32,7 @@ datarootdir = @datarootdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
@SET_MAKE@
|
||||
CC = @CC@
|
||||
|
||||
+4
-3
@@ -5037,12 +5037,13 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
|
||||
int cmdflags;
|
||||
{
|
||||
char *pathname, *command, **args;
|
||||
int nofork, result;
|
||||
int nofork, stdpath, result;
|
||||
pid_t pid;
|
||||
SHELL_VAR *hookf;
|
||||
WORD_LIST *wl;
|
||||
|
||||
nofork = (cmdflags & CMD_NO_FORK); /* Don't fork, just exec, if no pipes */
|
||||
stdpath = (cmdflags & CMD_STDPATH); /* use command -p path */
|
||||
nofork = (cmdflags & CMD_NO_FORK); /* Don't fork, just exec, if no pipes */
|
||||
pathname = words->word->word;
|
||||
|
||||
result = EXECUTION_SUCCESS;
|
||||
@@ -5063,7 +5064,7 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
|
||||
}
|
||||
#endif /* RESTRICTED_SHELL */
|
||||
|
||||
command = search_for_command (pathname, 1);
|
||||
command = search_for_command (pathname, CMDSRCH_HASH|(stdpath ? CMDSRCH_STDPATH : 0));
|
||||
|
||||
if (command)
|
||||
{
|
||||
|
||||
@@ -329,15 +329,17 @@ get_next_path_element (path_list, path_index_pointer)
|
||||
|
||||
/* Look for PATHNAME in $PATH. Returns either the hashed command
|
||||
corresponding to PATHNAME or the first instance of PATHNAME found
|
||||
in $PATH. If (FLAGS&1) is non-zero, insert the instance of PATHNAME
|
||||
found in $PATH into the command hash table. Returns a newly-allocated
|
||||
string. */
|
||||
in $PATH. If (FLAGS&CMDSRCH_HASH) is non-zero, insert the instance of
|
||||
PATHNAME found in $PATH into the command hash table. If (FLAGS&CMDSRCH_STDPATH)
|
||||
is non-zero, we are running in a `command -p' environment and should use
|
||||
the Posix standard path.
|
||||
Returns a newly-allocated string. */
|
||||
char *
|
||||
search_for_command (pathname, flags)
|
||||
const char *pathname;
|
||||
int flags;
|
||||
{
|
||||
char *hashed_file, *command;
|
||||
char *hashed_file, *command, *pathlist;
|
||||
int temp_path, st;
|
||||
SHELL_VAR *path;
|
||||
|
||||
@@ -347,13 +349,11 @@ search_for_command (pathname, flags)
|
||||
hash table to search for the full pathname. */
|
||||
path = find_variable_tempenv ("PATH");
|
||||
temp_path = path && tempvar_p (path);
|
||||
if (temp_path == 0 && path)
|
||||
path = (SHELL_VAR *)NULL;
|
||||
|
||||
/* Don't waste time trying to find hashed data for a pathname
|
||||
that is already completely specified or if we're using a command-
|
||||
specific value for PATH. */
|
||||
if (path == 0 && absolute_program (pathname) == 0)
|
||||
if (temp_path == 0 && absolute_program (pathname) == 0)
|
||||
hashed_file = phash_search (pathname);
|
||||
|
||||
/* If a command found in the hash table no longer exists, we need to
|
||||
@@ -379,18 +379,34 @@ search_for_command (pathname, flags)
|
||||
command = savestring (pathname);
|
||||
else
|
||||
{
|
||||
/* If $PATH is in the temporary environment, we've already retrieved
|
||||
it, so don't bother trying again. */
|
||||
if (temp_path)
|
||||
{
|
||||
command = find_user_command_in_path (pathname, value_cell (path),
|
||||
FS_EXEC_PREFERRED|FS_NODIRS);
|
||||
}
|
||||
if (flags & CMDSRCH_STDPATH)
|
||||
pathlist = conf_standard_path ();
|
||||
else if (temp_path || path)
|
||||
pathlist = value_cell (path);
|
||||
else
|
||||
command = find_user_command (pathname);
|
||||
if (command && hashing_enabled && temp_path == 0 && (flags & 1))
|
||||
phash_insert ((char *)pathname, command, dot_found_in_search, 1); /* XXX fix const later */
|
||||
pathlist = 0;
|
||||
|
||||
command = find_user_command_in_path (pathname, pathlist, FS_EXEC_PREFERRED|FS_NODIRS);
|
||||
|
||||
if (command && hashing_enabled && temp_path == 0 && (flags & CMDSRCH_HASH))
|
||||
{
|
||||
/* If we found the full pathname the same as the command name, the
|
||||
command probably doesn't exist. Don't put it into the hash
|
||||
table. */
|
||||
if (STREQ (command, pathname))
|
||||
{
|
||||
st = file_status (command);
|
||||
if (st & FS_EXECABLE)
|
||||
phash_insert ((char *)pathname, command, dot_found_in_search, 1);
|
||||
}
|
||||
else
|
||||
phash_insert ((char *)pathname, command, dot_found_in_search, 1);
|
||||
}
|
||||
|
||||
if (flags & CMDSRCH_STDPATH)
|
||||
free (pathlist);
|
||||
}
|
||||
|
||||
return (command);
|
||||
}
|
||||
|
||||
@@ -653,3 +669,14 @@ find_user_command_in_path (name, path_list, flags)
|
||||
|
||||
return (file_to_lose_on);
|
||||
}
|
||||
|
||||
/* External interface to find a command given a $PATH. Separate from
|
||||
find_user_command_in_path to allow future customization. */
|
||||
char *
|
||||
find_in_path (name, path_list, flags)
|
||||
const char *name;
|
||||
char *path_list;
|
||||
int flags;
|
||||
{
|
||||
return (find_user_command_in_path (name, path_list, flags));
|
||||
}
|
||||
|
||||
@@ -23,11 +23,17 @@
|
||||
|
||||
#include "stdc.h"
|
||||
|
||||
/* Flags for search_for_command */
|
||||
#define CMDSRCH_HASH 0x01
|
||||
#define CMDSRCH_STDPATH 0x02
|
||||
#define CMDSRCH_TEMPENV 0x04
|
||||
|
||||
extern int file_status __P((const char *));
|
||||
extern int executable_file __P((const char *));
|
||||
extern int is_directory __P((const char *));
|
||||
extern int executable_or_directory __P((const char *));
|
||||
extern char *find_user_command __P((const char *));
|
||||
extern char *find_in_path __P((const char *, char *, int));
|
||||
extern char *find_path_file __P((const char *));
|
||||
extern char *search_for_command __P((const char *, int));
|
||||
extern char *user_command_matches __P((const char *, int, int));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* general.c -- Stuff that is used by all files. */
|
||||
|
||||
/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -1229,3 +1229,38 @@ get_group_array (ngp)
|
||||
*ngp = ngroups;
|
||||
return group_iarray;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Miscellaneous functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Return a value for PATH that is guaranteed to find all of the standard
|
||||
utilities. This uses Posix.2 configuration variables, if present. It
|
||||
uses a value defined in config.h as a last resort. */
|
||||
char *
|
||||
conf_standard_path ()
|
||||
{
|
||||
#if defined (_CS_PATH) && defined (HAVE_CONFSTR)
|
||||
char *p;
|
||||
size_t len;
|
||||
|
||||
len = (size_t)confstr (_CS_PATH, (char *)NULL, (size_t)0);
|
||||
if (len > 0)
|
||||
{
|
||||
p = (char *)xmalloc (len + 2);
|
||||
*p = '\0';
|
||||
confstr (_CS_PATH, p, len);
|
||||
return (p);
|
||||
}
|
||||
else
|
||||
return (savestring (STANDARD_UTILS_PATH));
|
||||
#else /* !_CS_PATH || !HAVE_CONFSTR */
|
||||
# if defined (CS_PATH)
|
||||
return (savestring (CS_PATH));
|
||||
# else
|
||||
return (savestring (STANDARD_UTILS_PATH));
|
||||
# endif /* !CS_PATH */
|
||||
#endif /* !_CS_PATH || !HAVE_CONFSTR */
|
||||
}
|
||||
|
||||
@@ -327,4 +327,6 @@ extern int group_member __P((gid_t));
|
||||
extern char **get_group_list __P((int *));
|
||||
extern int *get_group_array __P((int *));
|
||||
|
||||
extern char *conf_standard_path __P((void));
|
||||
|
||||
#endif /* _GENERAL_H_ */
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
topdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
CC = @CC@
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
|
||||
+82
-65
@@ -125,6 +125,7 @@ int history_lines_written_to_file = 0;
|
||||
#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char && isdigit ((unsigned char)(s)[1]) )
|
||||
|
||||
static char *history_backupfile PARAMS((const char *));
|
||||
static char *history_tempfile PARAMS((const char *));
|
||||
static int histfile_backup PARAMS((const char *, const char *));
|
||||
static int histfile_restore PARAMS((const char *, const char *));
|
||||
|
||||
@@ -196,6 +197,46 @@ history_backupfile (filename)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *
|
||||
history_tempfile (filename)
|
||||
const char *filename;
|
||||
{
|
||||
const char *fn;
|
||||
char *ret, linkbuf[PATH_MAX+1];
|
||||
size_t len;
|
||||
ssize_t n;
|
||||
struct stat fs;
|
||||
int pid;
|
||||
|
||||
fn = filename;
|
||||
#if defined (HAVE_READLINK)
|
||||
/* Follow symlink so tempfile created in the same directory as any symlinked
|
||||
history file; call will fail if not a symlink */
|
||||
if ((n = readlink (filename, linkbuf, sizeof (linkbuf) - 1)) > 0)
|
||||
{
|
||||
linkbuf[n] = '\0';
|
||||
fn = linkbuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
len = strlen (fn);
|
||||
ret = xmalloc (len + 11);
|
||||
strcpy (ret, fn);
|
||||
|
||||
pid = (int)getpid ();
|
||||
|
||||
/* filename-PID.tmp */
|
||||
ret[len] = '-';
|
||||
ret[len+1] = (pid / 10000 % 10) + '0';
|
||||
ret[len+2] = (pid / 1000 % 10) + '0';
|
||||
ret[len+3] = (pid / 100 % 10) + '0';
|
||||
ret[len+4] = (pid / 10 % 10) + '0';
|
||||
ret[len+5] = (pid % 10) + '0';
|
||||
strcpy (ret + len + 6, ".tmp");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Add the contents of FILENAME to the history list, a line at a time.
|
||||
If FILENAME is NULL, then read from ~/.history. Returns 0 if
|
||||
successful, or errno if not. */
|
||||
@@ -355,6 +396,8 @@ read_history_range (filename, from, to)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Save FILENAME to BACK, handling case where FILENAME is a symlink
|
||||
(e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
|
||||
static int
|
||||
histfile_backup (filename, back)
|
||||
const char *filename;
|
||||
@@ -374,6 +417,8 @@ histfile_backup (filename, back)
|
||||
return (rename (filename, back));
|
||||
}
|
||||
|
||||
/* Restore ORIG from BACKUP handling case where ORIG is a symlink
|
||||
(e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
|
||||
static int
|
||||
histfile_restore (backup, orig)
|
||||
const char *backup;
|
||||
@@ -394,14 +439,14 @@ histfile_restore (backup, orig)
|
||||
}
|
||||
|
||||
/* Truncate the history file FNAME, leaving only LINES trailing lines.
|
||||
If FNAME is NULL, then use ~/.history. Returns 0 on success, errno
|
||||
on failure. */
|
||||
If FNAME is NULL, then use ~/.history. Writes a new file and renames
|
||||
it to the original name. Returns 0 on success, errno on failure. */
|
||||
int
|
||||
history_truncate_file (fname, lines)
|
||||
const char *fname;
|
||||
int lines;
|
||||
{
|
||||
char *buffer, *filename, *bakname, *bp, *bp1; /* bp1 == bp+1 */
|
||||
char *buffer, *filename, *tempname, *bp, *bp1; /* bp1 == bp+1 */
|
||||
int file, chars_read, rv, orig_lines, exists;
|
||||
struct stat finfo;
|
||||
size_t file_size;
|
||||
@@ -410,7 +455,7 @@ history_truncate_file (fname, lines)
|
||||
|
||||
buffer = (char *)NULL;
|
||||
filename = history_filename (fname);
|
||||
bakname = 0;
|
||||
tempname = 0;
|
||||
file = filename ? open (filename, O_RDONLY|O_BINARY, 0666) : -1;
|
||||
rv = exists = 0;
|
||||
|
||||
@@ -505,27 +550,13 @@ history_truncate_file (fname, lines)
|
||||
goto truncate_exit;
|
||||
}
|
||||
|
||||
bakname = history_backupfile (filename);
|
||||
if (filename && bakname)
|
||||
{
|
||||
/* XXX - need to check case where filename is a symlink */
|
||||
if (histfile_backup (filename, bakname) < 0)
|
||||
{
|
||||
free (bakname); /* no backups if rename fails */
|
||||
bakname = 0;
|
||||
}
|
||||
}
|
||||
tempname = history_tempfile (filename);
|
||||
|
||||
if ((file = open (filename, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0600)) != -1)
|
||||
if ((file = open (tempname, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0600)) != -1)
|
||||
{
|
||||
if (write (file, bp, chars_read - (bp - buffer)) < 0)
|
||||
rv = errno;
|
||||
|
||||
#if defined (__BEOS__)
|
||||
/* BeOS ignores O_TRUNC. */
|
||||
ftruncate (file, chars_read - (bp - buffer));
|
||||
#endif
|
||||
|
||||
if (close (file) < 0 && rv == 0)
|
||||
rv = errno;
|
||||
}
|
||||
@@ -537,13 +568,15 @@ history_truncate_file (fname, lines)
|
||||
|
||||
history_lines_written_to_file = orig_lines - lines;
|
||||
|
||||
if (rv != 0 && filename && bakname)
|
||||
if (rv == 0 && filename && tempname)
|
||||
rv = histfile_restore (tempname, filename);
|
||||
|
||||
if (rv != 0)
|
||||
{
|
||||
histfile_restore (bakname, filename);
|
||||
if (tempname)
|
||||
unlink (tempname);
|
||||
history_lines_written_to_file = 0;
|
||||
}
|
||||
else if (rv == 0 && bakname)
|
||||
unlink (bakname);
|
||||
|
||||
/* Make sure the new filename is owned by the same user as the old. If one
|
||||
user is running this, it's a no-op. If the shell is running after sudo
|
||||
@@ -553,7 +586,7 @@ history_truncate_file (fname, lines)
|
||||
chown (filename, finfo.st_uid, finfo.st_gid);
|
||||
|
||||
xfree (filename);
|
||||
FREE (bakname);
|
||||
FREE (tempname);
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -567,7 +600,7 @@ history_do_write (filename, nelements, overwrite)
|
||||
int nelements, overwrite;
|
||||
{
|
||||
register int i;
|
||||
char *output, *bakname;
|
||||
char *output, *tempname, *histname;
|
||||
int file, mode, rv, exists;
|
||||
struct stat finfo;
|
||||
#ifdef HISTORY_USE_MMAP
|
||||
@@ -579,26 +612,10 @@ history_do_write (filename, nelements, overwrite)
|
||||
#else
|
||||
mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
|
||||
#endif
|
||||
output = history_filename (filename);
|
||||
bakname = (overwrite && output) ? history_backupfile (output) : 0;
|
||||
exists = output ? (stat (output, &finfo) == 0) : 0;
|
||||
|
||||
/* Don't bother backing up if output doesn't exist yet */
|
||||
if (exists == 0 || S_ISREG (finfo.st_mode) == 0)
|
||||
{
|
||||
free (bakname); /* no backups if not a regular file */
|
||||
bakname = 0;
|
||||
}
|
||||
|
||||
if (output && bakname)
|
||||
{
|
||||
/* XXX - need to check case where output is a symlink */
|
||||
if (histfile_backup (output, bakname) < 0) /* no backups if rename fails */
|
||||
{
|
||||
free (bakname);
|
||||
bakname = 0;
|
||||
}
|
||||
}
|
||||
histname = history_filename (filename);
|
||||
tempname = (overwrite && histname) ? history_tempfile (histname) : 0;
|
||||
output = tempname ? tempname : histname;
|
||||
exists = histname ? (stat (histname, &finfo) == 0) : 0;
|
||||
|
||||
file = output ? open (output, mode, 0600) : -1;
|
||||
rv = 0;
|
||||
@@ -606,10 +623,8 @@ history_do_write (filename, nelements, overwrite)
|
||||
if (file == -1)
|
||||
{
|
||||
rv = errno;
|
||||
if (output && bakname)
|
||||
histfile_restore (bakname, output);
|
||||
FREE (output);
|
||||
FREE (bakname);
|
||||
FREE (histname);
|
||||
FREE (tempname);
|
||||
return (rv);
|
||||
}
|
||||
|
||||
@@ -651,10 +666,10 @@ history_do_write (filename, nelements, overwrite)
|
||||
mmap_error:
|
||||
rv = errno;
|
||||
close (file);
|
||||
if (output && bakname)
|
||||
histfile_restore (bakname, output);
|
||||
FREE (output);
|
||||
FREE (bakname);
|
||||
if (tempname)
|
||||
unlink (tempname);
|
||||
FREE (histname);
|
||||
FREE (tempname);
|
||||
return rv;
|
||||
}
|
||||
#else
|
||||
@@ -663,10 +678,10 @@ mmap_error:
|
||||
{
|
||||
rv = errno;
|
||||
close (file);
|
||||
if (output && bakname)
|
||||
histfile_restore (bakname, output);
|
||||
FREE (output);
|
||||
FREE (bakname);
|
||||
if (tempname)
|
||||
unlink (tempname);
|
||||
FREE (histname);
|
||||
FREE (tempname);
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
@@ -699,23 +714,25 @@ mmap_error:
|
||||
if (close (file) < 0 && rv == 0)
|
||||
rv = errno;
|
||||
|
||||
if (rv != 0 && output && bakname)
|
||||
if (rv == 0 && histname && tempname)
|
||||
rv = histfile_restore (tempname, histname);
|
||||
|
||||
if (rv != 0)
|
||||
{
|
||||
histfile_restore (bakname, output);
|
||||
if (tempname)
|
||||
unlink (tempname);
|
||||
history_lines_written_to_file = 0;
|
||||
}
|
||||
else if (rv == 0 && bakname)
|
||||
unlink (bakname);
|
||||
|
||||
/* Make sure the new filename is owned by the same user as the old. If one
|
||||
user is running this, it's a no-op. If the shell is running after sudo
|
||||
with a shared history file, we don't want to leave the history file
|
||||
owned by root. */
|
||||
if (rv == 0 && exists)
|
||||
chown (output, finfo.st_uid, finfo.st_gid);
|
||||
chown (histname, finfo.st_uid, finfo.st_gid);
|
||||
|
||||
FREE (output);
|
||||
FREE (bakname);
|
||||
FREE (histname);
|
||||
FREE (tempname);
|
||||
|
||||
return (rv);
|
||||
}
|
||||
|
||||
+23
-1
@@ -26,7 +26,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
@@ -501,10 +501,26 @@ times.o: ${BASHINCDIR}/posixtime.h
|
||||
timeval.o: ${BASHINCDIR}/posixtime.h
|
||||
|
||||
tmpfile.o: ${topdir}/bashtypes.h
|
||||
tmpfile.o: ${BASHINCDIR}/chartypes.h
|
||||
tmpfile.o: ${BASHINCDIR}/posixstat.h
|
||||
tmpfile.o: ${BASHINCDIR}/filecntl.h
|
||||
tmpfile.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
tmpfile.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
tmpfile.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
tmpfile.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
tmpfile.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
tmpfile.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
tmpfile.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
|
||||
uconvert.o: ${topdir}/bashtypes.h
|
||||
uconvert.o: ${BASHINCDIR}/chartypes.h
|
||||
uconvert.o: ${topdir}/shell.h ${topdir}/syntax.h ${topdir}/bashjmp.h ${BASHINCDIR}/posixjmp.h
|
||||
uconvert.o: ${topdir}/command.h ${BASHINCDIR}/stdc.h ${topdir}/error.h
|
||||
uconvert.o: ${topdir}/general.h ${topdir}/bashtypes.h ${topdir}/variables.h ${topdir}/conftypes.h
|
||||
uconvert.o: ${topdir}/array.h ${topdir}/hashlib.h ${topdir}/quit.h
|
||||
uconvert.o: ${topdir}/unwind_prot.h ${topdir}/dispose_cmd.h
|
||||
uconvert.o: ${topdir}/make_cmd.h ${topdir}/subst.h ${topdir}/sig.h
|
||||
uconvert.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
|
||||
|
||||
ufuncs.o: ${topdir}/bashtypes.h
|
||||
|
||||
@@ -595,3 +611,9 @@ unicode.o: ${topdir}/xmalloc.h
|
||||
winsize.o: ${BASHINCDIR}/stdc.h
|
||||
winsize.o: ${topdir}/xmalloc.h
|
||||
winsize.o: ${topdir}/bashtypes.h
|
||||
|
||||
zmapfd.o: ${topdir}/bashansi.h ${BASHINCDIR}/ansi_stdlib.h
|
||||
zmapfd.o: ${BASHINCDIR}/stdc.h
|
||||
zmapfd.o: ${topdir}/command.h
|
||||
zmapfd.o: ${topdir}/general.h
|
||||
zmapfd.o: ${topdir}/bashtypes.h ${BASHINCDIR}/chartypes.h ${topdir}/xmalloc.h
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
|
||||
@@ -3535,7 +3535,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
APPEND_NESTRET ();
|
||||
FREE (nestret);
|
||||
}
|
||||
else if ((flags & P_ARRAYSUB) && (tflags & LEX_WASDOL) && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
|
||||
else if ((flags & (P_ARRAYSUB|P_DOLBRACE)) && (tflags & LEX_WASDOL) && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
|
||||
goto parse_dollar_word;
|
||||
}
|
||||
/* Parse an old-style command substitution within double quotes as a
|
||||
|
||||
+1
-1
@@ -1194,7 +1194,7 @@ gen_shell_function_matches (cs, cmd, text, line, ind, lwords, nw, cw, foundp)
|
||||
$1 == command name (command being completed)
|
||||
$2 == word to be completed (possibly null)
|
||||
$3 == previous word
|
||||
and run in with command substitution. Parse the results, one word
|
||||
and run it with command substitution. Parse the results, one word
|
||||
per line, with backslashes allowed to escape newlines. Build a
|
||||
STRINGLIST from the results and return it. */
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
# Set of available languages.
|
||||
en@quot en@boldquot af bg ca cs da de el eo es et fi fr ga gl hr hu id it ja lt nl pl pt_BR ro ru sk sl sr sv tr uk vi zh_CN zh_TW
|
||||
en@quot en@boldquot af bg ca cs da de el eo es et fi fr ga gl hr hu id it ja lt nb nl pl pt_BR ro ru sk sl sr sv tr uk vi zh_CN zh_TW
|
||||
|
||||
+4041
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -28,7 +28,7 @@
|
||||
#
|
||||
topdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
VPATH = @srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
RM = rm -f
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -41,5 +41,8 @@ bar'`
|
||||
echo $(recho 'foo\
|
||||
bar')
|
||||
|
||||
# long-standing parse error in all versions up through bash-4.3
|
||||
echo ${foo:-$(echo a{b,c})} >/dev/null
|
||||
|
||||
${THIS_SH} ./comsub1.sub
|
||||
${THIS_SH} ./comsub2.sub
|
||||
|
||||
@@ -60,4 +60,11 @@ expand_aliases on
|
||||
0
|
||||
0
|
||||
0
|
||||
/usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
|
||||
cannot find cat in $TMPDIR
|
||||
cannot find cat with empty $PATH
|
||||
PATH = /usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
|
||||
cannot find cat in $TMPDIR with hash
|
||||
cannot find cat with empty $PATH with hash
|
||||
PATH = /usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
|
||||
after
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# post bash-4.3 changes to how command -p works (avoid modifying $PATH)
|
||||
|
||||
: ${TMPDIR=/tmp}
|
||||
xpath=/usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
|
||||
|
||||
# set a value of PATH we can test for; versions of bash up to and including
|
||||
# bash-4.3 would set $PATH while running command -p
|
||||
PATH=$xpath
|
||||
export PATH
|
||||
command -p sh -c 'echo $PATH'
|
||||
|
||||
PATH=${TMPDIR}
|
||||
command -pv cat >/dev/null || echo "cannot find cat using standard path"
|
||||
command -p cat < /dev/null
|
||||
#hash
|
||||
|
||||
PATH=$xpath
|
||||
command -pv cat >/dev/null || echo "cannot find cat using xpath"
|
||||
PATH=$TMPDIR command -pv cat >/dev/null || echo "cannot find cat using standard path with PATH=\$TMPDIR"
|
||||
PATH= command -pv cat >/dev/null || echo "cannot find cat using standard path with empty \$PATH"
|
||||
PATH=$TMPDIR command -v cat >/dev/null || echo "cannot find cat in \$TMPDIR"
|
||||
PATH= command -v cat >/dev/null || echo "cannot find cat with empty \$PATH"
|
||||
|
||||
echo PATH = $PATH
|
||||
hash cat
|
||||
|
||||
PATH=$xpath
|
||||
|
||||
PATH=$TMPDIR command -pv cat >/dev/null || echo "cannot find cat using stdpath with hash"
|
||||
PATH= command -pv cat >/dev/null || echo "cannot find cat using stdpath with hash"
|
||||
PATH=$TMPDIR command -v cat >/dev/null || echo "cannot find cat in \$TMPDIR with hash"
|
||||
PATH= command -v cat >/dev/null || echo "cannot find cat with empty \$PATH with hash"
|
||||
|
||||
echo PATH = $PATH
|
||||
@@ -112,6 +112,8 @@ ${THIS_SH} -i ./exec8.sub
|
||||
|
||||
${THIS_SH} ./exec9.sub
|
||||
|
||||
${THIS_SH} ./exec10.sub
|
||||
|
||||
true | `echo true` &
|
||||
|
||||
echo after
|
||||
|
||||
@@ -79,6 +79,9 @@ declare -rx tempvar2='qux'
|
||||
./varenv7.sub: line 44: local: var: readonly variable
|
||||
inside: outside
|
||||
outside: outside
|
||||
local: unset1 unset2
|
||||
abc
|
||||
abc
|
||||
a=z
|
||||
a=b
|
||||
a=z
|
||||
|
||||
@@ -48,3 +48,15 @@ func()
|
||||
func
|
||||
echo outside: $var
|
||||
|
||||
unset -f f
|
||||
unset VAR1 VAR2
|
||||
export VAR1=abc VAR2=abc
|
||||
|
||||
f()
|
||||
{
|
||||
local VAR1; local VAR2
|
||||
echo local: ${VAR1-unset1} ${VAR2-unset2}
|
||||
printenv VAR1 ; printenv VAR2
|
||||
}
|
||||
|
||||
f
|
||||
|
||||
Reference in New Issue
Block a user