From 29f0662c188e7126871fa84f6e6f854cda279c89 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Wed, 26 Sep 2018 16:18:23 -0700 Subject: [PATCH 1/3] Fix restarting after a complete build It is much, much better to *first* make the directory writable and *then* do a test for case-sensitivity (which requires writing in that directory). Fixes #1033. Signed-off-by: Alexey Neyman --- scripts/crosstool-NG.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/crosstool-NG.sh b/scripts/crosstool-NG.sh index 486f7330..7909438a 100644 --- a/scripts/crosstool-NG.sh +++ b/scripts/crosstool-NG.sh @@ -304,15 +304,15 @@ CT_DoExecLog ALL mkdir -p "${CT_HOST_COMPLIBS_DIR}" # Only create the state dir if asked for a restartable build [ -n "${CT_DEBUG_CT_SAVE_STEPS}" ] && CT_DoExecLog ALL mkdir -p "${CT_STATE_DIR}" +# Kludge: CT_PREFIX_DIR might have grown read-only if +# the previous build was successful. +CT_DoExecLog ALL chmod -R u+w "${CT_PREFIX_DIR}" + # Check install file system case-sensitiveness CT_DoExecLog DEBUG touch "${CT_PREFIX_DIR}/foo" CT_TestAndAbort "Your file system in '${CT_PREFIX_DIR}' is *not* case-sensitive!" -f "${CT_PREFIX_DIR}/FOO" CT_DoExecLog DEBUG rm -f "${CT_PREFIX_DIR}/foo" -# Kludge: CT_PREFIX_DIR might have grown read-only if -# the previous build was successful. -CT_DoExecLog ALL chmod -R u+w "${CT_PREFIX_DIR}" - # Setting up the rest of the environment only if not restarting if [ -z "${CT_RESTART}" ]; then # Having .. inside CT_PREFIX breaks relocatability. From d573c1575825de8c47aaeca89db54226ff702924 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Wed, 26 Sep 2018 23:54:55 -0700 Subject: [PATCH 2/3] Use 'chmod a-x' instead of 'chmod -x' There is a subtle difference when executable bit is a part of the umask. And at least some versions (Debian/stretch) fail if the resulting mode would've been different if not for the umask setting. Fixes #998. Although, with such chmods/umasks it is likely that some package installation will break anyway. But I'll leave it until somebody complains. Signed-off-by: Alexey Neyman --- Makefile.am | 6 +++--- scripts/build/binutils/binutils.sh | 2 +- scripts/build/debug/300-gdb.sh | 2 +- testing/docker/archlinux/Dockerfile | 2 +- testing/docker/dmgr.sh | 2 +- testing/docker/gentoo-amd64/Dockerfile | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 84bbe432..5fdee307 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,10 +65,10 @@ bash-completion/ct-ng: bash-completion/ct-ng.in Makefile install-data-hook: rm -f $(DESTDIR)$(man1dir)/$(ctng_progname).1.gz gzip -9 $(DESTDIR)$(man1dir)/$(ctng_progname).1 - chmod +x $(DESTDIR)$(pkgdatadir)/scripts/config.guess - chmod +x $(DESTDIR)$(pkgdatadir)/scripts/config.sub + chmod a+x $(DESTDIR)$(pkgdatadir)/scripts/config.guess + chmod a+x $(DESTDIR)$(pkgdatadir)/scripts/config.sub if INSTALL_BASH_COMPLETION - chmod -x $(DESTDIR)$(compdir)/$(ctng_progname) + chmod a-x $(DESTDIR)$(compdir)/$(ctng_progname) endif uninstall-hook: diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh index 703a6fab..e8060ec5 100644 --- a/scripts/build/binutils/binutils.sh +++ b/scripts/build/binutils/binutils.sh @@ -223,7 +223,7 @@ do_binutils_backend() { sed -r -e "s/@@DEFAULT_LD@@/${CT_BINUTILS_LINKER_DEFAULT}/" \ "${CT_LIB_DIR}/scripts/build/binutils/binutils-ld.in" \ >"${prefix}/bin/${CT_TARGET}-ld" - chmod +x "${prefix}/bin/${CT_TARGET}-ld" + chmod a+x "${prefix}/bin/${CT_TARGET}-ld" cp -a "${prefix}/bin/${CT_TARGET}-ld" \ "${prefix}/${CT_TARGET}/bin/ld" diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index fe6ce79a..c73e4306 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -315,7 +315,7 @@ do_debug_gdb_build() { # Workaround for bad versions, where the configure # script for gdbserver is not executable... # Bah, GNU folks strike again... :-( - chmod +x "${gdb_src_dir}/gdb/gdbserver/configure" + chmod a+x "${gdb_src_dir}/gdb/gdbserver/configure" gdbserver_extra_config=("${extra_config[@]}") diff --git a/testing/docker/archlinux/Dockerfile b/testing/docker/archlinux/Dockerfile index 4c90925a..2ad9d648 100644 --- a/testing/docker/archlinux/Dockerfile +++ b/testing/docker/archlinux/Dockerfile @@ -1,3 +1,3 @@ -FROM hoverbear/archlinux +FROM base/archlinux:latest RUN pacman -Syu --noconfirm RUN pacman -S --noconfirm base-devel git help2man python unzip diff --git a/testing/docker/dmgr.sh b/testing/docker/dmgr.sh index 08247844..b6a42943 100755 --- a/testing/docker/dmgr.sh +++ b/testing/docker/dmgr.sh @@ -109,7 +109,7 @@ action_clean() msg "Cleaning up after ${cntr}" if [ -d build-${cntr} ]; then - chmod -R +w build-${cntr} + chmod -R a+w build-${cntr} rm -rf build-${cntr} fi } diff --git a/testing/docker/gentoo-amd64/Dockerfile b/testing/docker/gentoo-amd64/Dockerfile index 65005640..455e3151 100644 --- a/testing/docker/gentoo-amd64/Dockerfile +++ b/testing/docker/gentoo-amd64/Dockerfile @@ -1,4 +1,4 @@ FROM gentoo/stage3-amd64-hardened RUN wget -O /sbin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 -RUN chmod +x /sbin/dumb-init +RUN chmod a+x /sbin/dumb-init ENTRYPOINT [ "/sbin/dumb-init", "--" ] From 2acab2f06197ab34243fc415020ead54d4a9e505 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Thu, 27 Sep 2018 01:01:20 -0700 Subject: [PATCH 3/3] Make CT_PREFIX_DIR/CT_WORK_DIR/CT_BUILD_TOP_DIR absolute ... if they aren't already. Fixes #1010. Signed-off-by: Alexey Neyman --- config/global/paths.in | 2 +- scripts/crosstool-NG.sh | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/config/global/paths.in b/config/global/paths.in index 39e15f35..b4e93ee0 100644 --- a/config/global/paths.in +++ b/config/global/paths.in @@ -42,7 +42,7 @@ config WORK_DIR config BUILD_TOP_DIR string - default "${CT_WORK_DIR}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" + default "${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" config PREFIX_DIR string diff --git a/scripts/crosstool-NG.sh b/scripts/crosstool-NG.sh index 7909438a..fb6856e1 100644 --- a/scripts/crosstool-NG.sh +++ b/scripts/crosstool-NG.sh @@ -74,6 +74,7 @@ for d in \ LOCAL_TARBALLS \ WORK \ PREFIX \ + BUILD_TOP \ INSTALL \ ; do eval dir="\${CT_${d}_DIR}" @@ -88,6 +89,17 @@ for d in \ CT_Abort "'CT_${d}_DIR'='${dir}' contains a comma in it.\nDon't use commas in paths, it breaks things." ;; esac + case "${dir}" in + /*) + # Absolute path, okay + ;; + *) + # Relative path from CT_TOP_DIR, make absolute + eval CT_${d}_DIR="${CT_TOP_DIR}/${dir}" + # Having .. inside CT_PREFIX breaks relocatability. + CT_SanitizeVarDir CT_${d}_DIR + ;; + esac done # Where will we work? @@ -315,9 +327,6 @@ CT_DoExecLog DEBUG rm -f "${CT_PREFIX_DIR}/foo" # Setting up the rest of the environment only if not restarting if [ -z "${CT_RESTART}" ]; then - # Having .. inside CT_PREFIX breaks relocatability. - CT_SanitizeVarDir CT_PREFIX_DIR - case "${CT_SYSROOT_NAME}" in "") CT_SYSROOT_NAME="sysroot";; .) CT_Abort "Sysroot name is set to '.' which is forbidden";;