mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-30 08:59:56 +02:00
commit bash-20150515 snapshot
This commit is contained in:
@@ -8518,3 +8518,43 @@ subst.c
|
||||
- pat_subst: change to allow empty strings to be replaced as long as
|
||||
pattern matches empty string. Report and fix from isabella parakiss
|
||||
<izaberina@gmail.com>
|
||||
|
||||
5/12
|
||||
----
|
||||
lib/sh/strtrans.c
|
||||
- ansic_wshouldquote: make behavior consistent in the event of an
|
||||
invalid multibyte sequence: return 1 to the caller so the string
|
||||
will be $'...' quoted
|
||||
|
||||
builtins/cd.def
|
||||
- cd_builtin: print the right error message even if printable_filename
|
||||
changes errno (e.g., EILSEQ)
|
||||
|
||||
lib/sh/shquote.c
|
||||
- sh_backslash_quote: in multibyte locales, even if is_basic does not
|
||||
return true, backslash-quote an ASCII character that backslash_table
|
||||
says should be quoted. Part of fix for bug reported by Igor
|
||||
Bogomazov <ygrex@ygrex.ru>
|
||||
|
||||
bashline.c
|
||||
- directory_exists: new function, dequotes the string argument, removes
|
||||
any trailing slash, and returns true if the result is a valid
|
||||
existing filename
|
||||
- bash_filename_stat_hook,bash_directory_completion_hook: use
|
||||
directory_exists instead of calling lstat/stat on the quoted
|
||||
directory name. Rest of fix for bug reported by Igor Bogomazov
|
||||
<ygrex@ygrex.ru>
|
||||
|
||||
5/15
|
||||
----
|
||||
aclocal.m4
|
||||
- BASH_CHECK_MULTIBYTE: when checking for locale_charset, add $LIBINTL to
|
||||
$LIBS. If we're using the included lib/intl/libintl.a, it will include
|
||||
a version of locale_charset
|
||||
|
||||
5/17
|
||||
----
|
||||
lib/readline/bind.c
|
||||
- sv_isrchterm: make sure we check for v[end] == 0 while in the loop
|
||||
looking for whitespace. Bug report and fix from Sergio Durigan
|
||||
Junior <sergiodj@sergiodj.net>
|
||||
|
||||
Vendored
+1
-1
@@ -1793,7 +1793,7 @@ fi
|
||||
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
OLDLIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBICONV"
|
||||
LIBS="$LIBS $LIBINTL $LIBICONV"
|
||||
AC_CHECK_FUNCS(locale_charset)
|
||||
LIBS="$OLDLIBS"
|
||||
fi
|
||||
|
||||
+30
-11
@@ -141,6 +141,8 @@ static int executable_completion __P((const char *, int));
|
||||
static rl_icppfunc_t *save_directory_hook __P((void));
|
||||
static void restore_directory_hook __P((rl_icppfunc_t));
|
||||
|
||||
static int directory_exists __P((const char *));
|
||||
|
||||
static void cleanup_expansion_error __P((void));
|
||||
static void maybe_make_readline_line __P((char *));
|
||||
static void set_up_new_line __P((char *));
|
||||
@@ -3077,6 +3079,30 @@ restore_directory_hook (hookf)
|
||||
rl_directory_rewrite_hook = hookf;
|
||||
}
|
||||
|
||||
/* Check whether not the (dequoted) version of DIRNAME, with any trailing slash
|
||||
removed, exists. */
|
||||
static int
|
||||
directory_exists (dirname)
|
||||
const char *dirname;
|
||||
{
|
||||
char *new_dirname;
|
||||
int dirlen, r;
|
||||
struct stat sb;
|
||||
|
||||
/* First, dequote the directory name */
|
||||
new_dirname = bash_dequote_filename (dirname, rl_completion_quote_character);
|
||||
dirlen = STRLEN (new_dirname);
|
||||
if (new_dirname[dirlen - 1] == '/')
|
||||
new_dirname[dirlen - 1] = '\0';
|
||||
#if defined (HAVE_LSTAT)
|
||||
r = lstat (new_dirname, &sb) == 0;
|
||||
#else
|
||||
r = stat (new_dirname, &sb) == 0;
|
||||
#endif
|
||||
free (new_dirname);
|
||||
return (r);
|
||||
}
|
||||
|
||||
/* Expand a filename before the readline completion code passes it to stat(2).
|
||||
The filename will already have had tilde expansion performed. */
|
||||
static int
|
||||
@@ -3095,11 +3121,7 @@ bash_filename_stat_hook (dirname)
|
||||
else if (t = mbschr (local_dirname, '`')) /* XXX */
|
||||
should_expand_dirname = '`';
|
||||
|
||||
#if defined (HAVE_LSTAT)
|
||||
if (should_expand_dirname && lstat (local_dirname, &sb) == 0)
|
||||
#else
|
||||
if (should_expand_dirname && stat (local_dirname, &sb) == 0)
|
||||
#endif
|
||||
if (should_expand_dirname && directory_exists (local_dirname))
|
||||
should_expand_dirname = 0;
|
||||
|
||||
if (should_expand_dirname)
|
||||
@@ -3163,7 +3185,8 @@ bash_directory_completion_hook (dirname)
|
||||
char **dirname;
|
||||
{
|
||||
char *local_dirname, *new_dirname, *t;
|
||||
int return_value, should_expand_dirname, nextch, closer;
|
||||
int return_value, should_expand_dirname, nextch, closer, changed;
|
||||
size_t local_dirlen;
|
||||
WORD_LIST *wl;
|
||||
struct stat sb;
|
||||
|
||||
@@ -3192,11 +3215,7 @@ bash_directory_completion_hook (dirname)
|
||||
should_expand_dirname = '`';
|
||||
}
|
||||
|
||||
#if defined (HAVE_LSTAT)
|
||||
if (should_expand_dirname && lstat (local_dirname, &sb) == 0)
|
||||
#else
|
||||
if (should_expand_dirname && stat (local_dirname, &sb) == 0)
|
||||
#endif
|
||||
if (should_expand_dirname && directory_exists (local_dirname))
|
||||
should_expand_dirname = 0;
|
||||
|
||||
if (should_expand_dirname)
|
||||
|
||||
+3
-2
@@ -262,7 +262,7 @@ cd_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
char *dirname, *cdpath, *path, *temp;
|
||||
int path_index, no_symlinks, opt, lflag;
|
||||
int path_index, no_symlinks, opt, lflag, e;
|
||||
|
||||
#if defined (RESTRICTED_SHELL)
|
||||
if (restricted)
|
||||
@@ -437,8 +437,9 @@ cd_builtin (list)
|
||||
FREE (temp);
|
||||
}
|
||||
|
||||
e = errno;
|
||||
temp = printable_filename (dirname, 0);
|
||||
builtin_error ("%s: %s", temp, strerror (errno));
|
||||
builtin_error ("%s: %s", temp, strerror (e));
|
||||
if (temp != dirname)
|
||||
free (temp);
|
||||
return (EXECUTION_FAILURE);
|
||||
|
||||
@@ -11423,7 +11423,7 @@ fi
|
||||
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
OLDLIBS="$LIBS"
|
||||
LIBS="$LIBS $LIBICONV"
|
||||
LIBS="$LIBS $LIBINTL $LIBICONV"
|
||||
for ac_func in locale_charset
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "locale_charset" "ac_cv_func_locale_charset"
|
||||
|
||||
+1
-1
@@ -1859,7 +1859,7 @@ sv_isrchterm (value)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (beg = end = 0; whitespace (v[end]) == 0; end++)
|
||||
for (beg = end = 0; v[end] && whitespace (v[end]) == 0; end++)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,6 +246,13 @@ sh_backslash_quote (string, table, flags)
|
||||
for (r = result, s = string; s && (c = *s); s++)
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
/* XXX - isascii, even if is_basic(c) == 0 - works in most cases. */
|
||||
if (c >= 0 && c <= 127 && backslash_table[(unsigned char)c] == 1)
|
||||
{
|
||||
*r++ = '\\';
|
||||
*r++ = c;
|
||||
continue;
|
||||
}
|
||||
if (MB_CUR_MAX > 1 && is_basic (c) == 0)
|
||||
{
|
||||
COPY_CHAR_P (r, s, send);
|
||||
|
||||
+3
-2
@@ -312,8 +312,9 @@ ansic_wshouldquote (string)
|
||||
|
||||
slen = mbstowcs (wcstr, string, 0);
|
||||
|
||||
if (slen == -1)
|
||||
slen = 0;
|
||||
if (slen == (size_t)-1)
|
||||
return 1;
|
||||
|
||||
wcstr = (wchar_t *)xmalloc (sizeof (wchar_t) * (slen + 1));
|
||||
mbstowcs (wcstr, string, slen + 1);
|
||||
|
||||
|
||||
+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
|
||||
|
||||
|
||||
@@ -7,6 +7,13 @@ no more clauses
|
||||
1.0
|
||||
./case.tests: line 29: xx: readonly variable
|
||||
1.1
|
||||
matches 1
|
||||
no
|
||||
no
|
||||
no
|
||||
no
|
||||
no
|
||||
ok
|
||||
ok 1
|
||||
ok 2
|
||||
ok 3
|
||||
|
||||
@@ -29,5 +29,25 @@ readonly xx=1
|
||||
case 1 in $((xx++)) ) echo hi1 ;; *) echo hi2; esac
|
||||
echo ${xx}.$?
|
||||
|
||||
unset var empty
|
||||
|
||||
var=
|
||||
case ']' in
|
||||
[$var]*[$var]) echo matches 1;;
|
||||
*) echo no match 1 ;;
|
||||
esac
|
||||
|
||||
case abc in ( [] ) echo yes ;; ( * ) echo no ;; esac
|
||||
empty=''
|
||||
case abc in ( ["$empty"] ) echo yes ;; ( * ) echo no ;; esac
|
||||
|
||||
case abc in ( [] | [!a-z]* ) echo yes ;; ( * ) echo no ;; esac
|
||||
empty=''
|
||||
case abc in ( ["$empty"] | [!a-z]* ) echo yes ;; ( * ) echo no ;; esac
|
||||
|
||||
case abc in (["$empty"]|[!a-z]*) echo yes ;; (*) echo no ;; esac
|
||||
|
||||
case " " in ( [" "] ) echo ok;; ( * ) echo no;; esac
|
||||
|
||||
# tests of quote removal and pattern matching
|
||||
${THIS_SH} ./case1.sub
|
||||
|
||||
+3
-2
@@ -50,6 +50,7 @@ Passed all 1378 Unicode tests
|
||||
0000003
|
||||
0000000 101 040 302 243 040 305 222 012
|
||||
0000010
|
||||
./unicode3.sub: line 2: 5作3�+齷8叚窸: command not found
|
||||
5作3�+齷8叚窸
|
||||
./unicode3.sub: line 3: $'5\247@3\231+\306S8\237\242\352\263': command not found
|
||||
./unicode3.sub: line 5: cd: $'5\247@3\231+\306S8\237\242\352\263': No such file or directory
|
||||
$'5\247@3\231+\306S8\237\242\352\263'
|
||||
+ : $'5\247@3\231+\306S8\237\242\352\263'
|
||||
|
||||
+16
-10
@@ -254,6 +254,12 @@ argv[1] = <endocrine>
|
||||
argv[1] = <endocrine>
|
||||
argv[1] = <endocrine>
|
||||
argv[1] = <endocrine>
|
||||
x
|
||||
x
|
||||
x
|
||||
xabc
|
||||
x
|
||||
x
|
||||
argv[1] = </usr/bin>
|
||||
argv[2] = </bin>
|
||||
argv[3] = </usr/local/bin>
|
||||
@@ -405,13 +411,13 @@ argv[6] = <w>
|
||||
argv[7] = <x>
|
||||
argv[8] = <y>
|
||||
argv[9] = <z>
|
||||
./new-exp.tests: line 490: $9: unbound variable
|
||||
./new-exp.tests: line 491: 9: unbound variable
|
||||
./new-exp.tests: line 492: UNSET: unbound variable
|
||||
./new-exp.tests: line 493: UNSET: unbound variable
|
||||
./new-exp.tests: line 494: UNSET: unbound variable
|
||||
./new-exp.tests: line 495: UNSET: unbound variable
|
||||
./new-exp.tests: line 496: UNSET: unbound variable
|
||||
./new-exp.tests: line 503: $9: unbound variable
|
||||
./new-exp.tests: line 504: 9: unbound variable
|
||||
./new-exp.tests: line 505: UNSET: unbound variable
|
||||
./new-exp.tests: line 506: UNSET: unbound variable
|
||||
./new-exp.tests: line 507: UNSET: unbound variable
|
||||
./new-exp.tests: line 508: UNSET: unbound variable
|
||||
./new-exp.tests: line 509: UNSET: unbound variable
|
||||
argv[1] = <5>
|
||||
argv[1] = <#>
|
||||
argv[1] = <#>
|
||||
@@ -440,7 +446,7 @@ Case05---3---A:B:C---
|
||||
Case06---1---A B C::---
|
||||
Case07---3---A:B:C---
|
||||
Case08---3---A:B:C---
|
||||
./new-exp.tests: line 516: ${$(($#-1))}: bad substitution
|
||||
./new-exp.tests: line 529: ${$(($#-1))}: bad substitution
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[3] = <c>
|
||||
@@ -457,7 +463,7 @@ argv[1] = <a>
|
||||
argv[1] = <a>
|
||||
argv[2] = <b>
|
||||
argv[1] = <>
|
||||
./new-exp.tests: line 535: $(($# - 2)): substring expression < 0
|
||||
./new-exp.tests: line 548: $(($# - 2)): substring expression < 0
|
||||
argv[1] = <bin>
|
||||
argv[2] = <bin>
|
||||
argv[3] = <ucb>
|
||||
@@ -621,4 +627,4 @@ a b c d e
|
||||
a5b
|
||||
argv[1] = </>
|
||||
argv[1] = </>
|
||||
./new-exp.tests: line 595: ABXD: parameter unset
|
||||
./new-exp.tests: line 608: ABXD: parameter unset
|
||||
|
||||
@@ -452,6 +452,19 @@ recho ${xxx//%${zzz}}
|
||||
recho ${xxx//#${zzz}/}
|
||||
recho ${xxx//#${zzz}}
|
||||
|
||||
# make sure null strings are replaced appropriately
|
||||
unset var
|
||||
var=
|
||||
echo "${var/#/x}"
|
||||
echo "${var/*/x}"
|
||||
echo "${var//*/x}"
|
||||
|
||||
var=abc
|
||||
echo "${var/#/x}"
|
||||
echo "${var/*/x}"
|
||||
echo "${var//*/x}"
|
||||
unset var
|
||||
|
||||
# another case that caused a core dump in bash-2.0
|
||||
XPATH=/usr/bin:/bin:/usr/local/bin:/usr/gnu/bin::/usr/bin/X11:/sbin:/usr/sbin
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export LANG=en_US.UTF-8 # make sure
|
||||
payload=$'\065\247\100\063\231\053\306\123\070\237\242\352\263'
|
||||
"$payload"
|
||||
|
||||
cd "$payload"
|
||||
printf %q "$payload"
|
||||
echo
|
||||
|
||||
|
||||
Reference in New Issue
Block a user