* 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:
Vladimir 'phcoder' Serbinenko 2012-01-24 13:34:36 +01:00
parent 87edb8940a
commit f8a9ab1245
3 changed files with 19 additions and 22 deletions

View file

@ -1,3 +1,10 @@
2012-01-24 Vladimir Serbinenko <phcoder@gmail.com>
* 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.
2012-01-24 Vladimir Serbinenko <phcoder@gmail.com> 2012-01-24 Vladimir Serbinenko <phcoder@gmail.com>
Replace single-linked with double-linked lists. It results in more Replace single-linked with double-linked lists. It results in more

View file

@ -326,10 +326,15 @@ match_files (const char *prefix, const char *suffix, const char *end,
if (! fs) if (! fs)
goto fail; goto fail;
path = grub_strchr (dir, ')'); if (dir[0] == '(')
if (! path) {
goto fail; path = grub_strchr (dir, ')');
path++; if (!path)
goto fail;
path++;
}
else
path = dir;
if (fs->dir (dev, path, match)) if (fs->dir (dev, path, match))
goto fail; goto fail;
@ -431,25 +436,8 @@ wildcard_expand (const char *s, char ***strs)
if (start == noregexop) /* device part has regexop */ if (start == noregexop) /* device part has regexop */
paths = match_devices (&regexp, *start != '('); paths = match_devices (&regexp, *start != '(');
else if (*start == '(') /* device part explicit wo regexop */ else /* device part explicit wo regexop */
paths = match_files ("", start, noregexop, &regexp); paths = match_files ("", start, noregexop, &regexp);
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, &regexp);
grub_free (prefix);
}
} }
else else
{ {

View file

@ -99,3 +99,5 @@ echo one'two
# #
# two" # two"
if test x$grubshell = xyes; then insmod regexp; fi
echo /boot/grub/i386-pc/normal.mod