[LTP] 答复: [PATCH] syscalls/statx: Add judgment to the MODE value

Zouwei (Samuel) zou_wei@huawei.com
Mon Mar 30 04:29:53 CEST 2020


Hi Yang,

Thanks for your review and comments, I will send the v2 patch.

Best Regards
Zou Wei

-----邮件原件-----
发件人: Xiao Yang [mailto:ice_yangxiao@163.com] 
发送时间: 2020年3月28日 19:38
收件人: Zouwei (Samuel) <zou_wei@huawei.com>; ltp@lists.linux.it
主题: Re: [LTP] [PATCH] syscalls/statx: Add judgment to the MODE value

On 3/28/20 2:39 PM, Zou Wei wrote:
> 1. The default value of umask in most linux systems is 0022, but in some other systems is 0077,
>     which results in different MODE values when opening files.
>
> 2. Adding judgment to the MODE value can improve the versatility of this case.
>
> 3. 63 translates to 77 in octal, meaning the running process has a umask of 0022.
>     That means the process will open files with 0600 as permissions on the filesystem.
>
> Signed-off-by: Zou Wei <zou_wei@huawei.com>
> ---
>   testcases/kernel/syscalls/statx/statx01.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/syscalls/statx/statx01.c 
> b/testcases/kernel/syscalls/statx/statx01.c
> index 4f9d582..adca1d3 100644
> --- a/testcases/kernel/syscalls/statx/statx01.c
> +++ b/testcases/kernel/syscalls/statx/statx01.c
> @@ -47,7 +47,7 @@
>   #define TESTFILE "test_file"
>   #define MNTPOINT "mntpoint/"
>   #define DEVICEFILE MNTPOINT"blk_dev"
> -#define MODE 0644
> +#define MODE ((umask(0)==63)?0600:0644)

Hi Zou,

1) For the fix, I think you just need to clear current mask by umask(0) in setup().

2) Don't mix the fix and adding coverage(i.e. different permissions). Please use

     other ways(create two files with different permissions or change the permission

     during test, etc) if you want to run test with different permissions.

Thanks,

Xiao Yang

>
>   #define SIZE 256
>   #define MAJOR 8
> --
> 2.6.2
>
>



More information about the ltp mailing list