From: Keyu Tao <taoky@mail.ustc.edu.cn>
To: musl@lists.openwall.com
Cc: alex_y_xu@yahoo.ca
Subject: Re: [musl] getmntent() fails to parse when source is empty string
Date: Mon, 11 Apr 2022 00:39:33 +0800 [thread overview]
Message-ID: <e00fb341-093a-4c39-2f4b-d3a938e7e5ad@mail.ustc.edu.cn> (raw)
In-Reply-To: <1649605497.38rdgg2ifl.none@localhost>
Thank you for your reply.
I once believed that glibc can handle the leading whitespace as `mount`
in my host is working correctly. I rechecked just now and found that the
`mount` in Alpine container is provided by busybox, which uses
`getmntent_r()` to parse /proc/mounts (in mount_main()). However, the
`mount` in my host is provided by util-linux package rather than
busybox, and it does not use `getmntent()`. I used `ltrace` to see all
library function calls, and the busybox mount implementation in glibc
also provides incorrect result like this:
getmntent_r(0x555adeefa2c0, { "/tmp/test1", "tmpfs",
"rw,nosuid,nodev,relatime,inode64"..., "0", 0, 0 }, " /tmp/test1", 1016)
= { "/tmp/test1", "tmpfs", "rw,nosuid,nodev,relatime,inode64"..., "0",
0, 0 }
getmntent_r(0x555adeefa2c0, { "none", "/tmp/test2", "tmpfs",
"rw,nosuid,nodev,relatime,inode64"..., 0, 0 }, "none", 1016) = { "none",
"/tmp/test2", "tmpfs", "rw,nosuid,nodev,relatime,inode64"..., 0, 0 }
It looks like not a bug of musl now :-).
在 2022/4/11 00:00, Alex Xu (Hello71) 写道:
> It's worth noting that octal escape sequences are also not supported.
> This has been reported previously, e.g. at:
>
> https://inbox.vuxu.org/musl/HE1P192MB0010D60AAC4BA0F08F1A5644FB5E0@HE1P192MB0010.EURP192.PROD.OUTLOOK.COM/
>
> https://inbox.vuxu.org/musl/87o85j8sru.fsf@atufi.org/
>
> I think the empty source is basically impossible to support with
> getmntent though. Both the glibc and musl implementations ignore leading
> whitespace, probably because getmntent is more commonly used with fstab,
> where users may have unintentional leading whitespace. If empty sources
> are an issue for your program, I would suggest using your own getmntent
> implementation.
prev parent reply other threads:[~2022-04-10 21:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 17:09 Keyu Tao
2022-04-10 16:00 ` Alex Xu (Hello71)
2022-04-10 16:39 ` Keyu Tao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e00fb341-093a-4c39-2f4b-d3a938e7e5ad@mail.ustc.edu.cn \
--to=taoky@mail.ustc.edu.cn \
--cc=alex_y_xu@yahoo.ca \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).