tags 290530 +pending thanks On Fri, Jan 14, 2005 at 06:23:31PM +0100, Mario Holbe wrote: > Package: libblkid1 > Version: 1.36rc2-1 > > Hello, > > the blkid tool if given with -t shows only the first matching device > instead of showing all matches as described in the manpage:
Thanks for reminding me about this one. It will be fixed in the next release of e2fsprogs. - Ted # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/01/21 19:11:05-05:00 [EMAIL PROTECTED] # Make blkid -t display all devices that match the specified criteria, # not just the first one. (Addresses Debian Bug #290530) # # Update the blkid man page's description of the -t option. # # # misc/blkid.c # 2005/01/21 19:11:05-05:00 [EMAIL PROTECTED] +25 -3 # blkid.c (main): Make blkid -t display all devices that match the # specified criteria, not just the first one. (Addresses # Debian Bug #290530) # # misc/blkid.8.in # 2005/01/21 19:11:05-05:00 [EMAIL PROTECTED] +2 -2 # Clarify blkid man page's description of the -t option. # # misc/ChangeLog # 2005/01/21 19:11:05-05:00 [EMAIL PROTECTED] +6 -0 # Update log # diff -Nru a/misc/ChangeLog b/misc/ChangeLog --- a/misc/ChangeLog 2005-01-21 19:11:15 -05:00 +++ b/misc/ChangeLog 2005-01-21 19:11:15 -05:00 @@ -1,3 +1,9 @@ +2005-01-21 Theodore Ts'o <[EMAIL PROTECTED]> + + * blkid.c (main): Make blkid -t display all devices that match the + specified criteria, not just the first one. (Addresses + Debian Bug #290530) + 2005-01-20 <[EMAIL PROTECTED]> * filefrag.c (frag_report): Fix filefrag so that it works diff -Nru a/misc/blkid.8.in b/misc/blkid.8.in --- a/misc/blkid.8.in 2005-01-21 19:11:15 -05:00 +++ b/misc/blkid.8.in 2005-01-21 19:11:15 -05:00 @@ -91,11 +91,11 @@ .TP .B \-t Search the blkid cache (plus any devices specifed on the command line) -for all visible block devices with tokens named +for all block devices with tokens named .I NAME that have the value .IR value , -and print the name of any devices that are found. +and display any devices which are found. Common values for .I NAME include diff -Nru a/misc/blkid.c b/misc/blkid.c --- a/misc/blkid.c 2005-01-21 19:11:15 -05:00 +++ b/misc/blkid.c 2005-01-21 19:11:15 -05:00 @@ -174,17 +174,39 @@ err = 2; /* If looking for a specific NAME=value pair, print only that */ if (search_type) { - blkid_dev dev; + blkid_dev_iterate dev_iter; + blkid_tag_iterate tag_iter; + blkid_dev dev; + int found; + const char *type, *value; /* Load any additional devices not in the cache */ for (i = 0; i < numdev; i++) blkid_get_dev(cache, devices[i], BLKID_DEV_NORMAL); - if ((dev = blkid_find_dev_with_tag(cache, search_type, - search_value))) { + /* + * XXX We need better interfaces in the blkid library + * so we don't need to open code as much stuff. + */ + dev_iter = blkid_dev_iterate_begin(cache); + while (blkid_dev_next(dev_iter, &dev) == 0) { + found = 0; + + tag_iter = blkid_tag_iterate_begin(dev); + while (blkid_tag_next(tag_iter, &type, &value) == 0) { + if (!strcmp(type, search_type) && + !strcmp(value, search_value)) + found++; + } + blkid_tag_iterate_end(tag_iter); + if (!found) + continue; + print_tags(dev, show, numtag, output_format); err = 0; } + blkid_dev_iterate_end(dev_iter); + /* If we didn't specify a single device, show all available devices */ } else if (!numdev) { blkid_dev_iterate iter; -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]