"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: applying patches loses the original perms
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Sat, 2 Jul 2022 23:05:13 +0200

Download raw body.

Thread
On Sat, Jul 02, 2022 at 10:47:29PM +0200, Omar Polo wrote:
> Stefan reported on IRC that applying the jrick' ssh key signing patch
> with 'got patch' loses the executable bits in regress/cmdline/tag.sh.
> 
> The issue was introduced with the diff3 merge machinery.  To save an
> fstat, I'm looking at the permission of the "old file" in patch_file.
> The issue is that with the diff3 machinery in, patch_file is called with
> a temp file and so we look at the wrong mode.
> 
> Diff below fixes the issue by looking at the mode of the old file
> earlier in apply_patch right after opening it, and adds a regress for
> it.

Ok! Thanks for the quick fix. One question below:

> @@ -1507,7 +1508,15 @@ test_patch_merge_simple() {
>  	ret=$?
>  	if [ $ret -ne 0 ]; then
>  		diff -u $testroot/wt/numbers $testroot/wt/numbers.expected
> +		test_done $testroot $ret
> +		return 1
>  	fi
> +
> +	[ -x $testroot/wt/numbers ]

Mabye Unix shell pros like naddy would prefer 'test -x' above, instead
of the '[' alias for 'test'?

> +	ret=$?
> +	if [ $ret -ne 0 ]; then
> +		echo "numbers lost the executable bit" >&2
> +	fi
>  	test_done $testroot $ret
>  }
>  
> 
>