Bug#861343: debootstrap: hardcodes mawk as awk provider
On 2018-03-19 22:12 +0100, Raphael Hertzog wrote: > On Mon, 19 Mar 2018, Hideki Yamane wrote: >> However, in scripts/*, there's unnecessary mawk hardcode line and >> we can remove it safely as attached patch. > [...] >> -ln -sf mawk "$TARGET/usr/bin/awk" >> +ln -sf awk "$TARGET/usr/bin/awk" > > Huh? This doesn't make any sense. You are creating a symlink named "awk" that > points to itself. And you will have broken everything. > > The problem is the lack of /usr/bin/awk because that file is handled by > update-alternatives which can't be run in the early steps. So it's > manually created and it needs to point to the awk alternative that > has been unpacked earlier. > > At best you can try to match /usr/bin/*awk to try to guess how the > awk executable is named and use that to look up the package name > (for the x_core_install call that also hardcodes the mawk name) > and create the appropriate symlink (which will get replaced by > the update-alternatives managed one). Attached is a patch which tries to do that. Unfortunately I could not test it, since I don't have a local mirror where I could swap the priorities of mawk and original-awk (or gawk). Cheers, Sven >From 52b84c8693d99fe877d9e612881503fe28c39210 Mon Sep 17 00:00:00 2001 From: Sven Joachim Date: Fri, 28 Apr 2017 09:23:20 +0200 Subject: [PATCH] Handle case where some other awk than mawk is required Set up original-awk or gawk, if they had been downloaded instead of mawk. This should make it possible to let either of those have "Priority: required" and downgrade mawk's priority. --- scripts/debian-common | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/debian-common b/scripts/debian-common index 211a4c4..88dbc07 100644 --- a/scripts/debian-common +++ b/scripts/debian-common @@ -9,6 +9,13 @@ case $ARCH in *) LIBC="libc6" ;; esac +find_awk () { + if [ -x "$TARGET/usr/bin/mawk" ]; then AWK=mawk + elif [ -x "$TARGET/usr/bin/original-awk" ]; then AWK=original-awk + elif [ -x "$TARGET/usr/bin/gawk" ]; then AWK=gawk + fi +} + work_out_debs () { required="$(get_debs Priority: required)" @@ -117,7 +124,8 @@ Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" info INSTCORE "Installing core packages..." p; progress $baseprog $bases INSTCORE "Installing core packages" #2 - ln -sf mawk "$TARGET/usr/bin/awk" + find_awk + [ -n "$AWK" ] && ln -sf $AWK "$TARGET/usr/bin/awk" x_core_install base-passwd x_core_install base-files p; progress $baseprog $bases INSTCORE "Installing core packages" #3 @@ -138,8 +146,8 @@ Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" x_core_install perl-base p; progress $baseprog $bases INSTCORE "Installing core packages" #6 - rm "$TARGET/usr/bin/awk" - x_core_install mawk + rm -f "$TARGET/usr/bin/awk" + [ -n "$AWK" ] && x_core_install $AWK p; progress $baseprog $bases INSTCORE "Installing core packages" #7 if doing_variant -; then -- 2.18.0
Bug#861343: debootstrap: hardcodes mawk as awk provider
Hi Hideki, On Mon, 19 Mar 2018, Hideki Yamane wrote: > However, in scripts/*, there's unnecessary mawk hardcode line and > we can remove it safely as attached patch. [...] > - ln -sf mawk "$TARGET/usr/bin/awk" > + ln -sf awk "$TARGET/usr/bin/awk" Huh? This doesn't make any sense. You are creating a symlink named "awk" that points to itself. And you will have broken everything. The problem is the lack of /usr/bin/awk because that file is handled by update-alternatives which can't be run in the early steps. So it's manually created and it needs to point to the awk alternative that has been unpacked earlier. At best you can try to match /usr/bin/*awk to try to guess how the awk executable is named and use that to look up the package name (for the x_core_install call that also hardcodes the mawk name) and create the appropriate symlink (which will get replaced by the update-alternatives managed one). Cheers, -- Raphaël Hertzog ◈ Debian Developer Support Debian LTS: https://www.freexian.com/services/debian-lts.html Learn to master Debian: https://debian-handbook.info/get/
Bug#861343: debootstrap: hardcodes mawk as awk provider
control: tags -1 +patch On Thu, 27 Apr 2017 20:35:01 +0200 Sven Joachimwrote: > It might be useful for Debian or derivatives to change the default awk > provider, which currently is mawk - a package that has de facto been > unmaintained in Debian for several years. The original-awk package is > in my experience considerably less buggy and similarly small. > > However, all the scripts/* files in debootstrap currently hardcode mawk, > making it impossible to swap the priorities of mawk and original-awk > without instantly breaking debootstrap. :-( mawk package is "required" but other awk packages are "optional". Perhaps it is the reason for mawk to be choosed. However, in scripts/*, there's unnecessary mawk hardcode line and we can remove it safely as attached patch. diff --git a/scripts/aequorea b/scripts/aequorea index 1ae17d8..fb70941 100644 --- a/scripts/aequorea +++ b/scripts/aequorea @@ -107,7 +107,7 @@ second_stage_install () { info INSTCORE "Installing core packages..." p; progress $baseprog $bases INSTCORE "Installing core packages" #2 - ln -sf mawk "$TARGET/usr/bin/awk" + ln -sf awk "$TARGET/usr/bin/awk" x_core_install base-passwd x_core_install base-files p; progress $baseprog $bases INSTCORE "Installing core packages" #3 diff --git a/scripts/breezy b/scripts/breezy index f15967a..132d7ea 100644 --- a/scripts/breezy +++ b/scripts/breezy @@ -90,7 +90,7 @@ second_stage_install () { info INSTCORE "Installing core packages..." p; progress $baseprog $bases INSTCORE "Installing core packages" #2 -ln -sf mawk "$TARGET/usr/bin/awk" +ln -sf awk "$TARGET/usr/bin/awk" x_core_install base-files base-passwd p; progress $baseprog $bases INSTCORE "Installing core packages" #3 x_core_install dpkg diff --git a/scripts/dapper b/scripts/dapper index b1e44d0..4ea3cfa 100644 --- a/scripts/dapper +++ b/scripts/dapper @@ -95,7 +95,7 @@ second_stage_install () { info INSTCORE "Installing core packages..." p; progress $baseprog $bases INSTCORE "Installing core packages" #2 -ln -sf mawk "$TARGET/usr/bin/awk" +ln -sf awk "$TARGET/usr/bin/awk" x_core_install base-files base-passwd p; progress $baseprog $bases INSTCORE "Installing core packages" #3 x_core_install dpkg diff --git a/scripts/debian-common b/scripts/debian-common index 36989a2..a8591bd 100644 --- a/scripts/debian-common +++ b/scripts/debian-common @@ -105,7 +105,7 @@ Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" info INSTCORE "Installing core packages..." p; progress $baseprog $bases INSTCORE "Installing core packages" #2 - ln -sf mawk "$TARGET/usr/bin/awk" + ln -sf awk "$TARGET/usr/bin/awk" x_core_install base-passwd x_core_install base-files p; progress $baseprog $bases INSTCORE "Installing core packages" #3 diff --git a/scripts/edgy b/scripts/edgy index 719a258..eb4ec56 100644 --- a/scripts/edgy +++ b/scripts/edgy @@ -105,7 +105,7 @@ second_stage_install () { info INSTCORE "Installing core packages..." p; progress $baseprog $bases INSTCORE "Installing core packages" #2 -ln -sf mawk "$TARGET/usr/bin/awk" +ln -sf awk "$TARGET/usr/bin/awk" x_core_install base-files base-passwd p; progress $baseprog $bases INSTCORE "Installing core packages" #3 x_core_install dpkg diff --git a/scripts/feisty b/scripts/feisty index e38f799..671ff86 100644 --- a/scripts/feisty +++ b/scripts/feisty @@ -104,7 +104,7 @@ second_stage_install () { info INSTCORE "Installing core packages..." p; progress $baseprog $bases INSTCORE "Installing core packages" #2 -ln -sf mawk "$TARGET/usr/bin/awk" +ln -sf awk "$TARGET/usr/bin/awk" x_core_install base-files base-passwd p; progress $baseprog $bases INSTCORE "Installing core packages" #3 x_core_install dpkg diff --git a/scripts/gutsy b/scripts/gutsy index 65a748f..b4066c1 100644 --- a/scripts/gutsy +++ b/scripts/gutsy @@ -136,7 +136,7 @@ Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" info INSTCORE "Installing core packages..." p; progress $baseprog $bases INSTCORE "Installing core packages" #2 - ln -sf mawk "$TARGET/usr/bin/awk" + ln -sf awk "$TARGET/usr/bin/awk" x_core_install base-passwd x_core_install base-files p; progress $baseprog $bases INSTCORE "Installing core packages" #3 diff --git a/scripts/hoary b/scripts/hoary index e5fe9fc..7821e2b 100644 --- a/scripts/hoary +++ b/scripts/hoary @@ -109,7 +109,7 @@ second_stage_install () { info INSTCORE "Installing core packages..." p; progress $baseprog $bases INSTCORE "Installing core packages" #2 -ln -sf mawk "$TARGET/usr/bin/awk" +ln -sf awk "$TARGET/usr/bin/awk" x_core_install base-files base-passwd p; progress $baseprog $bases INSTCORE "Installing core packages" #3 x_core_install dpkg diff --git a/scripts/hoary.buildd b/scripts/hoary.buildd index 8d10d80..e625d79 100644 --- a/scripts/hoary.buildd +++
Bug#861343: debootstrap: hardcodes mawk as awk provider
Package: debootstrap Version: 1.0.89 Severity: normal It might be useful for Debian or derivatives to change the default awk provider, which currently is mawk - a package that has de facto been unmaintained in Debian for several years. The original-awk package is in my experience considerably less buggy and similarly small. However, all the scripts/* files in debootstrap currently hardcode mawk, making it impossible to swap the priorities of mawk and original-awk without instantly breaking debootstrap. :-( -- System Information: Debian Release: 9.0 APT prefers unstable APT policy: (500, 'unstable'), (101, 'experimental') Architecture: i386 (x86_64) Kernel: Linux 4.9.24-nouveau (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages debootstrap depends on: ii wget 1.19.1-3 Versions of packages debootstrap recommends: ii debian-archive-keyring 2014.3 ii gnupg 2.1.18-6 debootstrap suggests no packages. -- no debconf information