bug#79113: du --time-styles inconsistencies between manual and behaviour

Nicolas Boichat <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <CAM6NUi78nzxJUi9c3+c-S_qtWxZ6oaJy7Pg0S_o4Nt5sOGZ9Jw@mail.gmail.com>
On Tue, 29 Jul 2025 at 00:07, Pádraig Brady <[email protected]> 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,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.