Uploaded image for project: 'Funtoo From Scratch'
  1. Funtoo From Scratch
  2. FFS-11

[Funtoo From Scratch] Fix stage1 packages with shell scripts that contain non-canonical paths

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical (Application) Critical (Application)
    • Hide
      Pr-requisite: You need a ffs stage1 tarball locally
      See attached ffs_stage1_arm-64bit_path_analysis.txt for full step by step reproduction
      Show
      Pr-requisite: You need a ffs stage1 tarball locally See attached ffs_stage1_arm-64bit_path_analysis.txt for full step by step reproduction
    • metro ffs stage3 arm65-bit cannot be built
    • Similar or same as FL-10625 depending on the CatPkg

      Continuing the adventure of getting the ffs stage1 build working with metro, we ran into another non-canonical path issue during the tonight's live streamed metro ffs arm64-bit stage3 build:

      /bin/cat /home/mirror/funtoo/next/arm-64bit/raspi4/2022-10-20/log/errors.json
      [
          {
              "ebuild": "dev-libs/expat-2.4.9::core-kit",
              "phase": "compile"
          }
      ]
       
      >>> Jobs: 161 of 320 complete, 1 failed             Load avg: 2.32, 2.38, 2.31
       * Package:    dev-libs/expat-2.4.9
       * Repository: core-kit
       * Maintainer: freedesktop-bugs@gentoo.org sping@gentoo.org
       * USE:        arm64 elibc_glibc kernel_linux unicode userland_GNU
       * FEATURES:   preserve-libs userpriv
      libtool: Version mismatch error.  This is libtool 2.4.7, but the
      libtool: definition of this LT_INIT comes from libtool 2.4.6.
      libtool: You should recreate aclocal.m4 with macros from libtool 2.4.7
      libtool: and run autoconf again.
      make: *** [Makefile:570: xmlparse.lo] Error 63
      make: *** Waiting for unfinished jobs....
      libtool: Version mismatch error.  This is libtool 2.4.7, but the
      libtool: definition of this LT_INIT comes from libtool 2.4.6.
      libtool: You should recreate aclocal.m4 with macros from libtool 2.4.7
      libtool: and run autoconf again.
      libtool: Version mismatch error.  This is libtool 2.4.7, but the
      libtool: definition of this LT_INIT comes from libtool 2.4.6.
      libtool: You should recreate aclocal.m4 with macros from libtool 2.4.7
      libtool: and run autoconf again.
      make: *** [Makefile:570: xmltok.lo] Error 63
      make: *** [Makefile:570: xmlrole.lo] Error 63
      make: Leaving directory '/var/tmp/portage/dev-libs/expat-2.4.9/work/expat-2.4.9-.arm64w/lib'
       * ERROR: dev-libs/expat-2.4.9::core-kit failed (compile phase):
       *   emake failed
      

      Upon digging into the package build failure output with in the metro stage3 at /var/tmp/metro/work/next/stage3-raspi4-next-2022-10-20/var/tmp/portage/dev-libs/expat-2.4.9/, I found this gem in temp/libtoolize.out:

       

      ***** libtoolize *****
      ***** PWD: /var/tmp/portage/dev-libs/expat-2.4.9/work/expat-2.4.9w
      ***** libtoolize --install --copy --force --automake
      /usr/bin/libtoolize: line 3666: /usr/bin/grep: No such file or directory
      

      We have another non-existent canonical path being derived during the stage1 build, just like eselect with /usr/bin/bash

      This discover this means there is a high probability that other shell scripts in the ffs stage1 also could have bad paths. Because of this I have done a complete reproducible and exhaustive analysis to find these offending scripts using this methodology:

      • Deflate the tainted ffs arm-64bit stage1 tarball and literally grep every shell script file in it for usr/bin patterns
      • Then using those findings determine which packages contain shell scripts with non-canonical pathing

      Below are the summarized results to help us fix things so metro ffs stage3 can successfully build on arm64-bit:

      Confirmed non-existent/non-canonical paths embedded in shell scripts included in the ffs stage1 arm-64bit:

      /usr/bin/bash
      /usr/bin/cygstart
      /usr/bin/dd
      /usr/bin/editor
      /usr/bin/emacs
      /usr/bin/grep
      /usr/bin/gvim
      /usr/bin/hostinfo
      /usr/bin/installbsd
      /usr/bin/objformat
      /usr/bin/oslevel
      /usr/bin/pmset
      /usr/bin/vi
      /usr/bin/vim
      /usr/bin/xemacss

       

      CatPkgs associated with those bad paths and their associated shell scripts that have the non-existent paths in them:

      app-admin/eselect-1.4.14-r1 (/usr/bin/eselect)
      app-arch/gzip-1.12 (/usr/bin/zgrep)
      app-shells/bash-5.2 (/usr/bin/bashbug)
      dev-vcs/git-2.38.1 (/usr/libexec/git-core/git-web--browse)
      dev-vcs/git-2.38.1 (/usr/share/git/contrib/hooks/pre-auto-gc-battery)
      sys-apps/groff-1.22.4 (/usr/bin/gdiffmk)
      sys-devel/libtool-2.4.6-r5 (/usr/bin/libtool)
      sys-devel/libtool-2.4.6-r5 (/usr/bin/libtoolize)
      sys-devel/libtool-2.4.6-r5 (/usr/share/libtool/configure)
      sys-libs/glibc-2.33-r2 (/usr/bin/ldd)
      sys-libs/glibc-2.33-r2 (/usr/bin/sotruss)
      sys-libs/glibc-2.33-r2 (/usr/bin/xtrace)

      Notice that eselect is here (which we fixed, but this is a nice ffs stage1 from before it was fixed). And the newly found libtoolize that is part of sys-devel/libtool and that is breaking expat's emerge.

       

      Final final list of offending scripts with exact line number references to non-existent/non-canonical paths in a ffs stage1 arm-64bit:

      ./usr/bin/zgrep:25:grep='${GREP-'\''/usr/bin/grep'\''}'
      ./usr/bin/zgrep:25:grep='${GREP-'\''/usr/bin/grep'\''}'
      ./usr/bin/gdiffmk:1:#!/usr/bin/bash
      ./usr/bin/gdiffmk:173:BASH_PROG=/usr/bin/bash
      ./usr/bin/bashbug:123:    if [ -x /usr/bin/editor ]; then
      ./usr/bin/bashbug:131:    elif [ -x /usr/bin/emacs ]; then
      ./usr/bin/bashbug:133:    elif [ -x /usr/bin/xemacs ]; then
      ./usr/bin/bashbug:135:    elif [ -x /usr/bin/vim; then
      ./usr/bin/bashbug:137:    elif [ -x /usr/bin/gvim; then
      ./usr/bin/bashbug:135:    elif [ -x /usr/bin/vim; then
      ./usr/bin/bashbug:145:    elif [ -x /usr/bin/vi ]; then
      ./usr/bin/eselect:1:#!/usr/bin/bash
      ./usr/bin/ldd:1:#! /usr/bin/bash
      ./usr/bin/sotruss:1:#! /usr/bin/bash
      ./usr/bin/xtrace:1:#! /usr/bin/bash
      ./usr/bin/libtool:1:#! /usr/bin/bash
      ./usr/bin/libtool:69:SHELL="/usr/bin/bash"
      ./usr/bin/libtool:94:GREP="/usr/bin/grep"
      ./usr/bin/libtool:97:EGREP="/usr/bin/grep -E"
      ./usr/bin/libtool:100:FGREP="/usr/bin/grep -F"
      ./usr/bin/libtool:198:lt_truncate_bin="/usr/bin/dd bs=4096 count=1"
      ./usr/bin/libtool:94:GREP="/usr/bin/grep"
      ./usr/bin/libtool:97:EGREP="/usr/bin/grep -E"
      ./usr/bin/libtool:100:FGREP="/usr/bin/grep -F"
      ./usr/bin/libtoolize:45:: ${EGREP="/usr/bin/grep -E"}
      ./usr/bin/libtoolize:46:: ${FGREP="/usr/bin/grep -F"}
      ./usr/bin/libtoolize:47:: ${GREP="/usr/bin/grep"}
      ./usr/bin/libtoolize:45:: ${EGREP="/usr/bin/grep -E"}
      ./usr/bin/libtoolize:46:: ${FGREP="/usr/bin/grep -F"}
      ./usr/bin/libtoolize:47:: ${GREP="/usr/bin/grep"}
      ./usr/share/gnuconfig/config.guess:566:if [ -x /usr/bin/oslevel ] ; then
      ./usr/share/gnuconfig/config.guess:567:    IBM_REV=`/usr/bin/oslevel`
      ./usr/share/gnuconfig/config.guess:1461:/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
      ./usr/share/git/contrib/hooks/pre-auto-gc-battery:35:elif test -x /usr/bin/pmset && /usr/bin/pmset -g batt |
      ./usr/share/libtool/configure:1919:/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
      ./usr/share/libtool/configure:1921:/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
      ./usr/share/libtool/configure:2296:# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
      ./usr/share/libtool/configure:11073:  if test -x /usr/bin/objformat; then
      ./usr/share/libtool/configure:11074:    objformat=`/usr/bin/objformat`
      ./usr/libexec/git-core/git-web--browse:131:    # /usr/bin/cygstart indicates Cygwin
      ./usr/libexec/git-core/git-web--browse:132:    if test -x /usr/bin/cygstart; then

      All files used for analysis:

       

       

       

            drobbins drobbins
            siris siris
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: