[PATCH] getmntent: Consolidate character decoding
Siddhesh Poyarekar
siddhesh@sourceware.org
Tue Dec 15 15:00:26 GMT 2020
On 12/15/20 8:20 PM, Carlos O'Donell via Libc-alpha wrote:
> 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.
>
Sure thing. I realized my first attempt was quite a lazy one and the
whole set of functions needs a closer look. I'll post a v2 with all
that and tests.
Siddhesh
More information about the Libc-alpha
mailing list