mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-06 11:50:49 +02:00
changes for quoting special and multibyte characters in glob patterns; changes to filename unicode normalization on macOS for globbing and filename completion; send SIGCONT unconditionally to just-restarted job in fg/bg
This commit is contained in:
+9
-2
@@ -653,7 +653,7 @@ glob_vector (char *pat, char *dir, int flags)
|
||||
int hasglob; /* return value from glob_pattern_p */
|
||||
int nalloca;
|
||||
struct globval *firstmalloc, *tmplink;
|
||||
char *convfn;
|
||||
char *convfn, *convpat;
|
||||
|
||||
lastlink = 0;
|
||||
count = 0;
|
||||
@@ -765,6 +765,10 @@ glob_vector (char *pat, char *dir, int flags)
|
||||
if (d == NULL)
|
||||
return ((char **) &glob_error_return);
|
||||
|
||||
convpat = fnx_fromfs (pat, patlen);
|
||||
if (convpat != pat)
|
||||
convpat = savestring (convpat);
|
||||
|
||||
/* Compute the flags that will be passed to strmatch(). We don't
|
||||
need to do this every time through the loop. */
|
||||
mflags = (noglob_dot_filenames ? FNM_PERIOD : FNM_DOTDOT) | FNM_PATHNAME;
|
||||
@@ -882,7 +886,7 @@ glob_vector (char *pat, char *dir, int flags)
|
||||
free (subdir);
|
||||
|
||||
convfn = fnx_fromfs (dp->d_name, D_NAMLEN (dp));
|
||||
if (strmatch (pat, convfn, mflags) != FNM_NOMATCH)
|
||||
if (strmatch (convpat, convfn, mflags) != FNM_NOMATCH)
|
||||
{
|
||||
if (nalloca < ALLOCA_MAX)
|
||||
{
|
||||
@@ -924,6 +928,9 @@ glob_vector (char *pat, char *dir, int flags)
|
||||
}
|
||||
|
||||
(void) closedir (d);
|
||||
|
||||
if (convpat != pat)
|
||||
free (convpat);
|
||||
}
|
||||
|
||||
/* compat: if GX_ADDCURDIR, add the passed directory also. Add an empty
|
||||
|
||||
@@ -2536,6 +2536,18 @@ rl_filename_completion_function (const char *text, int state)
|
||||
}
|
||||
filename_len = strlen (filename);
|
||||
|
||||
/* Normalize the filename if the application has set a rewrite hook. */
|
||||
if (*filename && rl_filename_rewrite_hook)
|
||||
{
|
||||
temp = (*rl_filename_rewrite_hook) (filename, filename_len);
|
||||
if (temp != filename)
|
||||
{
|
||||
xfree (filename);
|
||||
filename = temp;
|
||||
filename_len = strlen (filename);
|
||||
}
|
||||
}
|
||||
|
||||
rl_filename_completion_desired = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user