simple_repro.sh #1

  • //
  • test-install_sdp/
  • dev/
  • os_bug_reports/
  • Ubuntu26_chown_POSIX_regressions/
  • simple_repro.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash

echo "Running on $(grep ^PRETTY_NAME /etc/os-release|cut -d'"' -f2)"
echo "TEST 1 - trailing colon syntax ignored"

rm -f ownergroup_test

echo touch ownergroup_test
touch ownergroup_test

echo ls -l ownergroup_test
ls -l ownergroup_test

echo chown perforce: ownergroup_test
chown perforce: ownergroup_test

echo ls -l ownergroup_test
ls -l ownergroup_test

Owner=$(stat -c %U ownergroup_test 2>/dev/null)
Group=$(stat -c %G ownergroup_test 2>/dev/null)

echo "The owner/group after 'chown perforce: ownergroup_test' should be perforce:perforce."
if [[ "$Owner":"$Group" == "perforce:perforce" ]]; then
   echo "PASS TEST 1: Ownership is correct."
else
   echo "FAIL TEST 1: Ownership is incorrect; it is $Owner:$Group."
fi

echo "TEST 2 - chown -h fails for symlink to directory"

rm -rf dir1
rm -f symlink_to_dir1
echo mkdir dir1
mkdir dir1

echo ln -s dir1 symlink_to_dir1
ln -s dir1 symlink_to_dir1

echo ls -ld dir1 symlink_to_dir1
ls -ld dir1 symlink_to_dir1

echo chown -h perforce symlink_to_dir1
chown -h perforce symlink_to_dir1

echo ls -ld dir1 symlink_to_dir1
ls -ld dir1 symlink_to_dir1

DirOwner=$(stat -c %U dir1 2>/dev/null)
LinkOwner=$(stat -c %U symlink_to_dir1 2>/dev/null)

echo "The owner of the symlink and dir after 'chown -h symlink_to_dir1' should be perforce (symlink) and root (dir), respectively."
if [[ "$LinkOwner":"$DirOwner" == "perforce:root" ]]; then
   echo "PASS TEST 2: Link and Dir Ownership is correct."
else
	echo "FAIL TEST 2: Link and Dir Ownership is incorrect; it is '$LinkOwner' (symlink) and '$DirOwner' (dir)."
fi
# Change User Description Committed
#1 33144 C. Thomas Tyler Initialized //test-install_sdp/dev with p4 populate -b test-install_sdp_Classic_to_Streams
//guest/tom_tyler/sw/main/install_sdp/dev/bin/os_bug_reports/Ubuntu26_chown_POSIX_regressions/simple_repro.sh
#2 33086 C. Thomas Tyler Added repro script and output.
#1 33085 C. Thomas Tyler Added simple repro script and log.