public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Kevin Daudt <me@ikke•info>
To: Matheus Tavares <matheus.bernardino@usp•br>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] t4129: don't fail if setgid is set in the parent directory
Date: Wed, 30 Dec 2020 22:05:51 +0100	[thread overview]
Message-ID: <X+zrryp6ndOa5rOM@alpha> (raw)
In-Reply-To: <88398ff952a68e8d134dcd50ef0772bb6fc3b456.1609339792.git.matheus.bernardino@usp.br>

On Wed, Dec 30, 2020 at 11:52:25AM -0300, Matheus Tavares wrote:
> The last test of t4129 creates a directory and expects its setgid bit
> (g+s) to be off. But this makes the test fail when the parent directory
> has the bit set, as setgid's state is inherited by newly created
> subdirectories. Make the test more robust by accepting the presence of
> the setgid bit on the created directory. We only allow 'S' (setgid on
> but no executable permission) and not 's' (setgid on with executable
> permission) because the previous 'umask 0077' shouldn't allow the second
> scenario to happen.
> 
> Note that only subdirectories inherit this bit, so we don't have to make
> the same change for the regular file that is also created by this test.
> But checking the permissions using grep instead of test_cmp makes the
> test a little simpler, so let's use it for the regular file as well.
> 
> Also note that the sticky bit (+t) and the setuid bit (u+s) are not
> inherited, so we don't have to worry about those.
> 
> Reported-by: Kevin Daudt <me@ikke•info>
> Signed-off-by: Matheus Tavares <matheus.bernardino@usp•br>
> ---
>  t/t4129-apply-samemode.sh | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/t/t4129-apply-samemode.sh b/t/t4129-apply-samemode.sh
> index 41818d8315..3818398ca9 100755
> --- a/t/t4129-apply-samemode.sh
> +++ b/t/t4129-apply-samemode.sh
> @@ -90,12 +90,10 @@ test_expect_success POSIXPERM 'do not use core.sharedRepository for working tree
>  		rm -rf d f1 &&
>  		git apply patch-f1-and-f2.txt &&
>  
> -		echo "-rw-------" >f1_mode.expected &&
> -		echo "drwx------" >d_mode.expected &&
> -		test_modebits f1 >f1_mode.actual &&
> -		test_modebits d >d_mode.actual &&
> -		test_cmp f1_mode.expected f1_mode.actual &&
> -		test_cmp d_mode.expected d_mode.actual
> +		test_modebits f1 >f1_mode &&
> +		test_modebits d >d_mode &&
> +		grep "^-rw-------$" f1_mode &&
> +		grep "^drwx--[-S]---$" d_mode
>  	)
>  '
>  
> -- 
> 2.29.2
> 

Tested-by: Kevin Daudt <me@ikke•info>

  reply	other threads:[~2020-12-30 21:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-30 12:05 t4129 failure when sticky bit set Kevin Daudt
2020-12-30 14:52 ` [PATCH] t4129: don't fail if setgid is set in the parent directory Matheus Tavares
2020-12-30 21:05   ` Kevin Daudt [this message]
2021-01-04 23:57   ` Junio C Hamano
2021-01-05 15:47   ` [PATCH v2] t4129: don't fail if setgid is set in the test directory Matheus Tavares
2021-01-06 23:59     ` Junio C Hamano
2021-01-09 14:19       ` Matheus Tavares Bernardino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X+zrryp6ndOa5rOM@alpha \
    --to=me@ikke$(echo .)info \
    --cc=git@vger$(echo .)kernel.org \
    --cc=matheus.bernardino@usp$(echo .)br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox