GNU bug report logs - #79113
du --time-styles inconsistencies between manual and behaviour

Previous Next

Package: coreutils;

Reported by: Nicolas Boichat <nicolas <at> boichat.ch>

Date: Mon, 28 Jul 2025 14:45:02 UTC

Severity: normal

To reply to this bug, email your comments to 79113 AT debbugs.gnu.org.

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#79113; Package coreutils. (Mon, 28 Jul 2025 14:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Boichat <nicolas <at> boichat.ch>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 28 Jul 2025 14:45:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Boichat <nicolas <at> boichat.ch>
To: bug-coreutils <at> gnu.org
Subject: du --time-styles inconsistencies between manual and behaviour
Date: Mon, 28 Jul 2025 22:44:21 +0800
Hi,

Version: env du --version => du (GNU coreutils) 9.7
OS: archlinux, x86-64

The GNU coreutils manual says
(https://www.gnu.org/software/coreutils/manual/coreutils.html#index-_002d_002dtime_002dstyle-1):
- "You can specify the default value of the --time-style option with
the environment variable TIME_STYLE; if TIME_STYLE is not set the
default style is ‘long-iso’." -> yes
- "For compatibility with ls, if TIME_STYLE begins with ‘+’ and
contains a newline, the newline and any later characters are ignored;"

That does not match behaviour, newlines are just used as-is:
```
$ env du --time --time-style="$(printf "+xyz\nabc")" blob
96 xyz
abc blob
```

- "if TIME_STYLE begins with ‘posix-’ the ‘posix-’ is ignored; and if
TIME_STYLE is ‘locale’ it is ignored."

Also doesn't match, `posix-` is not allowed, `locale` is not allowed:
```
$ env du --time --time-style=posix-iso blob
du: invalid argument ‘posix-iso’ for ‘time style’
Valid arguments are:
  - ‘full-iso’
  - ‘long-iso’
  - ‘iso’
Try 'du --help' for more information.
$ env du --time --time-style=locale blob
du: invalid argument ‘locale’ for ‘time style’
Valid arguments are:
  - ‘full-iso’
  - ‘long-iso’
  - ‘iso’
Try 'du --help' for more information.
```

Finally, the help text doesn't mention that +FORMAT is allowed.

Thanks!

Nicolas




Information forwarded to bug-coreutils <at> gnu.org:
bug#79113; Package coreutils. (Mon, 28 Jul 2025 16:08:01 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Nicolas Boichat <nicolas <at> boichat.ch>, 79113 <at> debbugs.gnu.org
Subject: Re: bug#79113: du --time-styles inconsistencies between manual and
 behaviour
Date: Mon, 28 Jul 2025 17:07:24 +0100
tag 79113 notabug
close 79113
stop

On 28/07/2025 15:44, Nicolas Boichat wrote:
> Hi,
> 
> Version: env du --version => du (GNU coreutils) 9.7
> OS: archlinux, x86-64
> 
> The GNU coreutils manual says
> (https://www.gnu.org/software/coreutils/manual/coreutils.html#index-_002d_002dtime_002dstyle-1):
> - "You can specify the default value of the --time-style option with
> the environment variable TIME_STYLE; if TIME_STYLE is not set the
> default style is ‘long-iso’." -> yes
> - "For compatibility with ls, if TIME_STYLE begins with ‘+’ and
> contains a newline, the newline and any later characters are ignored;"

Copying the full docs for this from the texinfo:

  "You can specify the default value of the @option{--time-style} option
  with the environment variable @env{TIME_STYLE}; if @env{TIME_STYLE} is not set
  the default style is @samp{long-iso}.  For compatibility with @command{ls},
  if @env{TIME_STYLE} begins with @samp{+} and contains a newline,
  the newline and any later characters are ignored; if @env{TIME_STYLE}
  begins with @samp{posix-} the @samp{posix-} is ignored; and if
  @env{TIME_STYLE} is @samp{locale} it is ignored."

That quite clearly states the above compat handling
is for the TIME_STYLE env var, and not the --time-style option itself.

> 
> That does not match behaviour, newlines are just used as-is:
> ```
> $ env du --time --time-style="$(printf "+xyz\nabc")" blob
> 96 xyz
> abc blob
> ```

> Finally, the help text doesn't mention that +FORMAT is allowed.

Copying from the texinfo again:

  "List timestamps using @var{format}, where @var{format} is interpreted
  like the format argument of @command{date} (@pxref{date invocation}).
  For example, @option{--time-style="+%Y-%m-%d %H:%M:%S"} causes
  @command{du} to list timestamps like @samp{2020-07-21 23:45:56}.  As
  with @command{date}, @var{format}'s interpretation is affected by the
  @env{LC_TIME} locale category."

thanks,
Padraig




Information forwarded to bug-coreutils <at> gnu.org:
bug#79113; Package coreutils. (Mon, 28 Jul 2025 17:51:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Boichat <nicolas <at> boichat.ch>
To: Pádraig Brady <P <at> draigbrady.com>
Cc: 79113 <at> debbugs.gnu.org
Subject: Re: bug#79113: du --time-styles inconsistencies between manual and
 behaviour
Date: Tue, 29 Jul 2025 01:49:49 +0800
On Tue, 29 Jul 2025 at 00:07, Pádraig Brady <P <at> draigbrady.com> wrote:
>
> tag 79113 notabug
> close 79113
> stop
>
> On 28/07/2025 15:44, Nicolas Boichat wrote:
> > Hi,
> >
> > Version: env du --version => du (GNU coreutils) 9.7
> > OS: archlinux, x86-64
> >
> > The GNU coreutils manual says
> > (https://www.gnu.org/software/coreutils/manual/coreutils.html#index-_002d_002dtime_002dstyle-1):
> > - "You can specify the default value of the --time-style option with
> > the environment variable TIME_STYLE; if TIME_STYLE is not set the
> > default style is ‘long-iso’." -> yes
> > - "For compatibility with ls, if TIME_STYLE begins with ‘+’ and
> > contains a newline, the newline and any later characters are ignored;"
>
> Copying the full docs for this from the texinfo:
>
>    "You can specify the default value of the @option{--time-style} option
>    with the environment variable @env{TIME_STYLE}; if @env{TIME_STYLE} is not set
>    the default style is @samp{long-iso}.  For compatibility with @command{ls},
>    if @env{TIME_STYLE} begins with @samp{+} and contains a newline,
>    the newline and any later characters are ignored; if @env{TIME_STYLE}
>    begins with @samp{posix-} the @samp{posix-} is ignored; and if
>    @env{TIME_STYLE} is @samp{locale} it is ignored."
>
> That quite clearly states the above compat handling
> is for the TIME_STYLE env var, and not the --time-style option itself.

Oh, thanks, I obviously misread that and the intent. Makes sense, thanks.

> >
> > That does not match behaviour, newlines are just used as-is:
> > ```
> > $ env du --time --time-style="$(printf "+xyz\nabc")" blob
> > 96 xyz
> > abc blob
> > ```
>
> > Finally, the help text doesn't mention that +FORMAT is allowed.
>
> Copying from the texinfo again:

I could have been clearer for this last one, I mean that the command
line error text for `du` could mention that +FORMAT is supported:

Comparing du and ls output with a bad timestyle:
```
$ du --time --time-style=xyz blob
du: invalid argument ‘xyz’ for ‘time style’
Valid arguments are:
  - ‘full-iso’
  - ‘long-iso’
  - ‘iso’
>>>>> it would be nice to add `- +FORMAT (e.g., +%H:%M) for a 'date'-style format` here
Try 'du --help' for more information.
$ ls -l --time-style=xyz blob
ls: invalid argument ‘xyz’ for ‘time style’
Valid arguments are:
  - [posix-]full-iso
  - [posix-]long-iso
  - [posix-]iso
  - [posix-]locale
  - +FORMAT (e.g., +%H:%M) for a 'date'-style format
Try 'ls --help' for more information.
```

Thanks,




Information forwarded to bug-coreutils <at> gnu.org:
bug#79113; Package coreutils. (Mon, 28 Jul 2025 19:14:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Nicolas Boichat <nicolas <at> boichat.ch>
Cc: 79113 <at> debbugs.gnu.org
Subject: Re: bug#79113: du --time-styles inconsistencies between manual and
 behaviour
Date: Mon, 28 Jul 2025 20:13:21 +0100
On 28/07/2025 18:49, Nicolas Boichat wrote:
> I could have been clearer for this last one, I mean that the command
> line error text for `du` could mention that +FORMAT is supported:
> 
> Comparing du and ls output with a bad timestyle:
> ```
> $ du --time --time-style=xyz blob
> du: invalid argument ‘xyz’ for ‘time style’
> Valid arguments are:
>    - ‘full-iso’
>    - ‘long-iso’
>    - ‘iso’
>>>>>> it would be nice to add `- +FORMAT (e.g., +%H:%M) for a 'date'-style format` here
> Try 'du --help' for more information.
> $ ls -l --time-style=xyz blob
> ls: invalid argument ‘xyz’ for ‘time style’
> Valid arguments are:
>    - [posix-]full-iso
>    - [posix-]long-iso
>    - [posix-]iso
>    - [posix-]locale
>    - +FORMAT (e.g., +%H:%M) for a 'date'-style format
> Try 'ls --help' for more information.
> ```

Oh right.
I'll refactor the code that prints the ls and du errors in this case.

cheers,
Padraig




Information forwarded to bug-coreutils <at> gnu.org:
bug#79113; Package coreutils. (Mon, 28 Jul 2025 22:13:01 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Nicolas Boichat <nicolas <at> boichat.ch>
Cc: 79113 <at> debbugs.gnu.org
Subject: Re: bug#79113: du --time-styles inconsistencies between manual and
 behaviour
Date: Mon, 28 Jul 2025 23:11:58 +0100
[Message part 1 (text/plain, inline)]
On 28/07/2025 20:13, Pádraig Brady wrote:
> On 28/07/2025 18:49, Nicolas Boichat wrote:
>> I could have been clearer for this last one, I mean that the command
>> line error text for `du` could mention that +FORMAT is supported:
>>
>> Comparing du and ls output with a bad timestyle:
>> ```
>> $ du --time --time-style=xyz blob
>> du: invalid argument ‘xyz’ for ‘time style’
>> Valid arguments are:
>>     - ‘full-iso’
>>     - ‘long-iso’
>>     - ‘iso’
>>>>>>> it would be nice to add `- +FORMAT (e.g., +%H:%M) for a 'date'-style format` here
>> Try 'du --help' for more information.
>> $ ls -l --time-style=xyz blob
>> ls: invalid argument ‘xyz’ for ‘time style’
>> Valid arguments are:
>>     - [posix-]full-iso
>>     - [posix-]long-iso
>>     - [posix-]iso
>>     - [posix-]locale
>>     - +FORMAT (e.g., +%H:%M) for a 'date'-style format
>> Try 'ls --help' for more information.
>> ```
> 
> Oh right.
> I'll refactor the code that prints the ls and du errors in this case.
> 

Will push the attached later.

cheers,
Padraig
[du-time-style-diags.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#79113; Package coreutils. (Tue, 29 Jul 2025 03:54:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Boichat <nicolas <at> boichat.ch>
To: Pádraig Brady <P <at> draigbrady.com>
Cc: 79113 <at> debbugs.gnu.org
Subject: Re: bug#79113: du --time-styles inconsistencies between manual and
 behaviour
Date: Tue, 29 Jul 2025 11:53:08 +0800
On Tue, 29 Jul 2025 at 06:12, Pádraig Brady <P <at> draigbrady.com> wrote:
>
> On 28/07/2025 20:13, Pádraig Brady wrote:
> > On 28/07/2025 18:49, Nicolas Boichat wrote:
> >> I could have been clearer for this last one, I mean that the command
> >> line error text for `du` could mention that +FORMAT is supported:
> >>
> >> Comparing du and ls output with a bad timestyle:
> >> ```
> >> $ du --time --time-style=xyz blob
> >> du: invalid argument ‘xyz’ for ‘time style’
> >> Valid arguments are:
> >>     - ‘full-iso’
> >>     - ‘long-iso’
> >>     - ‘iso’
> >>>>>>> it would be nice to add `- +FORMAT (e.g., +%H:%M) for a 'date'-style format` here
> >> Try 'du --help' for more information.
> >> $ ls -l --time-style=xyz blob
> >> ls: invalid argument ‘xyz’ for ‘time style’
> >> Valid arguments are:
> >>     - [posix-]full-iso
> >>     - [posix-]long-iso
> >>     - [posix-]iso
> >>     - [posix-]locale
> >>     - +FORMAT (e.g., +%H:%M) for a 'date'-style format
> >> Try 'ls --help' for more information.
> >> ```
> >
> > Oh right.
> > I'll refactor the code that prints the ls and du errors in this case.
> >
>
> Will push the attached later.

Thanks!

>
> cheers,
> Padraig




This bug report was last modified 18 days ago.

Previous Next


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