maint: use single copyright year range
[coreutils/ericb.git] / tests / ls / color-dtype-dir
blob69dffd79c2b4a94aa879e7cb710a1aacda8ce20d
1 #!/bin/sh
2 # Ensure "ls --color" properly colors other-writable and sticky directories.
3 # Before coreutils-6.2, this test would fail, coloring all three
4 # directories the same as the first one -- but only on a file system
5 # with dirent.d_type support.
7 # Copyright (C) 2006-2012 Free Software Foundation, Inc.
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 . "${srcdir=.}/init.sh"; path_prepend_ ../src
23 print_ver_ ls
25 # Don't let a different umask perturb the results.
26 umask 22
28 mkdir d other-writable sticky || framework_failure_
29 chmod o+w other-writable || framework_failure_
30 chmod o+t sticky || framework_failure_
33 ls --color=always > out || fail=1
34 cat -A out > o1 || fail=1
35 mv o1 out || fail=1
37 cat <<\EOF > exp || fail=1
38 ^[[0m^[[01;34md^[[0m$
39 ^[[34;42mother-writable^[[0m$
40 out$
41 ^[[37;44msticky^[[0m$
42 EOF
44 compare exp out || fail=1
46 rm exp
48 # Turn off colors for other-writable dirs and ensure
49 # we fall back to the color for standard directories.
51 LS_COLORS="ow=:" ls --color=always > out || fail=1
52 cat -A out > o1 || fail=1
53 mv o1 out || fail=1
55 cat <<\EOF > exp || fail=1
56 ^[[0m^[[01;34md^[[0m$
57 ^[[01;34mother-writable^[[0m$
58 out$
59 ^[[37;44msticky^[[0m$
60 EOF
62 compare exp out || fail=1
64 Exit $fail