From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#30116: [PATCH] `substitute' crashes when file contains NUL characters (core-updates)) Date: Wed, 17 Jan 2018 15:37:54 +0100 Message-ID: <87h8rk4kl9.fsf@gnu.org> References: <87r2qrc3mq.fsf@gmail.com> <87k1wjc35d.fsf_-_@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eboqs-000828-4Z for bug-guix@gnu.org; Wed, 17 Jan 2018 09:38:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eboqo-0003XE-5a for bug-guix@gnu.org; Wed, 17 Jan 2018 09:38:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:51683) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eboqo-0003Wx-1I for bug-guix@gnu.org; Wed, 17 Jan 2018 09:38:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eboqn-0002dq-OA for bug-guix@gnu.org; Wed, 17 Jan 2018 09:38:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87k1wjc35d.fsf_-_@gmail.com> (Maxim Cournoyer's message of "Sun, 14 Jan 2018 20:38:22 -0500") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Maxim Cournoyer Cc: 30116@debbugs.gnu.org Maxim Cournoyer skribis: > From 9891e428eae0ed24e0d61862b3f5e298606b79eb Mon Sep 17 00:00:00 2001 > From: Maxim Cournoyer > Date: Sun, 14 Jan 2018 20:31:33 -0500 > Subject: [PATCH] utils: Prevent substitute from crashing on files contain= ing > NUL chars. > > Fixes issue #30116. > > * guix/build/utils.scm (substitute): Add condition to skip lines containi= ng > the NUL character. [...] > + ((string-contains line (make-string 1 #\nul)) Rather (string-index line #\nul). > + ;; The regexp functions of the GNU C library (which Guile us= es) > + ;; cannot deal with NUL characters, so skip to the next line. > + (format #t "skipping line with NUL characters: ~s\n" line) > + (loop (read-line in 'concat))) Rather (format (current-error-port) =E2=80=A6). It=E2=80=99s strange semantics, but it=E2=80=99s probably better than crash= ing in the contexts where we use it. Otherwise LGTM. This would have to go to the next =E2=80=98core-updates=E2= =80=99 (or =E2=80=98core-updates-next=E2=80=99 in the meantime.) Thanks! Ludo=E2=80=99.