From 4dd820b40a025dfe0d1a6116d8557fdda8ab68fc Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Wed, 30 Mar 2016 10:55:33 -0400 Subject: [PATCH] commit bash-20160318 snapshot --- CWRU/CWRU.chlog | 11 +++++++++++ doc/bash.1 | 7 +++++-- doc/bashref.texi | 9 ++++++--- findcmd.c | 4 ++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index aa84e848..790b62eb 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -10565,3 +10565,14 @@ lib/readline/readline.h lib/readline/doc/rltech.texi - rl_clear_visible_line: add documentation + + 3/19 + ---- +findcmd.c + - file_status: add inadvertently-dropped test for EXECIGNORE to the + `other' bits check. The check was in the original patch + - search_for_command: if the file should not be considered executable + because it's in the EXECIGNORE blacklist, don't set file_to_lose_on, + since the attempt to execute the last-ditch path will circumvent the + EXECIGNORE setting. Fixes bug reported by Dennis Williamson + diff --git a/doc/bash.1 b/doc/bash.1 index 66bb4798..8dfc18e3 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -2014,11 +2014,14 @@ used when the shell is invoked in POSIX mode. .TP .B EXECIGNORE A colon-separated list of shell patterns (see \fBPattern Matching\fP) -defining the list of filenames to be ignored by command search. +defining the list of filenames to be ignored by command search using +\fBPATH\fP. Files whose full pathnames match one of these patterns are not considered -executable files for the purposes of completion and command execution. +executable files for the purposes of completion and command execution +via \fBPATH\fP lookup. This does not affect the behavior of the \fB[\fP, \fBtest\fP, and \fB[[\fP commands. +Full pathnames in the command hash table are not subject to \fBEXECIGNORE\fP. Use this variable to ignore shared library files that have the executable bit set, but are not executable files. The pattern matching honors the setting of the \fBextglob\fP shell diff --git a/doc/bashref.texi b/doc/bashref.texi index 98f1d32f..6b029940 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -3801,7 +3801,7 @@ unset [-fnv] [@var{name}] Remove each variable or function @var{name}. If the @option{-v} option is given, each -@var{name} refers to a shell variable and that variable is remvoved. +@var{name} refers to a shell variable and that variable is removed. If the @option{-f} option is given, the @var{name}s refer to shell functions, and the function definition is removed. If the @option{-n} option is supplied, and @var{name} is a variable with @@ -5723,11 +5723,14 @@ is readonly. @item EXECIGNORE A colon-separated list of shell patterns (@pxref{Pattern Matching}) -defining the list of filenames to be ignored by command search. +defining the list of filenames to be ignored by command search using +@code{PATH}. Files whose full pathnames match one of these patterns are not considered -executable files for the purposes of completion and command execution. +executable files for the purposes of completion and command execution +via @code{PATH} lookup. This does not affect the behavior of the @code{[}, @code{test}, and @code{[[} commands. +Full pathnames in the command hash table are not subject to @code{EXECIGNORE}. Use this variable to ignore shared library files that have the executable bit set, but are not executable files. The pattern matching honors the setting of the @code{extglob} shell diff --git a/findcmd.c b/findcmd.c index eab14fc3..7ff349ce 100644 --- a/findcmd.c +++ b/findcmd.c @@ -189,7 +189,7 @@ file_status (name) /* Else we check whether `others' have permission to execute the file */ else { - if (finfo.st_mode & S_IXOTH) + if (exec_name_should_ignore (name) == 0 && finfo.st_mode & S_IXOTH) r |= FS_EXECABLE; if (finfo.st_mode & S_IROTH) r |= FS_READABLE; @@ -568,7 +568,7 @@ find_in_path_element (name, path, flags, name_len, dotinfop) /* The file is not executable, but it does exist. If we prefer an executable, then remember this one if it is the first one we have found. */ - if ((flags & FS_EXEC_PREFERRED) && file_to_lose_on == 0) + if ((flags & FS_EXEC_PREFERRED) && file_to_lose_on == 0 && exec_name_should_ignore (full_path) == 0) file_to_lose_on = savestring (full_path); /* If we want only executable files, or we don't want directories and