Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250209143738.GY10433@brightrain.aerifal.cx>
Date: Sun, 9 Feb 2025 09:37:40 -0500
From: Rich Felker <dalias@...c.org>
To: Sertonix <sertonix@...teo.net>
Cc: musl@...ts.openwall.com
Subject: Re: hasmntopt(3) match options instead of substring?

On Mon, Feb 03, 2025 at 11:46:06PM +0000, Sertonix wrote:
> Hi,
> 
> people reported issues with mount options not working correctly with
> ZFS[1] and someone noticed that it could be related to a behaviour
> difference of hasmntopt(3) between musl and glibc.
> 
> The manpage[2] mentions that it returns a "substring that matches opt".
> Just like musl has implemented it this is just strstr. The problem is
> that it will return "atime" as a option found in "noatime" even though
> that is probably not what people want.
> 
> glibc only accepts matches that match the complete option name.[3]
> 
> Would it be possible for musl to only match options as well?
> Ideally the wording of hasmntopt(3) would be improved too.
> 
> [1]: https://gitlab.alpinelinux.org/alpine/aports/-/issues/12382
> [2]: https://man.archlinux.org/man/hasmntopt.3.en
> [3]: https://codebrowser.dev/glibc/glibc/misc/mntent_r.c.html#__hasmntopt

This was reported back in
https://www.openwall.com/lists/musl/2023/03/30/5 and probably sometime
earlier as well, and I think we're in agreement that it needs to be
changed.

Here's a completely untested patch which I think gives the reasonable
and glibc-matching behavior.

Rich

View attachment "hasmntopt.diff" of type "text/plain" (514 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.