Subject: Re: bug#16335: Segmentation fault when using cp -a with SELinux and fakeroot

From: Bernhard Voelker <[email-masked]>
Date: Tue, 14 Jan 2014 13:38:27 +0100

On 01/14/2014 12:35 PM, Pádraig Brady wrote:
> On 01/14/2014 10:54 AM, Bernhard Voelker wrote:
>> + test -e preloaded
>> + skip_ 'LD_PRELOAD interception failed'
> 
> Oh right. I think this should restrict the test appropriately...
> 
> commit 3620df245a2211dc441e019845f98b91333bda77
> Author: Pádraig Brady <[email-masked]>
> Date:   Tue Jan 14 11:30:51 2014 +0000
> 
>     tests: restrict a recent SELinux test to SELinux systems
> 
>     * tests/cp/no-ctx.sh: Since the test diagnoses whether the
>     intercepted lgetfilecon() calls are actually called or not,

The witness file is only created for getfilecon() - not for
lgetfilecon().

>     restrict the test to systems where that occurs.
>     The test cases are minimal on non SELinux systems and should
>     be well covered by other tests.
>     Reported-by: Bernhard Voelker
> 
> diff --git a/tests/cp/no-ctx.sh b/tests/cp/no-ctx.sh
> index 3b5eb82..6851785 100755
> --- a/tests/cp/no-ctx.sh
> +++ b/tests/cp/no-ctx.sh
> @@ -22,6 +22,7 @@
>  . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
>  print_ver_ cp
>  require_gcc_shared_
> +requires_selinux_
> 
>  # Replace each getfilecon and lgetfilecon call with a call to these stubs.
>  cat > k.c <<'EOF' || framework_failure_

I'm a bit biased about this patch. Okay, it's perfectly valid to
skip the test if the system doesn't support SELinux, but OTOH it may
be quite valuable to verify the exit codes like that on non-SELinux
systems, i.e., based on stderr of the last cp call, the "preloaded"
file must exist or not. The test could verify that. WDYT?

Thanks & have a nice day,
Berny