Re: [PATCH] chown: fix ownership format string

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Mon, Apr 25, 2022 at 04:20:51PM +0800, Murphy Zhou wrote:
> After coreutils rebasing to 9.1, chown(1) behavior changes:
> "
>    chown and chroot now warn about usages like "chown root.root f",
>    which have the nonstandard and long-obsolete "." separator that
>    causes problems on platforms where user names contain ".".
>    Applications should use ":" instead of ".".
> "
> 
> https://lwn.net/Articles/891574/
> 
> With this behavior change, old format of ownership string will cause
> warning like this:
> "
> +chown: warning: '.' should be ':': '1000.1000'
> +.chown: warning: '.' should be ':': '1100.1100'
> +.chown: warning: '.' should be ':': '1200.1200'
> +.chown: warning: '.' should be ':': '1300.1300'
> +.chown: warning: '.' should be ':': '1400.1400'
> "
> 
> The new format works fine with old versions of coreutils.
> 
> Signed-off-by: Murphy Zhou <jencce.kernel@xxxxxxxxx>
> ---

Thanks for catching this new change early, this looks like a reasonable fix.
So chown would like to abandon "." separator in one day. As the ":" is
recommended by chown now, let xfstests follow it.

Reviewed-by: Zorro Lang <zlang@xxxxxxxxxx>

