summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2021-02-16 08:25:01 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2021-02-16 08:25:06 +0100
commit7f951d8b4c58d1ac9676df3a89db01ab96191bd3 (patch)
tree50575e975fa21de320a23059b0ca456d0b7e0957 /scripts
parent8ea1b9015071e1efa4bfafb9d13cb12c74d8cef9 (diff)
downloadptxdist-7f951d8b4c58d1ac9676df3a89db01ab96191bd3.tar.gz
ptxdist-7f951d8b4c58d1ac9676df3a89db01ab96191bd3.tar.xz
ptxd_make_xpkg_pkg: limit install_alternative_tree permissions
install_alternative_tree takes the permissions from the filesystem. This can be a problem because the permission may change depending on the build machine configuration: The files are most likely created by some version control software. And in this case the permissions depend on the current umask. The most common umasks are 0022 and 0002. This results in directory permissions 0755 and 0775. To make this more deterministic, the permssions for install_alternative_tree are limited by an 0022 umask. In the example above, this results in 0755 directory permissions in both cases. Note: This does not help in all cases: If the files and directories are created with a even more restrictive umask then the resulting permissions will be different. But that is less common. So this fix should help in most cases. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/ptxd_make_xpkg_pkg.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
index 24d1d314c..0e2be2608 100644
--- a/scripts/lib/ptxd_make_xpkg_pkg.sh
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -761,7 +761,7 @@ ptxd_install_generic() {
IFS="${orig_IFS}"
local usr="${usr:-${stat[0]}}" &&
local grp="${grp:-${stat[1]}}" &&
- local mod="${stat[2]}" &&
+ local mod="$(printf "0%o" $(( 0${stat[2]} & ~${umask} )))" &&
local major="${stat[3]}" &&
local minor="${stat[4]}" &&
local type="${stat[5]}" &&
@@ -828,6 +828,7 @@ ptxd_install_tree() {
local cmd="file"
local src="${1}"
local dst="${2}"
+ local umask=0000
shift 2
ptxd_install_find "${src}" "${dst}" "$@" ||
ptxd_install_error "install_tree failed!"
@@ -842,6 +843,7 @@ ptxd_install_glob() {
local yglob=( ${3} )
local nglob=( ${4} )
set -B +f
+ local umask=0000
local -a glob
if [ -n "${3}" ]; then
@@ -869,6 +871,7 @@ ptxd_install_alternative_tree() {
local cmd="alternative"
local src="${1}"
local dst="${2}"
+ local umask=0022
shift 2
ptxd_install_find "${src}" "${dst:-${src}}" "$@" ||
ptxd_install_error "install_alternative_tree failed!"
@@ -877,6 +880,7 @@ export -f ptxd_install_alternative_tree
ptxd_install_archive() {
local archive="$1"
+ local umask=0000
shift
if [ -L "${archive}" -a "$(readlink -f "${archive}")" = /dev/null ]; then
@@ -982,6 +986,7 @@ export -f ptxd_install_spec
ptxd_install_package() {
local lib_dir=$(ptxd_get_lib_dir)
+ local umask=0000
for dir in "${pkg_pkg_dir}/"{,usr/}{bin,sbin,libexec}; do
find "${dir}" \( -type f -o -type l \) \