bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Not sure how to best reply re: dir_colors situation


From: Pádraig Brady
Subject: Re: Not sure how to best reply re: dir_colors situation
Date: Thu, 11 Jun 2009 11:32:42 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Hmm, it's worth adding a test at least to demonstrate that
file permissions take precedence over hardlink coloring
I.E. multi hardlinked png and exectuable files will be colored inconsistently.

diff attached.

cheers,
Pádraig.
>From 656b4273135e50746956dc04b47d1ed96f851d96 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden>
Date: Thu, 11 Jun 2009 11:34:21 +0100
Subject: [PATCH] tests: ls --color, permissions override hardlink coloring

* tests/ls/multihardlink: Add a test case to demonstrate
and test this non obvious behaviour.
---
 tests/ls/multihardlink |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/tests/ls/multihardlink b/tests/ls/multihardlink
index d237a71..815222d 100755
--- a/tests/ls/multihardlink
+++ b/tests/ls/multihardlink
@@ -27,10 +27,12 @@ working_umask_or_skip_
 touch file file1 || framework_failure
 ln file1 file2 || skip_test_ "can't create hard link"
 code_mh='44;37'
+code_ex='01;32'
 code_png='01;35'
 c0=$(printf '\033[0m')
 c_end=$(printf '\033[m')
 c_mh=$(printf '\033[%sm' $code_mh)
+c_ex=$(printf '\033[%sm' $code_ex)
 c_png=$(printf '\033[%sm' $code_png)
 fail=0
 
@@ -55,6 +57,16 @@ ${c_mh}file2.png$c0
 $c_end" > out_ok || framework_failure
 compare out out_ok || fail=1
 
+# hard links and exe (exe coloring takes precedence)
+chmod a+x file2.png || framework_failure
+LS_COLORS="mh=$code_mh:*.png=$code_png:ex=$code_ex" \
+  ls -U1 --color=always file1 file2.png > out || fail=1
+chmod a-x file2.png || framework_failure
+printf "$c0${c_ex}file1$c0
+${c_ex}file2.png$c0
+$c_end" > out_ok || framework_failure
+compare out out_ok || fail=1
+
 # hard links and png (hard link coloring disabled => png coloring enabled)
 LS_COLORS="mh=00:*.png=$code_png" ls -U1 --color=always file1 file2.png > out \
   || fail=1
-- 
1.5.3.6


reply via email to

[Prev in Thread] Current Thread [Next in Thread]