GNU bug report logs - #17121
tr result is different when executed in /usr/bin

Previous Next

Package: coreutils;

Reported by: Benoît DUNAND-LAISIN <benoit.dunand-laisin <at> prologism.fr>

Date: Thu, 27 Mar 2014 15:49:01 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17121 in the body.
You can then email your comments to 17121 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#17121; Package coreutils. (Thu, 27 Mar 2014 15:49:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Benoît DUNAND-LAISIN <benoit.dunand-laisin <at> prologism.fr>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 27 Mar 2014 15:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Benoît DUNAND-LAISIN
 <benoit.dunand-laisin <at> prologism.fr>
To: bug-coreutils <at> gnu.org
Subject: tr result is different when executed in /usr/bin
Date: Thu, 27 Mar 2014 10:43:29 +0100
[Message part 1 (text/plain, inline)]
Problem discovered in tr (GNU coreutils) 8.13 on a Ubuntu 12.04.

Running those commands:

cd $HOME
echo "Linux" | tr [:upper:] [:lower:]

will result: linux

Running the same from /usr/bin:

cd /usr/bin
echo "Linux" | tr [:upper:] [:lower:]

will result: winux
which is obviously a bad answer.

In debug mode:

sh -xc "echo "Linux" | tr [:upper:] [:lower:]"
+ echo Linux
+ tr [:upper:] w
winux

Regards.
[Message part 2 (text/html, inline)]

Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Thu, 27 Mar 2014 16:07:01 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Thu, 27 Mar 2014 16:07:02 GMT) Full text and rfc822 format available.

Notification sent to Benoît DUNAND-LAISIN <benoit.dunand-laisin <at> prologism.fr>:
bug acknowledged by developer. (Thu, 27 Mar 2014 16:07:04 GMT) Full text and rfc822 format available.

Message #12 received at 17121-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Benoît DUNAND-LAISIN
 <benoit.dunand-laisin <at> prologism.fr>, 17121-done <at> debbugs.gnu.org
Subject: Re: bug#17121: tr result is different when executed in /usr/bin
Date: Thu, 27 Mar 2014 10:06:41 -0600
[Message part 1 (text/plain, inline)]
tag 17121 notabug
thanks

On 03/27/2014 03:43 AM, Benoît DUNAND-LAISIN wrote:
> Problem discovered in tr (GNU coreutils) 8.13 on a Ubuntu 12.04.
> 
> Running those commands:
> 
> cd $HOME
> echo "Linux" | tr [:upper:] [:lower:]

Underquoted.  Run:

echo [:upper:] [:lower:]

and then

echo "[:upper:]" "[:lower:]"

in the two directories to spot the difference.  (Hint - in one of your
two directories, a shell glob is matching a one-byte file name)

As this is user error and not a bug in tr, I'm marking this bug as
closed, but feel free to add more comments if you still need help
understanding the issue.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#17121; Package coreutils. (Thu, 27 Mar 2014 16:47:02 GMT) Full text and rfc822 format available.

Message #15 received at 17121 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: 17121 <at> debbugs.gnu.org, eblake <at> redhat.com, 
 benoit.dunand-laisin <at> prologism.fr
Subject: Re: bug#17121: tr result is different when executed in /usr/bin
Date: Thu, 27 Mar 2014 17:46:23 +0100
On 03/27/2014 05:06 PM, Eric Blake wrote:
>> echo "Linux" | tr [:upper:] [:lower:]
>
> Underquoted.  Run:
>
> echo [:upper:] [:lower:]
>
> and then
>
> echo "[:upper:]" "[:lower:]"
>
> in the two directories to spot the difference.  (Hint - in one of your
> two directories, a shell glob is matching a one-byte file name)

FWIW: here, the 'w' program comes from the 'procps' package:

  $ ls -l /usr/bin/[:lower:]
  -rwxr-xr-x 1 root root 18896 Dec 17 16:58 /usr/bin/w

  $ /usr/bin/w --version
  w from procps-ng 3.3.8

Have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#17121; Package coreutils. (Thu, 27 Mar 2014 16:54:02 GMT) Full text and rfc822 format available.

Message #18 received at 17121 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Benoît DUNAND-LAISIN <benoit.dunand-laisin <at> prologism.fr>
Cc: 17121 <at> debbugs.gnu.org
Subject: Re: bug#17121: tr result is different when executed in /usr/bin
Date: Thu, 27 Mar 2014 16:00:29 +0000
tag 17121 notabug
close 17121
stop

On 03/27/2014 09:43 AM, Benoît DUNAND-LAISIN wrote:
> Problem discovered in tr (GNU coreutils) 8.13 on a Ubuntu 12.04.
> 
> Running those commands:
> 
> cd $HOME
> echo "Linux" | tr [:upper:] [:lower:]
> 
> will result: linux
> 
> Running the same from /usr/bin:
> 
> cd /usr/bin
> echo "Linux" | tr [:upper:] [:lower:]
> 
> will result: winux
> which is obviously a bad answer.
> 
> In debug mode:
> 
> sh -xc "echo "Linux" | tr [:upper:] [:lower:]"
> + echo Linux
> + tr [:upper:] w
> winux

You debugged correctly but failed to see that
tr was getting passed the wrong options. See 'w' above.
That's because the shell is interpreting the [...]
You need to quote it:

$ echo 'Linux' | tr '[:upper:]' '[:lower:]'

thanks,
Pádraig.

p.s. cd without the $HOME changes to the home directory




Information forwarded to bug-coreutils <at> gnu.org:
bug#17121; Package coreutils. (Fri, 28 Mar 2014 11:14:01 GMT) Full text and rfc822 format available.

Message #21 received at 17121 <at> debbugs.gnu.org (full text, mbox):

From: Benoît DUNAND-LAISIN
 <benoit.dunand-laisin <at> prologism.fr>
To: Pádraig Brady <P <at> draigbrady.com>, 
 mail <at> bernhard-voelker.de, eblake <at> redhat.com
Cc: 17121 <at> debbugs.gnu.org
Subject: Re: bug#17121: tr result is different when executed in /usr/bin
Date: Fri, 28 Mar 2014 12:13:48 +0100
[Message part 1 (text/plain, inline)]
Thanks for your explanations.

Regards,
Benoit


2014-03-27 17:00 GMT+01:00 Pádraig Brady <P <at> draigbrady.com>:

> tag 17121 notabug
> close 17121
> stop
>
> On 03/27/2014 09:43 AM, Benoît DUNAND-LAISIN wrote:
> > Problem discovered in tr (GNU coreutils) 8.13 on a Ubuntu 12.04.
> >
> > Running those commands:
> >
> > cd $HOME
> > echo "Linux" | tr [:upper:] [:lower:]
> >
> > will result: linux
> >
> > Running the same from /usr/bin:
> >
> > cd /usr/bin
> > echo "Linux" | tr [:upper:] [:lower:]
> >
> > will result: winux
> > which is obviously a bad answer.
> >
> > In debug mode:
> >
> > sh -xc "echo "Linux" | tr [:upper:] [:lower:]"
> > + echo Linux
> > + tr [:upper:] w
> > winux
>
> You debugged correctly but failed to see that
> tr was getting passed the wrong options. See 'w' above.
> That's because the shell is interpreting the [...]
> You need to quote it:
>
> $ echo 'Linux' | tr '[:upper:]' '[:lower:]'
>
> thanks,
> Pádraig.
>
> p.s. cd without the $HOME changes to the home directory
>
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 25 Apr 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 61 days ago.

Previous Next


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