mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-25 08:39:28 +00:00
* grub-core/commands/wildcard.c (match_files): Handle filenames
without explicit device. (wildcard_expand): Don't add explicit device if not already present. * tests/grub_script_echo1.in: Add a new expansion test.
This commit is contained in:
1 parent
87edb8940a
commit
f8a9ab1245
3 files changed
+19
-22
No files matched your search
@@ -326,10 +326,15 @@ match_files (const char *prefix, const char *suffix, const char *end,
|
||||
if (! fs)
|
||||
goto fail;
|
||||
|
||||
path = grub_strchr (dir, ')');
|
||||
if (! path)
|
||||
goto fail;
|
||||
path++;
|
||||
if (dir[0] == '(')
|
||||
{
|
||||
path = grub_strchr (dir, ')');
|
||||
if (!path)
|
||||
goto fail;
|
||||
path++;
|
||||
}
|
||||
else
|
||||
path = dir;
|
||||
|
||||
if (fs->dir (dev, path, match))
|
||||
goto fail;
|
||||
@@ -431,25 +436,8 @@ wildcard_expand (const char *s, char ***strs)
|
||||
if (start == noregexop) /* device part has regexop */
|
||||
paths = match_devices (®exp, *start != '(');
|
||||
|
||||
else if (*start == '(') /* device part explicit wo regexop */
|
||||
else /* device part explicit wo regexop */
|
||||
paths = match_files ("", start, noregexop, ®exp);
|
||||
|
||||
else if (*start == '/') /* no device part */
|
||||
{
|
||||
const char *root;
|
||||
char *prefix;
|
||||
|
||||
root = grub_env_get ("root");
|
||||
if (! root)
|
||||
goto fail;
|
||||
|
||||
prefix = grub_xasprintf ("(%s)", root);
|
||||
if (! prefix)
|
||||
goto fail;
|
||||
|
||||
paths = match_files (prefix, start, noregexop, ®exp);
|
||||
grub_free (prefix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user