From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 6008C1F454; Fri, 18 Jan 2019 19:47:06 +0000 (UTC) Date: Fri, 18 Jan 2019 19:47:06 +0000 From: Eric Wong To: Konstantin Ryabitsev Cc: meta@public-inbox.org Subject: [PATCH] t/git.t: avoid passing read-only value to git_unquote Message-ID: <20190118194706.ubssl3oehd4zn7f2@whir> References: <20190118172056.GB5108@pure.paranoia.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190118172056.GB5108@pure.paranoia.local> List-Id: Konstantin Ryabitsev wrote: > This is probably fairly benign from the looks of it, but I'd like your > opinion on whether this is something to worry about before deploying. Yeah, the actual code only hits modifiable value > Perl: v5.16.3 This is Fedora? Which version? I was working on getting a chroot setup for testing some RPM-based distros, but some of the mirrors/tools for doing that were out-of-date. Might try installing in QEMU... > Git: 2.16.5 > Tree: d66aa534a4a7506cfc5cfab49d1e09f8db8be3dd Thanks for the report, following should fix it. ----------8<-------- Subject: [PATCH] t/git.t: avoid passing read-only value to git_unquote Older versions of Perl (tested 5.14.2 on Debian wheezy(*), reported by Konstantin on Perl 5.16.3) considered the result of concatenating two string literals to be a constant value. (*) not that other stuff works on wheezy, but t/git.t should. Reported-by: Konstantin Ryabitsev --- t/git.t | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/t/git.t b/t/git.t index 50ec4fb..052e1ce 100644 --- a/t/git.t +++ b/t/git.t @@ -145,7 +145,8 @@ if ('alternates reloaded') { } use_ok 'PublicInbox::Git', qw(git_unquote); -is("foo\nbar", git_unquote('"foo\\nbar"'.''), 'unquoted newline'); -is("Eléanor", git_unquote('"El\\303\\251anor"'.''), 'unquoted octal'); +my $s; +is("foo\nbar", git_unquote($s = '"foo\\nbar"'), 'unquoted newline'); +is("Eléanor", git_unquote($s = '"El\\303\\251anor"'), 'unquoted octal'); done_testing(); -- EW