]> git.saurik.com Git - apple/file_cmds.git/blame - tests/cp.sh
file_cmds-321.100.10.0.1.tar.gz
[apple/file_cmds.git] / tests / cp.sh
CommitLineData
867b3d41
A
1#!/bin/sh
2
3# Regression test for 69452380
4function regression_69452380()
5{
6 echo "Verifying that cp -p preserves symlink's attributes, rather than the attributes of the symlink's target."
7 test_dir=`mktemp -d /tmp/69452380_src_XXXX`
8 touch ${test_dir}/target
9 mkdir ${test_dir}/link_dir
10 # Create symlink (must use relative path for the failure to occur)
11 cd ${test_dir}/link_dir
12 ln -s ../target link
13 # cp (with attribute preservation) the test dir containing both the
14 # target and the link (in a subdirectory) to a new dir.
15 # Prior to 69452380, this failed because we followed the symlink to
16 # try and preserve attributes for a non-existing file, instead of
17 # preserving the attributes of the symlink itself.
18 cp -R -P -p ${test_dir} /tmp/69452380_tgt_${RANDOM}
19}
20
21set -eu -o pipefail
22
23regression_69452380