You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add gix_testtools::umask, safe but only meant for tests
This implements a function for tests to safely read the current
process umask without the usual race condition of doing so, at the
expense of using subprocesses to do it. This just calls a shell and
runs `umask` from it (which is expected to be a builtin and, on
many systems, is available as a builtin but not an executable).
Even though this is safe, including thread-safe, it is unlikely to
be suitable for use outside of tests, because of its use of
`expect` and assertions when there are errors, combined with the
possibly slow speed of using subprocesses.
Given that this is effecitvely running a tiny shell script to do
the work, why is it not instead a fixture script that is named in
a `.gitignore` file so that it is not tracked? The reason is that
the outcomes of running such fixture scripts are still saved across
separate test runs, but it is useful to be able to run the tests
with differnt umasks, e.g. `(umask 077; cargo nextest run ...)`.
The immediate purpose is in forthcoming tests that, when checkout
sets +x on an existing file, it doesn't set excessive permissions.
The fix to pass such a test is not currently planned to use the
umask explicitly. But the tests will use it, at least to detect
when they cannot really verify the code under test on the grounds
that they are running with an excessively permissive umask that
doesn't allow behavior that only occurs with a generally reasonable
umask to be observed.
0 commit comments