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


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Michael Albinus <michael.albinus <at> gmx.de>, Eric Blake <eblake <at> redhat.com>
Cc: 23422 <at> debbugs.gnu.org
Subject: bug#23422: stat -c %N returns strange results for file names including <TAB>
Date: Mon, 2 May 2016 16:44:38 +0100
On 02/05/16 15:27, Michael Albinus wrote:
> Eric Blake <eblake <at> redhat.com> writes:
>
> Hi Eric,
>
>>> 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.
>
> Thanks for the hint with QUOTING_STYLE. However, it doesn't work for me:
>
> # env QUOTING_STYLE=escape /usr/bin/stat -c %N /tmp/foo*
> '/tmp/foo'$'\t''bar'

Right, stat currently hard codes the "shell" style.
It probably makes sense to have this configurable.
I'll do that for the next release.

thanks,
Pádraig.





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

Previous Next


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