[LTP] [PATCH v1] chdir01.c: set umask to 0 within setup

Petr Vorel pvorel@suse.cz
Mon Mar 11 15:11:47 CET 2024


> On 08. 03. 24 0:21, Wei Gao wrote:
> > On Thu, Mar 07, 2024 at 04:18:35PM +0100, Martin Doucha wrote:
> > > Hi,
> > > you're trying to fix a vfat mount quirk. We should fix that in the LTP
> > > library instead, e.g. by setting umask(0) and then restoring the original
> > > value inside safe_mount().

> > Thanks for your feedback.

> > For chdir case i just use Petr's below suggestion(Detail info you can check patch link
> > in below):

> > "2) tests, which set .mount_device = 1 and have more restrictive umask will not
> > work. Workaround would be to not use it and mount manually in the setup().
> > Or, reset umask with umask(0)."

> > https://patchwork.ozlabs.org/project/ltp/patch/20240219134845.22171-1-wegao@suse.com/

> I'd rather avoid mounting in setup unless you need to set special mount
> parameters.

> Mount-time umask does not matter for most filesystem. The exception are vfat
> and exfat which don't have any internal concept of access permissions and
> instead you need to either pass mount options that'll define access
> permissions for all files and directories, otherwise current process umask
> value will be used as the default.

+1

> So resetting umask to 0 before mount and restoring immediately after is
> perfectly safe. But we should later fix it properly by implementing
> per-filesystem mount options.

Yeah, I was thinking about it, but haven't implement it yet because not many
tests need it and it can be mostly workarounded. Do you know tests (beside this
one) which need it?

Kind regards,
Petr


More information about the ltp mailing list