TIME_STYLE format is implemented backwards
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
The TIME_STYLE format of ls seems to be implemented backwards, see #3625.
The docs say:
+FORMAT is interpreted like in date(1).
If FORMAT is FORMAT1 NEWLINE FORMAT2,
then FORMAT1 applies to non-recent (old) files and FORMAT2 to recent files.
In other words: OLD \n NEW.
I set the old_file file below to be very old with touch,
and then foo and foo2 with the time now.
I'm expecting the old ones have ISO 8601 format, while the new ones have a "human" format.
⏵ ls --version
ls (GNU coreutils) 9.7
...
⏵ command ls -a -l --time-style='+ %Y-%m-%d %k:%M
%a %b %d %k:%M'
-rw-r--r-- 1 username username 3771 2001-01-01 12:00 old_file
-rw-rw-r-- 1 username username 0 Sat Jun 06 18:29 foo
-rw-rw-r-- 1 username username 0 Sat Jun 06 18:32 foo2
# correct: old files are iso, recent files are human style
# switch
⏵ sudo apt-get remove coreutils-from-gnu --allow-remove-essential
...
⏵ ls --version
ls (uutils coreutils) 0.8.0
⏵ command ls -a -l --time-style='+ %Y-%m-%d %k:%M
%a %b %d %k:%M'
-rw-r--r-- 1 username username 3771 Mon Jan 01 12:00 old_file
-rw-rw-r-- 1 username username 0 2026-06-06 18:29 foo
-rw-rw-r-- 1 username username 0 2026-06-06 18:32 foo2
# backwards: old files are human, recent files are iso
Edit: forgot to mention this is on Ubuntu 26.04. Also changed bashrc filename to "old_file" for readability reasons.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Rust implementation of ls and its --time-style handling, then reproduce the command shown with an old file and recent files. Compare the implementation with the documented OLD newline NEW order; done means old files use the first format and recent files use the second.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100