GNU bug report logs - #8587
Curious bug.

Previous Next

Package: coreutils;

Reported by: Francois Boisson <francois <at> boisson.homeip.net>

Date: Fri, 29 Apr 2011 20:17:02 UTC

Severity: normal

Tags: notabug

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

Bug is archived. No further changes may be made.

Full log


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

From: Eric Blake <eblake <at> redhat.com>
To: Francois Boisson <francois <at> boisson.homeip.net>
Cc: 8587-done <at> debbugs.gnu.org
Subject: Re: bug#8587: Curious bug.
Date: Fri, 29 Apr 2011 14:53:35 -0600
[Message part 1 (text/plain, inline)]
tag 8587 notabug
close 8587
thanks

On 04/29/2011 01:09 PM, Francois Boisson wrote:
> On a debian squeeze amd64.
> 
> francois <at> totoche:~$ echo ABCD Directory | tr [:lower:] [:upper:] 
> ABCD DIRECTORY
> francois <at> totoche:~$ cd /tmp
> francois <at> totoche:/tmp$ echo ABCD Directory | tr [:lower:] [:upper:] 
> tr: construit [:upper:] et/ou [:lower:] mal aligné

Thanks for the report.  However, this is not a bug in tr, but in your
usage of the shell.

Unquoted, the expression (without "") "[:lower:]" is the glob that
expands to any of the existing files: ":", "l", "o", "w", "e", "r"; and
if none of those files exists, then the glob is passed verbatim to tr.
Your results differed depending on whether the directory you were in had
files by those names.

But if you had used shell quoting, as in "'[:lower:]'", then there would
be no chance for the shell to do globbing.  That is, you meant to do:

echo ABCD Directory | tr '[:lower:]' '[:upper:]'

and were only getting lucky that there weren't any one-character file
names in your first directory.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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

This bug report was last modified 14 years and 27 days ago.

Previous Next


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