[Toybox] [PATCH] Fix SEC_TYPE for vfat and iso9660

Eric Molitor emolitor at molitor.org
Fri Feb 10 05:33:28 PST 2023


Actually you were spot on with your feedback. I also checked with
e2fsprogs, util-linux and busy box blkid and this is the most consistent
ordering of output for SEC_TYPE.

- Eric
---
 tests/blkid.test   | 2 +-
 toys/other/blkid.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/blkid.test b/tests/blkid.test
index 4c385dcb..7e625492 100755
--- a/tests/blkid.test
+++ b/tests/blkid.test
@@ -29,7 +29,7 @@ testing "f2fs" "BLKID f2fs" \
   'temp.img: LABEL="myf2fs" UUID="b53d3619-c204-4c0b-8504-36363578491c"
TYPE="f2fs"\n' \
   "" ""
 testing "iso" "BLKID iso" \
-  'temp.img: SEC_TYPE="msdos" LABEL="MYISO" UUID="1970-01-02-12-55-42-00"
TYPE="iso9660"\n' \
+  'temp.img: LABEL="MYISO" UUID="1970-01-02-12-55-42-00" TYPE="iso9660"\n'
\
   "" ""
 testing "msdos" "BLKID msdos" \
   'temp.img: SEC_TYPE="msdos" LABEL="mymsdos" UUID="6E1E-0851"
TYPE="vfat"\n' \
diff --git a/toys/other/blkid.c b/toys/other/blkid.c
index 726ae754..bed20b2c 100644
--- a/toys/other/blkid.c
+++ b/toys/other/blkid.c
@@ -168,7 +168,7 @@ static void do_blkid(int fd, char *name)
   if (!FLAG(U) && len) {
     s = toybuf+fstypes[i].label_off-off;
     if (!strcmp(type, "vfat") || !strcmp(type, "iso9660")) {
-      show_tag("SEC_TYPE", "msdos");
+      if (*type=='v') show_tag("SEC_TYPE", "msdos");
       while (len && s[len-1]==' ') len--;
       if (strstart(&s, "NO NAME")) len=0;
     }
-- 
2.39.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20230210/b2308db9/attachment.htm>


More information about the Toybox mailing list