[LTP] [PATCH v2] tst_test.c: Set system default umaks to 0022
Wei Gao
wegao@suse.com
Wed Feb 21 09:33:20 CET 2024
On Tue, Feb 20, 2024 at 10:18:37AM +0100, Petr Vorel wrote:
> Hi Wei,
>
> > char *tdebug_env = getenv("LTP_ENABLE_DEBUG");
>
> > + umask(0022);
>
> I don't think this is a good idea. Changing umask() in the library can influent
> tests. Could you please instead add umask(0) (to reset umask) on the tests which
> need it? The way it's done in open07.c.
cgroup_core01.c and statx07.c can use umask(0) in tests and i have updated the patch.
But chdir01 will still failed on vfat and exfat. Like following error msg:
chdir01.c:100: TFAIL: nobody: chdir("subdir") returned unexpected value -1: EACCES (13)
The reason is umask(0) should set before mount /dev/loop0 to /tmp/xxx/mntpoint, otherwise you
have no chance modify permission of file. What's your suggestion?
susetest:/tmp/LTP_chd5JtblL/mntpoint # mount | grep loop0
/dev/loop0 on /tmp/LTP_chd5JtblL/mntpoint type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/loop0 on /var/tmp/LTP_chd5JtblL/mntpoint type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
susetest:/tmp/LTP_chd5JtblL # chmod 777 mntpoint <<<<
susetest:/tmp/LTP_chd5JtblL # ll
total 307216
drwx------ 4 root root 16384 Dec 31 1969 mntpoint <<<<<<<< group and other has no any permission even try chmod
-rw------- 1 root root 314572800 Feb 19 04:51 test_dev.img
susetest:/tmp/LTP_chd5JtblL/mntpoint # touch aa
susetest:/tmp/LTP_chd5JtblL/mntpoint # ll
total 16
-rwx------ 1 root root 0a
drwx------ 2 root root 8192 Feb 19 04:50 keep_out
drwx------ 2 root root 8192 Feb 19 04:50 subdir
-rwx------ 1 root root 0 Feb 19 04:50 testfile <<<<<<
Thanks.
>
> Kind regards,
> Petr
More information about the ltp
mailing list