"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

Stefan Sperling <stsp@stsp.name>
Re: attempt at respecting umask
Omar Polo <op@omarpolo.com>
Sat, 29 Oct 2022 16:58:59 +0200

Download raw body.

On Sat, Oct 29, 2022 at 04:47:01PM +0200, Omar Polo wrote:
> Yep, we could amend apply_umask so it clears the x-bits (or the
> whole user part) from the current umask.  But it's not enough.
> mkdir(2) follows umask too for example and can break if someone
> runs with umask that clears the x-bit:
> 	% umask 177
> 	% mkdir foo
> 	% ls -ld foo
> 	drw-------  2 op  wheel   512B Oct 29 16:38 foo/
> 	% cd foo
> 	ksh: cd: foo: bad directory
> woops.

That particular case does not matter because directories are not
versioned in Git. Only regular files are.
> I'm not sure what to do, but I'd tend (maybe for lazyness) to ignore
> the problem, I assume that whoever sets the higher umask bits knows
> what they're doing.

Sure, this is not a very urgent problem.
I will take a closer look later. I would like to offer a solution to prevent
x-bit changes from being committed accidentally, regardless of umask.