diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2020-08-07 12:34:15 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2020-08-14 14:24:51 +0200 |
commit | 116c4c1c0a80193fc63646a30e12ccc28fc0f29f (patch) | |
tree | 671275f2d5fb4b3b7adea3d17a30b914c577b4bc /bin | |
parent | d1c7aafe9da79ad50d451837439ec98951581a03 (diff) | |
download | ptxdist-116c4c1c0a80193fc63646a30e12ccc28fc0f29f.tar.gz ptxdist-116c4c1c0a80193fc63646a30e12ccc28fc0f29f.tar.xz |
ptxdist: improve umask handling
Currently any umask other than 0022 is not really supported. There is no
check but strange things may happen, either at build-time or at runtime.
Improve this by:
- setting the umask to 0022 if it it currently more permissive
- fail with a clear error message if it is more restrictive
Expand the documentation to explain the new behaviour.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ptxdist | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/ptxdist b/bin/ptxdist index de278a9c6..9e2e365f0 100755 --- a/bin/ptxdist +++ b/bin/ptxdist @@ -558,6 +558,23 @@ check_compiler() { } +# +# checks the umask and modifies it if it is save to do so +# +check_umask() { + local mask="$(umask)" + if [ "${mask}" = "0022" ]; then + return + fi + if [ "$((mask & 0755))" -eq 0 ]; then + # setting a stricter umask is ok + umask 0022 + else + ptxd_bailout "PTXdist does not work correctly with the current umask (${mask})!" \ + "A less restrictive umask, e.g. 0022 or 0002, is required." + fi + +} # # checks if the dependencies are allright (make for the poor) @@ -633,6 +650,7 @@ check_premake() { check_config && check_dirs && + check_umask && check_deps } |