tags 292425 +pending thanks On Wed, Jan 26, 2005 at 11:35:24PM +0100, Mario Holbe wrote: > > since 1.36rc4-1 blkid doesn't find devices anymore when -c /dev/null > is given. This did work before (1.36rc3-2), but afaics it does even > not work with testing's version (1.35-6).
Actually, 1.36rc4-1's blkid was consistent with the blkid's man page, but I agree the behaviour isn't what is expected or the most useful. I've made the following change in e2fsprogs, which should fix the issue. - Ted # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/01/27 19:51:47-05:00 [EMAIL PROTECTED] # blkid.c (main, compare_search_type): Make blkid -t work more # consistently when the blkid cache file is explicitly set # to /dev/null. (Addresses Debian Bug #292425) # # Also expose blkid_verify() as a public function to the blkid library. # # misc/blkid.c # 2005/01/27 19:51:46-05:00 [EMAIL PROTECTED] +32 -36 # blkid.c (main, compare_search_type): Make blkid -t work more # consistently when the blkid cache file is explicitly set # to /dev/null. (Addresses Debian Bug #292425) # # # misc/blkid.8.in # 2005/01/27 19:51:46-05:00 [EMAIL PROTECTED] +3 -2 # blkid.c (main, compare_search_type): Make blkid -t work more # consistently when the blkid cache file is explicitly set # to /dev/null. (Addresses Debian Bug #292425) # # # misc/ChangeLog # 2005/01/27 19:51:46-05:00 [EMAIL PROTECTED] +4 -0 # Update log # # lib/blkid/tag.c # 2005/01/27 19:51:46-05:00 [EMAIL PROTECTED] +1 -1 # blkid.h, blkidP.h: Rename blkid_verify_devname() to be # blkid_verify(), and make it be a publically exported # function. # # lib/blkid/probe.c # 2005/01/27 19:51:46-05:00 [EMAIL PROTECTED] +1 -1 # blkid.h, blkidP.h: Rename blkid_verify_devname() to be # blkid_verify(), and make it be a publically exported # function. # # lib/blkid/devname.c # 2005/01/27 19:51:46-05:00 [EMAIL PROTECTED] +2 -2 # blkid.h, blkidP.h: Rename blkid_verify_devname() to be # blkid_verify(), and make it be a publically exported # function. # # lib/blkid/blkidP.h # 2005/01/27 19:51:46-05:00 [EMAIL PROTECTED] +0 -3 # blkid.h, blkidP.h: Rename blkid_verify_devname() to be # blkid_verify(), and make it be a publically exported # function. # # lib/blkid/blkid.h # 2005/01/27 19:51:46-05:00 [EMAIL PROTECTED] +1 -0 # blkid.h, blkidP.h: Rename blkid_verify_devname() to be # blkid_verify(), and make it be a publically exported # function. # # lib/blkid/ChangeLog # 2005/01/27 19:51:46-05:00 [EMAIL PROTECTED] +6 -0 # Update name. # diff -Nru a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog --- a/lib/blkid/ChangeLog 2005-01-27 19:51:55 -05:00 +++ b/lib/blkid/ChangeLog 2005-01-27 19:51:55 -05:00 @@ -1,3 +1,9 @@ +2005-01-27 Theodore Ts'o <[EMAIL PROTECTED]> + + * blkid.h, blkidP.h: Rename blkid_verify_devname() to be + blkid_verify(), and make it be a publically exported + function. + 2005-01-26 Theodore Ts'o <[EMAIL PROTECTED]> * version.c: Add functions to query the version of the blkid library. diff -Nru a/lib/blkid/blkid.h b/lib/blkid/blkid.h --- a/lib/blkid/blkid.h 2005-01-27 19:51:55 -05:00 +++ b/lib/blkid/blkid.h 2005-01-27 19:51:55 -05:00 @@ -71,6 +71,7 @@ /* probe.c */ int blkid_known_fstype(const char *fstype); +extern blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev); /* read.c */ diff -Nru a/lib/blkid/blkidP.h b/lib/blkid/blkidP.h --- a/lib/blkid/blkidP.h 2005-01-27 19:51:55 -05:00 +++ b/lib/blkid/blkidP.h 2005-01-27 19:51:55 -05:00 @@ -212,9 +212,6 @@ /* lseek.c */ extern blkid_loff_t blkid_llseek(int fd, blkid_loff_t offset, int whence); -/* probe.c */ -extern blkid_dev blkid_verify_devname(blkid_cache cache, blkid_dev dev); - /* read.c */ extern void blkid_read_cache(blkid_cache cache); diff -Nru a/lib/blkid/devname.c b/lib/blkid/devname.c --- a/lib/blkid/devname.c 2005-01-27 19:51:55 -05:00 +++ b/lib/blkid/devname.c 2005-01-27 19:51:55 -05:00 @@ -71,7 +71,7 @@ } if (flags & BLKID_DEV_VERIFY) - dev = blkid_verify_devname(cache, dev); + dev = blkid_verify(cache, dev); return dev; } @@ -91,7 +91,7 @@ blkid_dev tmp = list_entry(p, struct blkid_struct_dev, bid_devs); if (tmp->bid_devno == devno) { - dev = blkid_verify_devname(cache, tmp); + dev = blkid_verify(cache, tmp); break; } } diff -Nru a/lib/blkid/probe.c b/lib/blkid/probe.c --- a/lib/blkid/probe.c 2005-01-27 19:51:55 -05:00 +++ b/lib/blkid/probe.c 2005-01-27 19:51:55 -05:00 @@ -532,7 +532,7 @@ * If we are unable to revalidate the data, we return the old data and * do not set the BLKID_BID_FL_VERIFIED flag on it. */ -blkid_dev blkid_verify_devname(blkid_cache cache, blkid_dev dev) +blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) { struct blkid_magic *id; unsigned char *bufs[BLKID_BLK_OFFS + 1], *buf; diff -Nru a/lib/blkid/tag.c b/lib/blkid/tag.c --- a/lib/blkid/tag.c 2005-01-27 19:51:55 -05:00 +++ b/lib/blkid/tag.c 2005-01-27 19:51:55 -05:00 @@ -326,7 +326,7 @@ } } if (dev && !(dev->bid_flags & BLKID_BID_FL_VERIFIED)) { - dev = blkid_verify_devname(cache, dev); + dev = blkid_verify(cache, dev); if (dev && (dev->bid_flags & BLKID_BID_FL_VERIFIED)) goto try_again; } diff -Nru a/misc/ChangeLog b/misc/ChangeLog --- a/misc/ChangeLog 2005-01-27 19:51:55 -05:00 +++ b/misc/ChangeLog 2005-01-27 19:51:55 -05:00 @@ -1,5 +1,9 @@ 2005-01-27 Theodore Ts'o <[EMAIL PROTECTED]> + * blkid.c (main, compare_search_type): Make blkid -t work more + consistently when the blkid cache file is explicitly set + to /dev/null. (Addresses Debian Bug #292425) + * mke2fs.c (PRS): Don't use a blocksize greater than 4k, even on 2.6 kernels, unless explicitly requested by the user; not all 2.6 kernels (includeing stock 2.6 kernels as of this diff -Nru a/misc/blkid.8.in b/misc/blkid.8.in --- a/misc/blkid.8.in 2005-01-27 19:51:55 -05:00 +++ b/misc/blkid.8.in 2005-01-27 19:51:55 -05:00 @@ -90,8 +90,7 @@ with no other options. .TP .B \-t -Search the blkid cache (plus any devices specifed on the command line) -for all block devices with tokens named +Search for block devices with tokens named .I NAME that have the value .IR value , @@ -103,6 +102,8 @@ .BR LABEL , and .BR UUID . +If there are no devices specified on the command line, all block devices +will be searched; otherwise, only search the devices specified by the user. .TP .B \-v Display version number and exit. diff -Nru a/misc/blkid.c b/misc/blkid.c --- a/misc/blkid.c 2005-01-27 19:51:55 -05:00 +++ b/misc/blkid.c 2005-01-27 19:51:55 -05:00 @@ -88,6 +88,26 @@ printf("\n"); } +int compare_search_type(blkid_dev dev, const char *search_type, + const char *search_value) +{ + blkid_tag_iterate tag_iter; + const char *type, *value; + int 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++; + break; + } + } + blkid_tag_iterate_end(tag_iter); + + return found; +} + int main(int argc, char **argv) { blkid_cache cache = NULL; @@ -172,43 +192,8 @@ goto exit; err = 2; - /* If looking for a specific NAME=value pair, print only that */ - if (search_type) { - 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); - - /* - * 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) { + if (!numdev) { blkid_dev_iterate iter; blkid_dev dev; @@ -216,6 +201,13 @@ iter = blkid_dev_iterate_begin(cache); while (blkid_dev_next(iter, &dev) == 0) { + dev = blkid_verify(cache, dev); + if (!dev) + continue; + if (search_type && + !compare_search_type(dev, search_type, + search_value)) + continue; print_tags(dev, show, numtag, output_format); err = 0; } @@ -226,6 +218,10 @@ BLKID_DEV_NORMAL); if (dev) { + if (search_type && + !compare_search_type(dev, search_type, + search_value)) + continue; print_tags(dev, show, numtag, output_format); err = 0; } -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]