diff mbox series

[v2,2/4] common: hide permision warning from mkswap for exfat

Message ID 20210330220005.56019-3-preichl@redhat.com (mailing list archive)
State New, archived
Headers show
Series Fix some tests that fail for exfat FS | expand

Commit Message

Pavel Reichl March 30, 2021, 10 p.m. UTC
exfat does not support posix file permisions, so warning from mkswap is
inavitable. This patch hides the warning message so the test won't fail.

Signed-off-by: Pavel Reichl <preichl@redhat.com>
---
 common/rc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Eric Sandeen April 7, 2021, 5:03 p.m. UTC | #1
On 3/30/21 5:00 PM, Pavel Reichl wrote:
> exfat does not support posix file permisions, so warning from mkswap is
> inavitable. This patch hides the warning message so the test won't fail.
> 
> Signed-off-by: Pavel Reichl <preichl@redhat.com>

hah, I never even thought about swap on exfat ;)

Assuming it actually works other than this warning, maybe you don't need to
special case it for exfat? If so just filter that warning for everyone (in the
same way that the CHATTR isn't special cased for btrfs; we just ignore
failures there, because they don't matter).

If there's a real need to special case exfat that's fine, but it might
be better to not litter special cases around if they aren't material
to the test.

also, maybe there is some risk to 2>&1 >> seqres "eating" any other
potential errors? Or maybe my bash fu is weak. ;)

I /think/ this will do the trick but give it a shot. It should filter only
the one string from stderr, and send all of stdout to $seqres.full

# Ignore permission complaints on filesystems that don't support perms
$MKSWAP_PROG "$fname" 2> >(grep -v 'insecure permission' >&2) >> $seqres.full

-Eric

> ---
>  common/rc | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/common/rc b/common/rc
> index 9cdfe21c..2d658711 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2392,7 +2392,13 @@ _format_swapfile() {
>  	# Swap files must be nocow on Btrfs.
>  	$CHATTR_PROG +C "$fname" > /dev/null 2>&1
>  	_pwrite_byte 0x61 0 "$sz" "$fname" >> $seqres.full
> -	$MKSWAP_PROG "$fname" >> $seqres.full
> +	if [ "$FSTYP" = "exfat" ]; then
> +		# exfat does not support posix file permisions, so warning is
> +		# to be expected
> +		$MKSWAP_PROG "$fname" 2>&1 | grep -v 'insecure permission' >> $seqres.full
> +	else
> +		$MKSWAP_PROG "$fname" >> $seqres.full
> +	fi
>  }
>  
>  # Check that the filesystem supports swapfiles
>
Pavel Reichl April 15, 2021, 9:15 a.m. UTC | #2
On 4/7/21 7:03 PM, Eric Sandeen wrote:
> On 3/30/21 5:00 PM, Pavel Reichl wrote:
>> exfat does not support posix file permisions, so warning from mkswap is
>> inavitable. This patch hides the warning message so the test won't fail.
>>
>> Signed-off-by: Pavel Reichl <preichl@redhat.com>
> 
> hah, I never even thought about swap on exfat ;)
> 
> Assuming it actually works other than this warning, maybe you don't need to
> special case it for exfat? If so just filter that warning for everyone (in the
> same way that the CHATTR isn't special cased for btrfs; we just ignore
> failures there, because they don't matter).
> 
> If there's a real need to special case exfat that's fine, but it might
> be better to not litter special cases around if they aren't material
> to the test.
> 
> also, maybe there is some risk to 2>&1 >> seqres "eating" any other
> potential errors? Or maybe my bash fu is weak. ;)
> 
> I /think/ this will do the trick but give it a shot. It should filter only
> the one string from stderr, and send all of stdout to $seqres.full
> 
> # Ignore permission complaints on filesystems that don't support perms
> $MKSWAP_PROG "$fname" 2> >(grep -v 'insecure permission' >&2) >> $seqres.full

Works nice, thanks for the hint.

I also applied these comments on patch #3.


> 
> -Eric
> 
>> ---
>>  common/rc | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/rc b/common/rc
>> index 9cdfe21c..2d658711 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -2392,7 +2392,13 @@ _format_swapfile() {
>>  	# Swap files must be nocow on Btrfs.
>>  	$CHATTR_PROG +C "$fname" > /dev/null 2>&1
>>  	_pwrite_byte 0x61 0 "$sz" "$fname" >> $seqres.full
>> -	$MKSWAP_PROG "$fname" >> $seqres.full
>> +	if [ "$FSTYP" = "exfat" ]; then
>> +		# exfat does not support posix file permisions, so warning is
>> +		# to be expected
>> +		$MKSWAP_PROG "$fname" 2>&1 | grep -v 'insecure permission' >> $seqres.full
>> +	else
>> +		$MKSWAP_PROG "$fname" >> $seqres.full
>> +	fi
>>  }
>>  
>>  # Check that the filesystem supports swapfiles
>>
>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 9cdfe21c..2d658711 100644
--- a/common/rc
+++ b/common/rc
@@ -2392,7 +2392,13 @@  _format_swapfile() {
 	# Swap files must be nocow on Btrfs.
 	$CHATTR_PROG +C "$fname" > /dev/null 2>&1
 	_pwrite_byte 0x61 0 "$sz" "$fname" >> $seqres.full
-	$MKSWAP_PROG "$fname" >> $seqres.full
+	if [ "$FSTYP" = "exfat" ]; then
+		# exfat does not support posix file permisions, so warning is
+		# to be expected
+		$MKSWAP_PROG "$fname" 2>&1 | grep -v 'insecure permission' >> $seqres.full
+	else
+		$MKSWAP_PROG "$fname" >> $seqres.full
+	fi
 }
 
 # Check that the filesystem supports swapfiles