~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/cp/preserve-mode.sh

  • Committer: Colin Watson
  • Date: 2013-10-30 15:48:33 UTC
  • mfrom: (8.3.5 sid)
  • Revision ID: cjwatson@canonical.com-20131030154833-xdt6e1yfffqom1c4
merge from Debian 8.21-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
# ensure that cp's --no-preserve=mode works correctly
3
3
 
4
 
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
 
4
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
5
5
 
6
6
# This program is free software: you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License as published by
26
26
chmod 600 b
27
27
 
28
28
#regular file test
29
 
cp --no-preserve=mode b c
 
29
cp --no-preserve=mode b c || fail=1
30
30
mode_a=$(ls -l a | gawk '{print $1}')
31
31
mode_c=$(ls -l c | gawk '{print $1}')
32
32
test "$mode_a" = "$mode_c" || fail=1
36
36
chmod 705 d2
37
37
 
38
38
#directory test
39
 
cp --no-preserve=mode -r d2 d3
 
39
cp --no-preserve=mode -r d2 d3 || fail=1
40
40
mode_d1=$(ls -l d1 | gawk '{print $1}')
41
41
mode_d3=$(ls -l d3 | gawk '{print $1}')
42
42
test "$mode_d1" = "$mode_d3" || fail=1
46
46
chmod 600 a
47
47
 
48
48
#contradicting options test
49
 
cp --no-preserve=mode --preserve=all a b
 
49
cp --no-preserve=mode --preserve=all a b || fail=1
50
50
mode_a=$(ls -l a | gawk '{print $1}')
51
51
mode_b=$(ls -l b | gawk '{print $1}')
52
52
test "$mode_a" = "$mode_b" || fail=1