>  common/dump       | 6 +++---
>  tests/generic/099 | 4 ++--
>  tests/generic/237 | 2 +-
>  tests/generic/318 | 2 +-
>  tests/generic/380 | 2 +-
>  tests/generic/597 | 6 +++---
>  tests/generic/598 | 6 +++---
>  7 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/common/dump b/common/dump
> index ea16d442..44a9a708 100644
> --- a/common/dump
> +++ b/common/dump
> @@ -526,7 +526,7 @@ _do_create_dumpdir_fill()
>  	    fi
>  	fi
>  	if [ -n "$owner" -a -n "$group" ]; then
> -	    chown $owner.$group $file
> +	    chown $owner:$group $file
>  	fi
>  	if [ -n "$perms" ]; then
>  	    chmod $perms $file
> @@ -691,10 +691,10 @@ _do_create_dump_symlinks()
>  	fi
>  
>  	if [ -n "$owner" -a -n "$group" ]; then
> -	    chown $owner.$group $file
> +	    chown $owner:$group $file
>  	fi
>  	if [ -n "$owner" -a -n "$group" ]; then
> -	    chown -h $owner.$group $file-link
> +	    chown -h $owner:$group $file-link
>  	fi
>  	if [ -n "$perms" ]; then
>  	    chmod $perms $file
> diff --git a/tests/generic/099 b/tests/generic/099
> index 6ba04dd8..5cdac9ab 100755
> --- a/tests/generic/099
> +++ b/tests/generic/099
> @@ -74,7 +74,7 @@ EOF
>  chmod u=rwx file1
>  chmod g=rw- file1
>  chmod o=r-- file1
> -chown $acl1.$acl2 file1
> +chown $acl1:$acl2 file1
>  _acl_ls file1
>  
>  echo ""
> @@ -264,7 +264,7 @@ do
>  	touch a/$i/mumble
>  done
>  popd >/dev/null
> -chown -R 12345.54321 root
> +chown -R 12345:54321 root
>  echo "Change #1..."
>  _runas -u 12345 -g 54321 -- chacl -r u::rwx,g::-w-,o::--x root
>  find root -print | sort | xargs chacl -l
> diff --git a/tests/generic/237 b/tests/generic/237
> index 93eafd84..f17e32e4 100755
> --- a/tests/generic/237
> +++ b/tests/generic/237
> @@ -38,7 +38,7 @@ mkdir $seq.dir1
>  cd $seq.dir1
>  
>  touch file1
> -chown $acl1.$acl1 file1
> +chown $acl1:$acl1 file1
>  
>  echo "Expect to FAIL"
>  _runas -u $acl2 -g $acl2 -- setfacl -m u::rwx file1 2>&1 | sed 's/^setfacl: \/.*file1: Operation not permitted$/setfacl: file1: Operation not permitted/'
> diff --git a/tests/generic/318 b/tests/generic/318
> index 5edc9f35..ed50818a 100755
> --- a/tests/generic/318
> +++ b/tests/generic/318
> @@ -72,7 +72,7 @@ _scratch_mkfs       >>$seqres.full 2>&1 || _fail "mkfs failed"
>  _scratch_mount
>  
>  touch $file
> -chown $acl1.$acl1 $file
> +chown $acl1:$acl1 $file
>  
>  # set acls from init_user_ns, to be checked from inside the userns
>  setfacl -n -m u:$acl2:rw,g:$acl2:r $file
> diff --git a/tests/generic/380 b/tests/generic/380
> index 4993dad0..21b789dd 100755
> --- a/tests/generic/380
> +++ b/tests/generic/380
> @@ -35,7 +35,7 @@ _chowning_file()
>  	let count=$start
>  	while (( count < limit )); do
>  	    touch $file
> -	    chown $count.$count $file
> +	    chown $count:$count $file
>  	    echo -n "."
>  	    let count=count+delta
>  	done
> diff --git a/tests/generic/597 b/tests/generic/597
> index aa93237e..ff985ca6 100755
> --- a/tests/generic/597
> +++ b/tests/generic/597
> @@ -46,8 +46,8 @@ HARDLINK_PROTECTION=`sysctl -n fs.protected_hardlinks`
>  test_symlink()
>  {
>  	ln -s $TEST_DIR/$seq/target $TEST_DIR/$seq/sticky_dir/symlink
> -	chown $OTHER.$OTHER $TEST_DIR/$seq/sticky_dir
> -	chown $OWNER.$OWNER $TEST_DIR/$seq/sticky_dir/symlink
> +	chown $OTHER:$OTHER $TEST_DIR/$seq/sticky_dir
> +	chown $OWNER:$OWNER $TEST_DIR/$seq/sticky_dir/symlink
>  	# If we can read the target, we followed the link
>  	_user_do "cat $TEST_DIR/$seq/sticky_dir/symlink" | _filter_test_dir
>  	rm -f $TEST_DIR/$seq/sticky_dir/symlink
> @@ -55,7 +55,7 @@ test_symlink()
>  
>  test_hardlink()
>  {
> -	chown $OWNER.$OWNER $TEST_DIR/$seq/target
> +	chown $OWNER:$OWNER $TEST_DIR/$seq/target
>  	chmod go-rw $TEST_DIR/$seq/target
>  	_user_do "ln $TEST_DIR/$seq/target $TEST_DIR/$seq/sticky_dir/hardlink" \
>  		| _filter_test_dir
> diff --git a/tests/generic/598 b/tests/generic/598
> index 160e6d4b..769c1b1a 100755
> --- a/tests/generic/598
> +++ b/tests/generic/598
> @@ -64,16 +64,16 @@ setup_tree()
>  	mkdir -p $TEST_DIR/$seq
>  	mkdir -p $TEST_DIR/$seq/sticky_dir
>  	chmod 1777 $TEST_DIR/$seq/sticky_dir
> -	chown $USER2.$USER2 $TEST_DIR/$seq/sticky_dir
> +	chown $USER2:$USER2 $TEST_DIR/$seq/sticky_dir
>  
>  	# Create file & fifo in that dir owned by $USER1, and open
>  	# normal read/write privs for world & group
>  	$XFS_IO_PROG -c "open -f $TEST_DIR/$seq/sticky_dir/file"
> -	chown $USER1.$USER1 $TEST_DIR/$seq/sticky_dir/file
> +	chown $USER1:$USER1 $TEST_DIR/$seq/sticky_dir/file
>  	chmod o+rw $TEST_DIR/$seq/sticky_dir/file
>  
>  	mkfifo $TEST_DIR/$seq/sticky_dir/fifo
> -	chown $USER1.$USER1 $TEST_DIR/$seq/sticky_dir/fifo
> +	chown $USER1:$USER1 $TEST_DIR/$seq/sticky_dir/fifo
>  	chmod o+rw $TEST_DIR/$seq/sticky_dir/fifo
>  }
>  
> -- 
> 2.27.0
> 



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux