[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26631: tr: extra operand ‘\\\\’

From: Pádraig Brady
Subject: bug#26631: tr: extra operand ‘\\\\’
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

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]