ls --color for hard links (wishlist)

Bug #123423 reported by Federico Poloni on 2007-07-01
This bug affects 1 person
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)

Bug Description

Binary package hint: coreutils

It would help if ls --color marked in some way files which have more than one copy hardlinked -- that is, those who are not directories and have the value in the second column (with ls -l) greater than 1. For example, the value in the second column (number of hard links) could be highlighted.

Matt Zimmerman (mdz) on 2007-07-01
Changed in coreutils:
importance: Undecided → Wishlist
Kamil Dudka (kdudka) wrote :

> So I propose to add new ls color attribute to highlight files with more than
> one hardlink. What do you think?

I see your point and I agree that it is better to highlight the filename
than the number of links.

Changing to a new color, though, would lead to a minor problem, consider
this example:

executable file = green
non-executable file = white
non-exec' file with multiple hard links = $(NEW_COLOR)
exec' file with multiple hard links = ??? green or $(NEW_COLOR) ???

Only one information could be displayed, and if we have to choose, I
think the executable bit is more important that the information on the
number of hard links.
This could be fixed by changing the background color instead. The ls
coloring code already has the capability to change background colors, so
this would be simpler. So we would have

executable file = green
non-executable file = white
non-exec' file with multiple hard links = green with $(NEW_BACKGROUND)
exec' file with multiple hard links = white with $(NEW_BACKGROUND)

But this could lead to poor readability for some text/background

Another possibility is changing attributes (bold/underscore/reverse),
but I am not sure how many terminals honor them. If they work on many
terminals, they could be the best choice.

Anyway, these were just my two cents, I am not an expert on this subject.
Thanks for your help and for your attention,


Kamil Dudka (kdudka) wrote :

Thank you for reply. Executable files should have higher priority than hard-linked files while highlighting. So in this case color of executable file is used. Theoretically you can have special color attribute for hard-linked executables, but this is not an usual case I think. As for the default color of hard-linked file, you can vote for it on bug-coreutils mailing list.

The patch was proposed upstream:

C de-Avillez (hggdh2) wrote :

Marking triaged, per Kamil's work. I was going to mark in progress, but I am not sure it would completely apply... We will keep an eye on it, anyway.

 BTW -- thank you, Kamil.

Changed in coreutils:
status: New → In Progress
status: In Progress → Triaged
C de-Avillez (hggdh2) wrote :

Marking as fix committed. Hopefully, we will get it on Jaunty.

Thanks (again ;-) Kamil.

Changed in coreutils:
status: Triaged → Fix Committed
Przemek K. (azrael) on 2009-12-14
Changed in coreutils (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers