]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ls --color, permissions override hardlink coloring
authorPádraig Brady <P@draigBrady.com>
Thu, 11 Jun 2009 10:34:21 +0000 (11:34 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 11 Jun 2009 10:39:24 +0000 (11:39 +0100)
* tests/ls/multihardlink: Add a test case to demonstrate
and test this non obvious behavior.

tests/ls/multihardlink

index d237a71a9d23148583002c846477dc8e6bdb5ba1..815222db0cf015e0c491e5664134a35c9492f9c8 100755 (executable)
@@ -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