From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: 30116@debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates)
Date: Mon, 22 Jan 2018 11:58:37 +0100 [thread overview]
Message-ID: <87o9lmp3c2.fsf@gnu.org> (raw)
In-Reply-To: <877esb84ae.fsf@netris.org> (Mark H. Weaver's message of "Sun, 21 Jan 2018 13:17:45 -0500")
Mark H Weaver <mhw@netris.org> skribis:
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> ludo@gnu.org (Ludovic Courtès) writes:
>>
>>> Maxim Cournoyer <maxim.cournoyer@gmail.com> 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’.
next prev parent reply other threads:[~2018-01-22 10:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-15 1:27 bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates) Maxim Cournoyer
[not found] ` <handler.30116.B.15159796942311.ack@debbugs.gnu.org>
2018-01-15 1:38 ` bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates)) Maxim Cournoyer
2018-01-17 14:37 ` Ludovic Courtès
2018-06-14 1:40 ` Maxim Cournoyer
2018-06-14 8:01 ` Ludovic Courtès
2018-06-14 7:02 ` Mark H Weaver
2018-06-14 8:02 ` Ludovic Courtès
2018-06-16 16:47 ` Maxim Cournoyer
2018-06-17 4:36 ` Mark H Weaver
2021-01-08 19:14 ` bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates) Maxim Cournoyer
2021-01-08 21:42 ` Mark H Weaver
2018-01-16 11:23 ` Ludovic Courtès
2018-01-21 4:24 ` Maxim Cournoyer
2018-01-21 18:17 ` Mark H Weaver
2018-01-22 10:58 ` Ludovic Courtès [this message]
2018-01-23 4:27 ` Maxim Cournoyer
2018-01-23 14:11 ` Ludovic Courtès
2018-01-25 5:11 ` Maxim Cournoyer
2018-01-25 11:11 ` Ludovic Courtès
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=87o9lmp3c2.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=30116@debbugs.gnu.org \
--cc=maxim.cournoyer@gmail.com \
--cc=mhw@netris.org \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.