GNU bug report logs - #26631
tr: add safe-quoting when reporting operand errors

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Severity: wishlist; Reported by: 積丹尼 Dan Jacobson <jidanni@HIDDEN>; dated Sun, 23 Apr 2017 23:40:02 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Changed bug title to 'tr: add safe-quoting when reporting operand errors' from 'tr: extra operand ‘\\\\’' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 26631 <at> debbugs.gnu.org:


Received: (at 26631) by debbugs.gnu.org; 24 Apr 2017 03:51:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 23 23:51:47 2017
Received: from localhost ([127.0.0.1]:37022 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1d2V2R-0004b4-33
	for submit <at> debbugs.gnu.org; Sun, 23 Apr 2017 23:51:47 -0400
Received: from midir.magicbluesmoke.com ([82.195.144.46]:53626
 helo=mail.magicbluesmoke.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <P@HIDDEN>) id 1d2V2P-0004av-Gd
 for 26631 <at> debbugs.gnu.org; Sun, 23 Apr 2017 23:51:46 -0400
Received: from localhost.localdomain (mobile-166-170-42-62.mycingular.net
 [166.170.42.62])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 2E4D7988E;
 Mon, 24 Apr 2017 04:51:42 +0100 (IST)
Subject: =?UTF-8?Q?Re:_bug#26631:_tr:_extra_operand_=e2=80=98\\\\=e2=80=99?=
To: =?UTF-8?B?56mN5Li55bC8IERhbiBKYWNvYnNvbg==?= <jidanni@HIDDEN>,
 26631 <at> debbugs.gnu.org
References: <87o9vnhvkj.fsf@HIDDEN>
From: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@HIDDEN>
Message-ID: <75d2992b-5357-afbd-6795-af7e8a357cf0@HIDDEN>
Date: Sun, 23 Apr 2017 20:51:38 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <87o9vnhvkj.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 26631
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On 23/04/17 10:39, 積丹尼 Dan Jacobson wrote:
> $ tr -s x -d '\\'
> tr: extra operand ‘\\\\’
> Try 'tr --help' for more information.
> 
> I only gave '\\'.

That's a result of the quoting used,
the default mode add backslashes for some characters (including backslash).
Now you could argue that input params specified on the shell
should use shell quoting when being diagnosed.
If you change all those, then you're left with very few cases of quote(),
which suggests we should just switch to quotef() everywhere?
Using quotef() gives the following (note curly quotes are also not used):

  tr: extra operand '\\'

Note there are edge cases where shell quoting may be worse.
For example if you were trying to delete quotes, then:

  $ tr-before -s x -d "\"'"
  tr: extra operand ‘"'’

  $ tr-after -s x -d "\"'"
  tr: extra operand '"'\'''

Well maybe that's no worse, since neither diagnostic matches the input,
and I suppose the shell quoting has a better chance of matching the input
seeing as that's specified to a shell.

I'm leaning towards making that change.
I also remember Eric tentatively suggesting the same.

cheers,
Pádraig




Information forwarded to bug-coreutils@HIDDEN:
bug#26631; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Apr 2017 23:39:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 23 19:39:47 2017
Received: from localhost ([127.0.0.1]:36930 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1d2R6Z-0002h7-KT
	for submit <at> debbugs.gnu.org; Sun, 23 Apr 2017 19:39:47 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46224)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jidanni@HIDDEN>) id 1d2R6Y-0002gm-Cp
 for submit <at> debbugs.gnu.org; Sun, 23 Apr 2017 19:39:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <jidanni@HIDDEN>) id 1d2R6S-00033d-9p
 for submit <at> debbugs.gnu.org; Sun, 23 Apr 2017 19:39:41 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, DATE_IN_PAST_03_06, 
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:38541)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <jidanni@HIDDEN>) id 1d2R6S-00033Z-6q
 for submit <at> debbugs.gnu.org; Sun, 23 Apr 2017 19:39:40 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37195)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <jidanni@HIDDEN>) id 1d2R6R-0005AB-5v
 for bug-coreutils@HIDDEN; Sun, 23 Apr 2017 19:39:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <jidanni@HIDDEN>) id 1d2R6O-00033D-5E
 for bug-coreutils@HIDDEN; Sun, 23 Apr 2017 19:39:39 -0400
Received: from homie.mail.dreamhost.com ([208.97.132.208]:40000
 helo=homiemail-a2.g.dreamhost.com)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <jidanni@HIDDEN>) id 1d2R6N-00032s-U4
 for bug-coreutils@HIDDEN; Sun, 23 Apr 2017 19:39:36 -0400
Received: from homiemail-a2.g.dreamhost.com (localhost [127.0.0.1])
 by homiemail-a2.g.dreamhost.com (Postfix) with ESMTP id 57B5D280069
 for <bug-coreutils@HIDDEN>; Sun, 23 Apr 2017 16:39:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jidanni.org; h=from:to
 :subject:date:message-id:mime-version:content-type:
 content-transfer-encoding; s=jidanni.org; bh=YHskL40PJw13BukFPNT
 0H31/2PU=; b=iL+O2GWtCt3ZW6t5QCI10VEF89otOEjuIf36wYnXjqy4hDfI0cG
 vazAnmpkBD5WIsGaLBfoL5Xf7tv/Uinzs4eX5s/djKXifrAE9eU0xrkRpIFtm8fC
 WbQskHlExwIhe+b+UIoJKf3BtMH+3/SQ8fCutQlWiHM3+fJErGFxaZlA=
Received: from jidanni.org (122-118-147-184.dynamic-ip.hinet.net
 [122.118.147.184])
 (using TLSv1 with cipher AES256-SHA (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jidanni@HIDDEN)
 by homiemail-a2.g.dreamhost.com (Postfix) with ESMTPSA id 275EF280063
 for <bug-coreutils@HIDDEN>; Sun, 23 Apr 2017 16:39:31 -0700 (PDT)
From: =?utf-8?B?56mN5Li55bC8?= Dan Jacobson <jidanni@HIDDEN>
To: bug-coreutils@HIDDEN
Subject: tr: extra operand =?utf-8?B?4oCYXFxcXOKAmQ==?=
Date: Mon, 24 Apr 2017 01:39:56 +0800
Message-ID: <87o9vnhvkj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.9 (---)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

$ tr -s x -d '\\'
tr: extra operand =E2=80=98\\\\=E2=80=99
Try 'tr --help' for more information.

I only gave '\\'.




Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#26631; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.