lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8e43c570-b3ad-42a3-8270-4a41ab171b8b@linux.ibm.com>
Date: Mon, 18 Nov 2024 14:54:41 +0530
From: Nirjhar Roy <nirjhar@...ux.ibm.com>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: fstests@...r.kernel.org, linux-ext4@...r.kernel.org,
        linux-xfs@...r.kernel.org, ritesh.list@...il.com,
        ojaswin@...ux.ibm.com, zlang@...nel.org
Subject: Re: [PATCH v2 1/2] common/rc,xfs/207: Adding a common helper function
 to check xflag bits on a given file


On 11/15/24 22:15, Darrick J. Wong wrote:
> On Fri, Nov 15, 2024 at 09:45:58AM +0530, Nirjhar Roy wrote:
>> This patch defines a common helper function to test whether any of
>> fsxattr xflags field is set or not. We will use this helper in the next
>> patch for checking extsize (e) flag.
>>
>> Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@...il.com>
>> Reviewed-by: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
>> Signed-off-by: Nirjhar Roy <nirjhar@...ux.ibm.com>
>> ---
>>   common/rc     |  7 +++++++
>>   tests/xfs/207 | 13 ++-----------
>>   2 files changed, 9 insertions(+), 11 deletions(-)
>>
>> diff --git a/common/rc b/common/rc
>> index 2af26f23..fc18fc94 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -41,6 +41,13 @@ _md5_checksum()
>>   	md5sum $1 | cut -d ' ' -f1
>>   }
>>   
>> +# Check whether a fsxattr xflags character ($2) field is set on a given file ($1).
>> +# e.g, fsxattr.xflags =  0x80000800 [----------e-----X]
>> +_test_fsx_xflags_field()
> How about we call this "_test_fsxattr_xflag" instead?
>
> fsx is already something else in fstests.
Noted.
>
>> +{
>> +    grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat" "$1")
>> +}
> Not sure why this lost the xfs_io | grep -q structure.  The return value
> of the whole expression will always be the return value of the last
> command in the pipeline.
>
> (Correct?  I hate bash...)
>
> --D
>
>> +
>>   # Write a byte into a range of a file
>>   _pwrite_byte() {
>>   	local pattern="$1"
>> diff --git a/tests/xfs/207 b/tests/xfs/207
>> index bbe21307..4f6826f3 100755
>> --- a/tests/xfs/207
>> +++ b/tests/xfs/207
>> @@ -21,15 +21,6 @@ _require_cp_reflink
>>   _require_xfs_io_command "fiemap"
>>   _require_xfs_io_command "cowextsize"
>>   
>> -# Takes the fsxattr.xflags line,
>> -# i.e. fsxattr.xflags = 0x0 [--------------C-]
>> -# and tests whether a flag character is set
>> -test_xflag()
>> -{
>> -    local flg=$1
>> -    grep -q "\[.*${flg}.*\]" && echo "$flg flag set" || echo "$flg flag unset"
>> -}
>> -
>>   echo "Format and mount"
>>   _scratch_mkfs > $seqres.full 2>&1
>>   _scratch_mount >> $seqres.full 2>&1
>> @@ -65,14 +56,14 @@ echo "Set cowextsize and check flag"
>>   $XFS_IO_PROG -c "cowextsize 1048576" $testdir/file3 | _filter_scratch
>>   _scratch_cycle_mount
>>   
>> -$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
>> +_test_fsx_xflags_field "$testdir/file3" "C" && echo "C flag set" || echo "C flag unset"
>>   $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
>>   
>>   echo "Unset cowextsize and check flag"
>>   $XFS_IO_PROG -c "cowextsize 0" $testdir/file3 | _filter_scratch
>>   _scratch_cycle_mount
>>   
>> -$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
>> +_test_fsx_xflags_field "$testdir/file3" "C" && echo "C flag set" || echo "C flag unset"
>>   $XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
>>   
>>   status=0
>> -- 
>> 2.43.5
>>
>>
-- 
---
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