mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-07 18:52:35 +02:00
commit bash-20101015 snapshot
This commit is contained in:
@@ -283,6 +283,7 @@ cd_builtin (list)
|
||||
free (temp);
|
||||
}
|
||||
|
||||
#if 0 /* changed for bash-4.2 Posix cd description steps 5-6 */
|
||||
/* POSIX.2 says that if `.' does not appear in $CDPATH, we don't
|
||||
try the current directory, so we just punt now with an error
|
||||
message if POSIXLY_CORRECT is non-zero. The check for cdpath[0]
|
||||
@@ -293,6 +294,7 @@ cd_builtin (list)
|
||||
builtin_error ("%s: %s", dirname, strerror (ENOENT));
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
dirname = list->word->word;
|
||||
|
||||
+14
-1
@@ -67,6 +67,8 @@ int cdspelling = 0;
|
||||
|
||||
int cdable_vars;
|
||||
|
||||
static int eflag; /* file scope so bindpwd() can see it */
|
||||
|
||||
$BUILTIN cd
|
||||
$FUNCTION cd_builtin
|
||||
$SHORT_DOC cd [-L|[-P [-e]]] [dir]
|
||||
@@ -141,6 +143,8 @@ bindpwd (no_symlinks)
|
||||
}
|
||||
|
||||
setpwd (dirname);
|
||||
if (dirname == 0 && eflag)
|
||||
r = EXECUTION_FAILURE;
|
||||
|
||||
if (dirname && dirname != the_current_working_directory)
|
||||
free (dirname);
|
||||
@@ -176,7 +180,7 @@ cd_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
char *dirname, *cdpath, *path, *temp;
|
||||
int path_index, no_symlinks, opt, lflag, eflag;
|
||||
int path_index, no_symlinks, opt, lflag;
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
if (restricted)
|
||||
@@ -211,6 +215,8 @@ cd_builtin (list)
|
||||
|
||||
lflag = (cdable_vars ? LCD_DOVARS : 0) |
|
||||
((interactive && cdspelling) ? LCD_DOSPELL : 0);
|
||||
if (eflag && no_symlinks == 0)
|
||||
eflag = 0;
|
||||
|
||||
if (list == 0)
|
||||
{
|
||||
@@ -284,8 +290,15 @@ cd_builtin (list)
|
||||
specifying the current directory. */
|
||||
if (posixly_correct && cdpath[0])
|
||||
{
|
||||
#if 0
|
||||
builtin_error ("%s: %s", dirname, strerror (ENOENT));
|
||||
return (EXECUTION_FAILURE);
|
||||
#else /* changed for bash-4.2 Posix cd description steps 5-6 */
|
||||
if (no_symlinks)
|
||||
dirname = list->word->word;
|
||||
else
|
||||
dirname =
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* evalstring.c - evaluate a string as one or more shell commands.
|
||||
|
||||
/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -263,6 +263,7 @@ parse_and_execute (string, from_file, flags)
|
||||
|
||||
bitmap = new_fd_bitmap (FD_BITMAP_SIZE);
|
||||
begin_unwind_frame ("pe_dispose");
|
||||
itrace("begin_unwind_frame: pe_dispose");
|
||||
add_unwind_protect (dispose_fd_bitmap, bitmap);
|
||||
add_unwind_protect (dispose_command, command); /* XXX */
|
||||
|
||||
|
||||
+4
-2
@@ -212,7 +212,7 @@ exec_builtin (list)
|
||||
end_job_control ();
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
shell_execve (command, args, env);
|
||||
exit_value = shell_execve (command, args, env);
|
||||
|
||||
/* We have to set this to NULL because shell_execve has called realloc()
|
||||
to stuff more items at the front of the array, which may have caused
|
||||
@@ -221,7 +221,9 @@ exec_builtin (list)
|
||||
if (cleanenv == 0)
|
||||
adjust_shell_level (1);
|
||||
|
||||
if (executable_file (command) == 0)
|
||||
if (exit_value == EX_NOTFOUND) /* no duplicate error message */
|
||||
goto failed_exec;
|
||||
else if (executable_file (command) == 0)
|
||||
{
|
||||
builtin_error (_("%s: cannot execute: %s"), command, strerror (errno));
|
||||
exit_value = EX_NOEXEC; /* As per Posix.2, 3.14.6 */
|
||||
|
||||
+8
-2
@@ -150,7 +150,11 @@ exec_builtin (list)
|
||||
{
|
||||
if (file_isdir (args[0]))
|
||||
{
|
||||
#if defined (EISDIR)
|
||||
builtin_error (_("%s: cannot execute: %s"), args[0], strerror (EISDIR));
|
||||
#else
|
||||
builtin_error (_("%s: cannot execute: %s"), args[0], strerror (errno));
|
||||
#endif
|
||||
exit_value = EX_NOEXEC;
|
||||
}
|
||||
else
|
||||
@@ -208,7 +212,7 @@ exec_builtin (list)
|
||||
end_job_control ();
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
shell_execve (command, args, env);
|
||||
exit_value = shell_execve (command, args, env);
|
||||
|
||||
/* We have to set this to NULL because shell_execve has called realloc()
|
||||
to stuff more items at the front of the array, which may have caused
|
||||
@@ -217,7 +221,9 @@ exec_builtin (list)
|
||||
if (cleanenv == 0)
|
||||
adjust_shell_level (1);
|
||||
|
||||
if (executable_file (command) == 0)
|
||||
if (exit_value == EX_NOTFOUND)
|
||||
goto failed_exec;
|
||||
else if (executable_file (command) == 0)
|
||||
{
|
||||
builtin_error (_("%s: cannot execute: %s"), command, strerror (errno));
|
||||
exit_value = EX_NOEXEC; /* As per Posix.2, 3.14.6 */
|
||||
|
||||
+5
-1
@@ -35,7 +35,11 @@ value. If ARG is the null string each SIGNAL_SPEC is ignored by the
|
||||
shell and by the commands it invokes.
|
||||
|
||||
If a SIGNAL_SPEC is EXIT (0) ARG is executed on exit from the shell. If
|
||||
a SIGNAL_SPEC is DEBUG, ARG is executed before every simple command.
|
||||
a SIGNAL_SPEC is DEBUG, ARG is executed before every simple command. If
|
||||
a SIGNAL_SPEC is RETURN, ARG is executed each time a shell function or a
|
||||
script run by the . or source builtins finishes executing. A SIGNAL_SPEC
|
||||
of ERR means to execute ARG each time a command's failure would cause the
|
||||
shell to exit when the -e option is enabled.
|
||||
|
||||
If no arguments are supplied, trap prints the list of commands associated
|
||||
with each signal.
|
||||
|
||||
+4
-2
@@ -1,7 +1,7 @@
|
||||
This file is trap.def, from which is created trap.c.
|
||||
It implements the builtin "trap" in Bash.
|
||||
|
||||
Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -35,7 +35,9 @@ value. If ARG is the null string each SIGNAL_SPEC is ignored by the
|
||||
shell and by the commands it invokes.
|
||||
|
||||
If a SIGNAL_SPEC is EXIT (0) ARG is executed on exit from the shell. If
|
||||
a SIGNAL_SPEC is DEBUG, ARG is executed before every simple command.
|
||||
a SIGNAL_SPEC is DEBUG, ARG is executed before every simple command. If
|
||||
a SIGNAL_SPEC is RETURN, ARG is executed each time a shell function or a
|
||||
script run by the . or source builtins finishes executing.
|
||||
|
||||
If no arguments are supplied, trap prints the list of commands associated
|
||||
with each signal.
|
||||
|
||||
Reference in New Issue
Block a user