[PATCH] getmntent: Consolidate character decoding
Carlos O'Donell
carlos@redhat.com
Tue Dec 15 14:50:13 GMT 2020
On 12/14/20 11:48 PM, Siddhesh Poyarekar via Libc-alpha wrote:
> The Linux kernel escapes some characters (whitespaces and \) by
> replacing them with their octal form in the format \xxx. Use that
> format to decode insteald of looking for specific bytes so that the
> check is extensible. This way if the kernel escapes additional
> characters, glibc code won't have to change to accommodate it. I
> have, for example, proposed[1] to escape the '#' character since it
> may interfere with parsing in getmntent.
>
> The check for '\\\\' is kept intact even though as of today, the
> kernel does not write '\\\\' to escape a backslash; it write its octal
> equivalent instead.
>
> [1] https://lore.kernel.org/linux-fsdevel/20201215042454.998361-1-siddhesh@gotplt.org/T/#u
> ---
> misc/mntent_r.c | 43 +++++++++++++++----------------------------
> 1 file changed, 15 insertions(+), 28 deletions(-)
Please consider how we would test this.
I would like to see additional coverage here to make sure this works
in the future.
--
Cheers,
Carlos.
More information about the Libc-alpha
mailing list