[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#30116: [PATCH] `substitute' crashes when file contains NUL character
From: |
Ludovic Courtès |
Subject: |
bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates) |
Date: |
Mon, 22 Jan 2018 11:58:37 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Mark H Weaver <address@hidden> skribis:
> Maxim Cournoyer <address@hidden> writes:
>
>> address@hidden (Ludovic Courtès) writes:
>>
>>> Maxim Cournoyer <address@hidden> skribis:
>>>
>>>> I've encountered the following crash when trying to use substitute on a
>>>> file which contains NUL characters:
>>>
>>> Yes, that’s because Guile’s ‘regexp-exec’ simply wraps libc’s ‘regexec’,
>>> which does not handle NULs.
>>>
>>> We should consider switching to the pure-Scheme SRFI-115:
>>>
>>> https://srfi.schemers.org/srfi-115/srfi-115.html
>>
>> This looks good, and I started looking into porting `substitute' to it,
>> but quickly noticed it doesn't seem to be implemented in Guile yet?
ISTR that the reference implementation works fine on Guile.
> Indeed. SRFI-115 for Guile is on my TODO list, although it might be
> better to wait until after we switch to using UTF-8 encoding internally
> for strings, since that will drastically affect the implementation of
> any efficient regexp matcher on Scheme strings.
Indeed, though I suppose it doesn’t matter much for the cases where
‘substitute*’ is used?
> Anyway, 'substitute*' is to be used only on text files, and NUL bytes
> are not a valid textual character. So, I think that this case is
> outside of what 'substitute*' is meant to do, and therefore not a bug in
> 'substitute*', although of course a more graceful error would surely be
> preferable.
Yes, that’s also a good point.
So yeah, I think it may be good “eventually” to switch to SRFI-115, but
that’s not urgent.
Thoughts?
Ludo’.
- bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates), Maxim Cournoyer, 2018/01/14
- Message not available
- bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates), Ludovic Courtès, 2018/01/16
- bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates), Maxim Cournoyer, 2018/01/20
- bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates), Mark H Weaver, 2018/01/21
- bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates),
Ludovic Courtès <=
- bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates), Maxim Cournoyer, 2018/01/22
- bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates), Ludovic Courtès, 2018/01/23
- bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates), Maxim Cournoyer, 2018/01/25
- bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates), Ludovic Courtès, 2018/01/25