All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Caseless UUID comparsion in search command
@ 2009-07-06  7:57 Daniel Mierswa
  2009-07-06 20:14 ` Pavel Roskin
  2009-07-06 20:16 ` Arthur Marsh
  0 siblings, 2 replies; 13+ messages in thread
From: Daniel Mierswa @ 2009-07-06  7:57 UTC (permalink / raw)
  To: grub-devel


[-- Attachment #1.1: Type: text/plain, Size: 536 bytes --]

Just like some time ago in search_fs_uuid() the search_fs() function of
search also needs to be caseless when comparing UUIDs, for some reason
GRUB2 didn't find my UUID although I entered it as reported by blkid. To
be on the safe side, just use strncasecmp. :) Patch against git master
and ChangeLog attached. I await your feedback. :-)

-- 
Mierswa, Daniel

If you still don't like it, that's ok: that's why I'm boss. I simply
know better than you do.
               --- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22

[-- Attachment #1.2: ChangeLog --]
[-- Type: text/plain, Size: 123 bytes --]

2009-07-06  Daniel Mierswa  <impulze@impulze.org>

	* commands/search.c (search_fs): use `strcasecmp' for UUID comparsion.

[-- Attachment #1.3: grub2.patch --]
[-- Type: text/plain, Size: 1116 bytes --]

From 02d806fe1e7603c38f2c885680007b6d14edeefa Mon Sep 17 00:00:00 2001
From: Daniel Mierswa <impulze@impulze.org>
Date: Mon, 6 Jul 2009 09:35:17 +0200
Subject: [PATCH] ignore case for uuid comparison in search

---
 commands/search.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/commands/search.c b/commands/search.c
index 647f408..52b5fd6 100644
--- a/commands/search.c
+++ b/commands/search.c
@@ -70,6 +70,13 @@ search_fs (const char *key, const char *var, int no_floppy, int is_uuid)
 
 	  fs = grub_fs_probe (dev);
 
+	  int (*compare_fn)(const char *s1, const char *s2);
+	  if (is_uuid) {
+	    compare_fn = grub_strcasecmp;
+	  } else {
+	    compare_fn = grub_strcmp;
+	  }
+
 #define QUID(x)	(is_uuid ? (x)->uuid : (x)->label)
 
 	  if (fs && QUID(fs))
@@ -79,7 +86,7 @@ search_fs (const char *key, const char *var, int no_floppy, int is_uuid)
 	      (QUID(fs)) (dev, &quid);
 	      if (grub_errno == GRUB_ERR_NONE && quid)
 		{
-		  if (grub_strcmp (quid, key) == 0)
+		  if (compare_fn (quid, key) == 0)
 		    {
 		      /* Found!  */
 		      count++;
-- 
1.6.3.3


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-07-08  8:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-06  7:57 [PATCH] Caseless UUID comparsion in search command Daniel Mierswa
2009-07-06 20:14 ` Pavel Roskin
2009-07-06 20:16 ` Arthur Marsh
2009-07-07  0:38   ` Pavel Roskin
2009-07-07  1:11     ` Arthur Marsh
2009-07-07  1:43       ` Arthur Marsh
2009-07-07  1:58       ` Pavel Roskin
2009-07-07  3:38         ` Arthur Marsh
2009-07-07  4:23           ` Pavel Roskin
2009-07-07  4:40             ` Arthur Marsh
2009-07-07  6:51               ` Arthur Marsh
2009-07-08  6:26                 ` Pavel Roskin
2009-07-08  8:26                   ` Arthur Marsh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.