From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 30116@debbugs.gnu.org
Subject: bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates)
Date: Thu, 25 Jan 2018 00:11:26 -0500 [thread overview]
Message-ID: <87po5y8qv5.fsf@gmail.com> (raw)
In-Reply-To: <87o9lk64xz.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 23 Jan 2018 15:11:04 +0100")
ludo@gnu.org (Ludovic Courtès) writes:
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> In the `patch-el-files' phase of the emacs-build-system, we find the
>> following snippet:
>>
>> (with-directory-excursion el-dir
>> ;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still encoded
>> ;; with the "ISO-8859-1" locale.
>> (unless (false-if-exception (substitute-cmd))
>> (with-fluids ((%default-port-encoding "ISO-8859-1"))
>> (substitute-cmd))))
>>
>> In case an exception is returned while processing the file, it is
>> retried being opened with the "ISO-8859-1" encoding. Or, this resolves
>> to a call to `open-file', which documentation says:
>>
>> ‘b’
>> Use binary mode, ensuring that each byte in the file will be
>> read as one Scheme character.
>>
>> To provide this property, the file will be opened with the
>> 8-bit character encoding "ISO-8859-1", ignoring the default
>> port encoding. *Note Ports::, for more information on port
>> encodings.
>>
>> So, by opening an file whose encoding is unknown as a ISO-8859-1 file,
>> we are doing the same as if we had passed the 'binary option. Could this
>> explain why we end up with NUL characters where we were expecting text?
>
> That could be the reason. Guile provides a way to honor Emacs-style
> ‘encoding’ declarations, and ‘call-with-input-file’ does that if we pass
> #:guess-encoding #t (info "(guile) Character Encoding of Source Files").
>
> Did the faulty file have such a declaration?
Sadly, it doesn't. Although even if it did, I don't think it would be
very robust to expect every misbehaving files we might encounter to
include one!
So I think we should apply my v2 patch to core-updates for now (see my
previous reply on this thread), until we have our substitute routine
implemented using srfi-115!
Thanks,
Maxim
next prev parent reply other threads:[~2018-01-25 5:12 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
2018-01-23 4:27 ` Maxim Cournoyer
2018-01-23 14:11 ` Ludovic Courtès
2018-01-25 5:11 ` Maxim Cournoyer [this message]
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=87po5y8qv5.fsf@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=30116@debbugs.gnu.org \
--cc=ludo@gnu.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.