]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/commands/wildcard.c (match_files): Handle filenames
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 24 Jan 2012 12:34:36 +0000 (13:34 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 24 Jan 2012 12:34:36 +0000 (13:34 +0100)
without explicit device.
(wildcard_expand): Don't add explicit device if not already present.
* tests/grub_script_echo1.in: Add a new expansion test.

ChangeLog
grub-core/commands/wildcard.c
tests/grub_script_echo1.in

index 6f3b10818fe34b575eac26bc2b7d36e53bd41c3b..0c97dd3143e45fe6d321c1e870d3266236ab71d1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        Replace single-linked with double-linked lists. It results in more
index d991b2010f08f838072c788c66c254177531aaca..8afda3c99516e35218d7e6fd0876274eff511af2 100644 (file)
@@ -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 (&regexp, *start != '(');
 
-         else if (*start == '(') /* device part explicit wo regexop */
+         else  /* device part explicit wo regexop */
            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
        {
index 9415a3f73e1b39b0788b017b4f4da8c1cc361279..54395774f26e0cc1f91c9110ebe32862435556af 100644 (file)
@@ -99,3 +99,5 @@ echo one'two
 #
 # two"
 
+if test x$grubshell = xyes; then insmod regexp; fi
+echo /boot/grub/i386-pc/normal.mod