GNU bug report logs - #23422
stat -c %N returns strange results for file names including <TAB>

Previous Next

Package: coreutils;

Reported by: Michael Albinus <michael.albinus <at> gmx.de>

Date: Mon, 2 May 2016 09:29:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


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

From: Eric Blake <eblake <at> redhat.com>
To: Michael Albinus <michael.albinus <at> gmx.de>, 23422 <at> debbugs.gnu.org
Subject: Re: bug#23422: stat -c %N returns strange results for file names
 including <TAB>
Date: Mon, 2 May 2016 08:00:29 -0600
[Message part 1 (text/plain, inline)]
On 05/02/2016 03:27 AM, Michael Albinus wrote:
> Hi,
> 
> I have a file called "foo<TAB>bar". Yes, it includes the <TAB> char in
> its name. When I call "stat -c %N", I get 'foo'$'\t''bar' .

That is intentional; in the same vein as the way 'ls' changed its
default output for files with awkward characters.  The defaults are to
quote in a way that is reusable by shells that understand $'' quoting
(since POSIX will be adding support for it).  And you can always select
other quoting methods, via the QUOTING_STYLE environment variable.

Hmm, maybe 'stat' should gain a --quoting-style command line option to
override the env-var, the same way as is done in ls.  So on that
grounds, I'll leave this bug report open.

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

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

This bug report was last modified 8 years and 254 days ago.

Previous Next


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