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:
Chet Ramey
2023-07-25 10:18:35 -04:00
parent ad39c5c3d7
commit 8418224f32
27 changed files with 624 additions and 462 deletions
+9 -2
View File
@@ -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
+12
View File
@@ -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;
}