|
Message-ID: <e00fb341-093a-4c39-2f4b-d3a938e7e5ad@mail.ustc.edu.cn> Date: Mon, 11 Apr 2022 00:39:33 +0800 From: Keyu Tao <taoky@...l.ustc.edu.cn> To: musl@...ts.openwall.com Cc: alex_y_xu@...oo.ca Subject: Re: getmntent() fails to parse when source is empty string 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.
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.