[Toybox] [PATCH] blkid, mount: fix `blkid -L` and add support for `mount LABEL=...`

Kana Steimle kanasteimle at gmail.com
Fri Nov 8 08:51:29 PST 2024


I realized after I sent my last email to you that it didn't go to the
mailing list because I didn't re-add it to who I'm replying to. Do I
forward it to the mailing list, or just leave it alone?

> No idea what gmail's up to these days.
I've wanted to switch off of gmail and self-host a mail server instead,
but the last time I tried that I could only receive emails and not send
them. I'm just sticking with what works for now.

> Your new test fails because there's no "fat32.bz2" file. (I'm assuming
> you have one?)
I included instructions in the patch on how to create the fat32.bz2 file
in case you didn't want to trust binary files created by strangers on
the internet (we all know how that went down with xz), but if you don't
care about that and just want a file you can drop in, I've attached it
for you.

> The if (*type=='v') test is ok for distinguishing between "we just
> checked for 'vfat' and 'iso9660' so which of the two was it", but in
> code that's run for every filesystem I'm a lot less comfortable with
> that.
I was kind of iffy on the (*type=='v') test as well. Part of me thought I
should replace it with a (!strcmp(type, "vat")) instead since I was
moving the line out of the check for the full type names, but I guess
that slipped my mind. If you think your method of checking !FLAG(U)
is more efficient though, go for it.

> -      if (*type=='v') show_tag("SEC_TYPE", "msdos");
> +      if (*type=='v' && !FLAG(U)) show_tag("SEC_TYPE", "msdos");
I added the test `&& fstypes[i].magic_len == 4` in order to differentiate
between fat12/16 and fat32, since both share the "vfat" type name. It's
admittedly a bit arbitrary, but iirc it was the first clear difference between
their structures in fstypes. I would instead do:
-      if (*type=='v') show_tag("SEC_TYPE", "msdos");
+      if (*type=='v' && fstypes[i].magic_len == 4 && !FLAG(U))
show_tag("SEC_TYPE", "msdos");
I guess that's on me for not leaving a comment to explain why that test
was there.
On Fri, Nov 8, 2024 at 9:32 AM Rob Landley <rob at landley.net> wrote:
>
> On 11/6/24 14:35, Kana Steimle wrote:
> > On Sat, 2024-11-02 at 23:53 -0500, Rob Landley wrote:
> >> On 11/2/24 03:30, Kana Steimle wrote:
> >>> Fixes `blkid -L`, and uses that to implement `mount LABEL=...`, the
> >>> same way
> >>> `mount UUID=...` was implemented.
> >>
> >> Your message got wordwrapped, including the patch itself so it needs
> >> fixing up to apply it.
> >>
> >> Could you try again as an attachment?
> >>
> >> Thanks,
> >>
> >> Rob
>  >
> > Sorry for not replying sooner. For some reason gmail decided to put
> > your reply in spam, so I didn't realize you responded until I thought
> > to check it.
>
> No idea what gmail's up to these days. I moved my own email off it
> earlier this year (to dreamhost's mail servers) because they yanked the
> login method I was using.
>
> And now "patch format detection failed" because there's no header lines
> like "git format-patch -1 $HASH" produces. But I can fix that up but
> cutting and pasting the from/subject/time from your email's headers...
>
> Your new test fails because there's no "fat32.bz2" file. (I'm assuming
> you have one?)
>
> The if (*type=='v') test is ok for distinguishing between "we just
> checked for 'vfat' and 'iso9660' so which of the two was it", but in
> code that's run for every filesystem I'm a lot less comfortable with
> that. A new 4 letter filesystem starting with v added in future could
> theoretically trigger this non-obviously. Maybe not LIKELY ("virt" and
> "v9fs" are both network filesystems), but It's a sharp edge. If you want
> to exclude -U then I'd much prefer doing that ala:
>
> -      if (*type=='v') show_tag("SEC_TYPE", "msdos");
> +      if (*type=='v' && !FLAG(U)) show_tag("SEC_TYPE", "msdos");
>
> The one thing I can't easily fixup here is the missing fat32.bz2. Could
> you send me that?
>
> Thanks,
>
> Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fat32.bz2
Type: application/bzip2
Size: 383 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20241108/57b5f275/attachment.bin>


More information about the Toybox mailing list