pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkg/54349: bootstrap with --prefix fails on Solaris 10
The following reply was made to PR pkg/54349; it has been noted by GNATS.
From: Hiroshi Hakoyama <hiroshi-hakoyama%nagano.ac.jp@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: pkg-manager%netbsd.org@localhost,
gnats-admin%netbsd.org@localhost,
pkgsrc-bugs%netbsd.org@localhost
Subject: Re: pkg/54349: bootstrap with --prefix fails on Solaris 10
Date: Sat, 20 Jul 2019 15:12:47 +0900
Revision 1.262 is OK.
Revision 1.263 introduced the problem.
The trouble maybe relate to the change introduce in =
checkarg_sane_absolute_path() or/and checkarg_no_symlink_path().
Hiroshi
> 2019/07/11 19:35=E3=80=81Hiroshi Hakoyama =
<hiroshi-hakoyama%nagano.ac.jp@localhost>=E3=81=AE=E3=83=A1=E3=83=BC=E3=83=AB:
>=20
> The following reply was made to PR pkg/54349; it has been noted by =
GNATS.
>=20
> From: Hiroshi Hakoyama <hiroshi-hakoyama%nagano.ac.jp@localhost>
> To: gnats-bugs%netbsd.org@localhost
> Cc: pkg-manager%netbsd.org@localhost,
> gnats-admin%netbsd.org@localhost,
> pkgsrc-bugs%netbsd.org@localhost
> Subject: Re: pkg/54349: bootstrap with --prefix fails on Solaris 10
> Date: Thu, 11 Jul 2019 19:31:07 +0900
>=20
> Dear Benny,
>=20
> /bin/sh on Solaris 10 is Bourne Shell.
>=20
>> Do you happen to know where in the file this
>> happens, i.e. can you get a line number?
>=20
> line 501, probably.
>=20
>=20
> Hiroshi
>=20
> env CFLAGS=3D3D-O2 CC=3D3D/opt/csw/gcc4/bin/gcc =
GCCBASE=3D3D/opt/csw/gcc4 =3D
> ./bootstrap --prefix=3D3D/usr/pkg2 --varbase
> # $NetBSD: bootstrap,v 1.268 2019/07/08 19:44:08 sevan Exp $
> #
> # Copyright (c) 2001-2011 Alistair Crooks <agc%NetBSD.org@localhost>
> # All rights reserved.
> #
> # Redistribution and use in source and binary forms, with or without
> # modification, are permitted provided that the following conditions
> # are met:
> # 1. Redistributions of source code must retain the above copyright
> # notice, this list of conditions and the following disclaimer.
> # 2. Redistributions in binary form must reproduce the above copyright
> # notice, this list of conditions and the following disclaimer in =
the
> # documentation and/or other materials provided with the =3D
> distribution.
> #
> # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED =3D
> WARRANTIES
> # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE =3D
> DISCLAIMED.
> # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, =
=3D
> BUT
> # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF =
=3D
> USE,
> # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON =
ANY
> # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE =
USE =3D
> OF
> # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> #
> #set -x
>=20
> # the following environment variables are honored:
> # compiler/linker flags: CFLAGS, CPPFLAGS, LDFLAGS, LIBS
> # tools: CP, GREP, ID, MKDIR, SH, TEST, TOUCH, XARGS
>=20
>=20
> BOOTSTRAP_VERSION=3D3D20060721
>=20
> # Don't let the bootstrap program get confused by a pre-existing =
mk.conf
> # file.
> MAKECONF=3D3D/dev/null
> export MAKECONF
>=20
> # No vulnerability checks since there might be an incompatible checker =
=3D
> installed
> NO_PKGTOOLS_REQD_CHECK=3D3Dyes
> export NO_PKGTOOLS_REQD_CHECK
>=20
> unprivileged=3D3Dno
>=20
> preserve_path=3D3Dno
>=20
> # where the building takes place
> bootstrapdir=3D3D`dirname "$0"`
> bootstrapdir=3D3D`cd "${bootstrapdir}" && pwd`
> pkgsrcdir=3D3D`dirname "${bootstrapdir}"`
> wrkdir=3D3D"`pwd`/work"
>=20
> usage=3D3D"Usage: $0 "'
> [ --abi [32|64] ]
> [ --binary-kit <tarball> ]
> [ --binary-macpkg <pkg> ]
> [ --compiler <compiler> ]
> [ --cwrappers <auto|yes|no> ]
> [ --full ]
> [ --gzip-binary-kit <tarball> ]
> [ --help ]
> [ --make-jobs <num> ]
> [ --mk-fragment <mk.conf> ]
> [ --pkgdbdir <pkgdbdir> ]
> [ --pkginfodir <pkginfodir> ]
> [ --pkgmandir <pkgmandir> ]
> [ --prefer-pkgsrc <list|yes|no> ]
> [ --prefix <prefix> ]
> [ --preserve-path ]
> [ --quiet ]
> [ --sysconfdir <sysconfdir> ]
> [ --unprivileged | --ignore-user-check ]
> [ --varbase <varbase> ]
> [ --workdir <workdir> ]
> '
>=20
> # strip / for BSD/OS, strip - for HP-UX
> opsys=3D3D`uname -s | tr -d /-`
>=20
> mkbinarykit_macpkg()
> {
> local macdestdir
> macdestdir=3D3D${wrkdir}/macpkg-destdir
> rm -rf ${macdestdir} || die "cleanup destdir"
>=20
> mkdir -p ${macdestdir}${prefix} || die "mkdir destprefix"
> rmdir ${macdestdir}${prefix} || die "rmdir destprefix"
> cp -Rp ${prefix} ${macdestdir}${prefix} || die "copy prefix"
>=20
> if [ ! -d ${macdestdir}${pkgdbdir} ]; then
> mkdir -p ${macdestdir}${pkgdbdir} || die "mkdir =3D
> destdbdir"
> rmdir ${macdestdir}${pkgdbdir} || die "rmdir =
destdbdir"
> cp -Rp ${pkgdbdir} ${macdestdir}${pkgdbdir} || die =
"copy =3D
> dbdir"
> fi
>=20
> ${sedprog} -e "s|%WRKDIR%|${wrkdir}|g" \
> -e "s|%TARGETDIR%|${targetdir}|g" -e =3D
> "s|%DATE%|${date}|g" \
> < macpkg.pmproj.in > ${wrkdir}/macpkg.pmproj
> ${packagemaker} -build -proj ${wrkdir}/macpkg.pmproj -p =3D
> "${binary_macpkg}"
> }
>=20
> mkbinarykit_tar()
> {
> # in case tar was built by bootstrap
> PATH=3D3D"$prefix/bin:$PATH"; export PATH
> cd / && tar -hcf "${binary_kit}" .$prefix .$pkgdbdir =3D
> .$etc_mk_conf
> }
>=20
> mkbinarykit_tgz()
> {
> # in case tar was built by bootstrap
> PATH=3D3D"$prefix/bin:$PATH"; export PATH
> cd / && tar -hcf - .$prefix .$pkgdbdir .$etc_mk_conf | gzip > =
=3D
> "${binary_gzip_kit}"
> }
>=20
> die()
> {
> echo >&2 "$@"
> exit 1
> }
>=20
> echo_msg()
> {
> echo "=3D3D=3D3D=3D3D> $@"
> }
>=20
> # see if we're using gcc. If so, set $compiler_is_gnu to '1'.
> get_compiler()
> {
> testcc=3D3D"${CC}"
> # normally, we'd just use 'cc', but certain configure tools =
look
> # for gcc specifically, so we have to see if that comes first
> if [ -z "${testcc}" ]; then
> save_IFS=3D3D"${IFS}"
> IFS=3D3D':'
> for dir in ${PATH}; do
> test -z "$dir" && dir=3D3D.
> if [ -x "$dir/gcc" ]; then
> testcc=3D3D"$dir/gcc"
> break
> fi
> done
> IFS=3D3D"${save_IFS}"
> fi
>=20
> # Clang compiler pretends to be GCC, so we have to check that
> cat >${wrkdir}/$$.c <<EOF
> #ifdef __clang__
> indeed
> #endif
> EOF
> compiler_is_clang=3D3D`${testcc:-cc} -E ${wrkdir}/$$.c =
2>/dev/null =3D
> | grep -c indeed`
> rm -f ${wrkdir}/$$.c
>=20
> cat >${wrkdir}/$$.c <<EOF
> #ifdef __GNUC__
> #ifndef __clang__
> indeed
> #endif
> #endif
> EOF
> compiler_is_gnu=3D3D`${testcc:-cc} -E ${wrkdir}/$$.c =
2>/dev/null | =3D
> grep -c indeed`
> rm -f ${wrkdir}/$$.c
>=20
> }
> get_abi()
> {
> abi_opsys=3D3D$@
>=20
> if [ -n "$abi" ]; then
> case "$abi_opsys" in
> IRIX)
> die "ERROR: $abi_opsys has special ABI =
handling, =3D
> --abi not supported (yet)."
> ;;
> esac
> fi
>=20
> case "$abi_opsys" in
> IRIX)
> if [ `uname -r` -ge 6 ]; then
> abi=3D3D`sed -e =
's/.*\(abi=3D3D\)\([on]*[36][24]\).*/\2/' =3D
> /etc/compiler.defaults`
> isa=3D3D`sed -e 's/.*\(isa=3D3Dmips\)\([1234]\).*/\2/' =
=3D
> /etc/compiler.defaults`
> case "$abi" in
> o32)
> imakeopts=3D3D"-DBuildO32 -DSgiISAo32=3D3D$isa"
> abi=3D3D""
> ;;
> n32) imakeopts=3D3D"-DBuildN32 -DSgiISA32=3D3D$isa"
> abi=3D3D"32"
> ;;
> 64 | n64)
> imakeopts=3D3D"-DBuild64bit -DSgiISA64=3D3D$isa"=
> abi=3D3D"64"
> ;;
> esac
> else # IRIX before 6
> abi=3D3D32
> fi
> ;;
> esac
> }
>=20
> get_machine_arch_aix()
> {
> _cpuid=3D3D`/usr/sbin/lsdev -C -c processor -S available | sed =
1q =3D
> | awk '{ print $1 }'`
> if /usr/sbin/lsattr -El $_cpuid | grep ' POWER' >/dev/null =
2>&1; =3D
> then
> echo rs6000
> else
> echo powerpc
> fi
> }
>=20
> get_machine_arch_darwin()
> {
> case `uname -p` in
> i386)
> # Returns "i386" or "x86_64" depending on CPU
> echo `uname -m`
> ;;
> powerpc)
> # sysctl mib exists on 64-bit hardware
> if [ -n "`sysctl -n hw.optional.64bitops 2>/dev/null`" =
=3D
> ]; then
> echo "powerpc64"
> else
> echo "powerpc"
> fi
> ;;
> esac
> }
>=20
> check_prog()
> {
> _var=3D3D"$1"; _name=3D3D"$2"
>=20
> eval _tmp=3D3D\"\$$_var\"
> if [ "x$_tmp" !=3D3D "x" ]; then
> # Variable is already set (by the user, for example)
> return 0
> fi
>=20
> for _d in `echo $PATH | tr ':' ' '`; do
> if [ -f "$_d/$_name" ] && [ -x "$_d/$_name" ]; then
> # Program found
> eval $_var=3D3D\""$_d/$_name"\"
> return 1
> fi
> done
>=20
> die "$_name not found in path."
> }
>=20
> opsys_finish()
> {
> case "$opsys" in
> IRIX)
> if [ -n "$imakeopts" ]; then
> echo "IMAKEOPTS+=3D3D =
$imakeopts" >> =3D
> ${TARGET_MKCONF}
> fi
> if [ `uname -r` -lt 6 ]; then
> echo_msg "Installing fake ldd script"
> run_cmd "$install_sh -c -o $user -g $group -m =
=3D
> 755 $pkgsrcdir/pkgtools/bootstrap-extras/files/fakeldd $prefix/sbin"
> need_extras=3D3Dyes
> echo "LDD=3D3D =3D
> $prefix/sbin/fakeldd" >> ${TARGET_MKCONF}
> fi
> ;;
> Haiku)
> need_extras=3D3Dyes
> echo "LDD=3D3D =
$prefix/sbin/fakeldd" =3D
>>> ${TARGET_MKCONF}
> ;;
> esac
> }
>=20
> is_root()
> {
> if [ `uname -s` =3D3D "IRIX" ]; then
> if [ `uname -r` -lt 6 -a -z "$ID" ]; then
> # older version of IRIX have an id command with limited =
features
> if [ "`$idprog`" !=3D3D "uid=3D3D0(root) =
gid=3D3D0(sys)"=3D
> ]; then
> return 1
> fi
> return 0
> fi
> fi
> if [ `$idprog -u` !=3D3D 0 ]; then
> return 1
> fi
> return 0
> }
>=20
> # run a command, abort if it fails
> run_cmd()
> {
> echo_msg "running: $@"
> eval "$@"
> ret=3D3D$?
> if [ $ret -ne 0 ]; then
> echo_msg "exited with status $ret"
> die "aborted."
> fi
> }
>=20
> # Some versions of mkdir (notably SunOS) bail out too easily, so use =
the
> # install-sh wrapper instead.
> mkdir_p()
> {
> for dir in $@; do
> run_cmd "$install_sh -d -o $user -g $group $dir"
> done
> }
>=20
> mkdir_p_early()
> {
> [ -d "$1" ] && return 0
> mkdir -p "$1" 2> /dev/null && return 0
> parent=3D3D`dirname "$1"`
> mkdir_p_early "$parent"
> if [ ! -d "$1" ] && mkdir "$1"; then
> echo_msg "mkdir $1 exited with status $?"
> die "aborted."
> fi
> return 0
> }
>=20
> copy_src()
> {
> _src=3D3D"$1"; _dst=3D3D"$2"
> if [ ! -d $wrkdir/$_dst ]; then
> mkdir_p $wrkdir/$_dst
> fi
> $cpprog -r $_src/* $wrkdir/$_dst
> if [ -f $wrkdir/$_dst/config.guess ]; then
> $cpprog $pkgsrcdir/mk/gnu-config/config.guess =3D
> $wrkdir/$_dst/
> fi
> if [ -f $wrkdir/$_dst/config.sub ]; then
> $cpprog $pkgsrcdir/mk/gnu-config/config.sub =3D
> $wrkdir/$_dst/
> fi
> }
>=20
> get_optarg()
> {
> expr "x$1" : "x[^=3D3D]*=3D3D\\(.*\\)"
> }
>=20
> checkarg_sane_absolute_path()
> {
> case "$1" in
> "") ;; # the default value will be used.
> *[!-A-Za-z0-9_./]*)
> die "ERROR: Invalid characters in path $1 (from $2)." =
;;
> */) die "ERROR: The argument to $2 must not end in /." ;;
> *//* | */. | */./* | */.. | */../*)
> die "ERROR: The path $1 (from $2) must be canonical." =
;;
> /*) [ "${3-}" =3D3D "may-be-symlink" ] \
> || checkarg_no_symlink_path "$1" "$2" ;;
> *) die "ERROR: The argument to $2 must be an absolute =3D
> path." ;;
> esac
> }
>=20
> checkarg_no_symlink_path()
> {
> _dir=3D3D$1
> while [ ! -d "$_dir" ]; do
> _dir=3D3D${_dir%/*}
> [ "$_dir" ] || _dir=3D3D"/"
> done
>=20
> _realdir=3D3D`cd "$_dir" && exec pwd`
> [ "$_realdir" =3D3D "$_dir" ] && return
>=20
> die "ERROR: The path $1 (from $2) must not contain symlinks.
>=20
> Given path : $1
> Resolved path: $_realdir${1##${_dir}}
>=20
> Several packages assume that the given path of $2 stays the =
same =3D
> when
> symlinks are resolved. When that assumption fails, they will:
>=20
> * not find some include files or libraries during the build =3D
> phase
> since the files from dependencies are not installed in
> \${WRKDIR}/.buildlink.
>=20
> * install their files into the wrong path inside =3D
> \${WRKDIR}/.destdir,
> which will fail the PLIST check during the install phase."
> }
>=20
> checkarg_sane_relative_path() {
> case "$1" in
> "") ;; # the default value will be used.
> *[!-A-Za-z0-9_./]*)
> die "ERROR: Invalid characters in path $1 (from $2)." =
;;
> /*) die "ERROR: The argument to $2 must be a relative =
path." =3D
> ;;
> *) ;;
> esac
> }
>=20
> bootstrap_sh=3D3D${SH-/bin/sh}
> bootstrap_sh_set=3D3D${SH+set}
>=20
> case "$bootstrap_sh" in
> /*)
> ;;
> *)
> die "ERROR: The variable SH must contain an absolute path"
> ;;
> esac
>=20
> # On some newer Ubuntu installations, /bin/sh is a symlink to =
/bin/dash,
> # whose echo(1) is not BSD-compatible.
> # On all Debian GNU/kFreeBSD 7.0, /bin/sh is a symlink to /bin/dash, =
and
> # use /bin/bash. bootstrap forces /bin/bash is used.
> dash_echo_test=3D3D`$bootstrap_sh -c 'echo "\\100"'`
> if [ "$opsys" !=3D3D "GNUkFreeBSD" ] && [ "$dash_echo_test" =3D3D "@" =
]; =3D
> then
> { echo "ERROR: Your shell's echo command is not =
BSD-compatible."
> echo "ERROR: Please select another shell by setting the =3D
> environment"
> echo "ERROR: variable SH."
> } 1>&2
> exit 1;
> fi
>=20
> if [ -n "$PKG_PATH" ]; then
> die "ERROR: Please unset PKG_PATH before running bootstrap."
> fi
>=20
> build_start=3D3D`date`
> echo_msg "bootstrap command: $0 $@"
> =3D3D=3D3D=3D3D> bootstrap command: ./bootstrap --prefix=3D3D/usr/pkg2 =
--varbase
> echo_msg "bootstrap started: $build_start"
> =3D3D=3D3D=3D3D> bootstrap started: Thu Jul 11 19:26:29 JST 2019
>=20
> # ensure system locations are empty; we will set them later when we =
know
> # whether they will be system wide or user specific
> prefix=3D3D
> pkgdbdir=3D3D
> pkginfodir=3D3D
> pkgmandir=3D3D
> sysconfdir=3D3D
> varbase=3D3D
>=20
> compiler=3D3D""
> cwrappers=3D3Dauto
> full=3D3Dno
> make_jobs=3D3D1
> mk_fragment=3D3D
> quiet=3D3Dno
>=20
> while [ $# -gt 0 ]; do
> case $1 in
> --workdir=3D3D*) wrkdir=3D3D`get_optarg "$1"` ;;
> --workdir) wrkdir=3D3D"$2"; shift ;;
> --prefix=3D3D*) prefix=3D3D`get_optarg "$1"` ;;
> --prefix) prefix=3D3D"$2"; shift ;;
> --pkgdbdir=3D3D*) pkgdbdir=3D3D`get_optarg "$1"` ;;
> --pkgdbdir) pkgdbdir=3D3D"$2"; shift ;;
> --pkginfodir=3D3D*) pkginfodir=3D3D`get_optarg "$1"` ;;
> --pkginfodir) pkginfodir=3D3D"$2"; shift ;;
> --pkgmandir=3D3D*) pkgmandir=3D3D`get_optarg "$1"` ;;
> --pkgmandir) pkgmandir=3D3D"$2"; shift ;;
> --sysconfdir=3D3D*) sysconfdir=3D3D`get_optarg "$1"` ;;
> --sysconfdir) sysconfdir=3D3D"$2"; shift ;;
> --varbase=3D3D*) varbase=3D3D`get_optarg "$1"` ;;
> --varbase) varbase=3D3D"$2"; shift ;;
> --compiler=3D3D*) compiler=3D3D`get_optarg "$1"` ;;
> --compiler) compiler=3D3D"$2"; shift ;;
> --abi=3D3D*) abi=3D3D`get_optarg "$1"` ;;
> --abi) abi=3D3D"$2"; shift ;;
> --cwrappers=3D3D*) cwrappers=3D3D`get_optarg "$1"` ;;
> --cwrappers) cwrappers=3D3D"$2"; shift ;;
> --unprivileged | --ignore-user-check) unprivileged=3D3Dyes ;;
> --prefer-pkgsrc=3D3D*)
> prefer_pkgsrc=3D3D`get_optarg "$1"` ;;
> --prefer-pkgsrc)
> prefer_pkgsrc=3D3D"$2"; shift ;;
> --preserve-path) preserve_path=3D3Dyes ;;
> --mk-fragment=3D3D*)
> mk_fragment=3D3D`get_optarg "$1"` ;;
> --mk-fragment)
> mk_fragment=3D3D"$2"; shift ;;
> --binary-kit=3D3D*)
> binary_kit=3D3D`get_optarg "$1"` ;;
> --binary-kit)
> binary_kit=3D3D"$2"; shift ;;
> --gzip-binary-kit=3D3D*)
> binary_gzip_kit=3D3D`get_optarg "$1"` ;;
> --gzip-binary-kit)
> binary_gzip_kit=3D3D"$2"; shift ;;
> --binary-macpkg=3D3D*)
> binary_macpkg=3D3D`get_optarg "$1"` ;;
> --binary-macpkg)
> binary_macpkg=3D3D"$2"; shift ;;
> --make-jobs=3D3D*) make_jobs=3D3D`get_optarg "$1"` ;;
> --make-jobs) make_jobs=3D3D"$2"; shift ;;
> --full) full=3D3Dyes ;;
> --quiet) quiet=3D3Dyes ;;
> --help) echo "$usage"; exit ;;
> -h) echo "$usage"; exit ;;
> -*) echo "${0##*/}: unknown option \"$1\"" 1>&2
> echo "$usage" 1>&2; exit 1 ;;
> esac
> shift
> done
> ./bootstrap: cannot shift
>=20
>=20
>=20
>> 2019/07/07 18:05=3DE3=3D80=3D81Benny Siegert =3D
> <bsiegert%gmail.com@localhost>=3DE3=3D81=3DAE=3DE3=3D83=3DA1=3DE3=3D83=3DBC=3DE3=3D=
83=3DAB:
>> =3D20
>> The following reply was made to PR pkg/54349; it has been noted by =3D
> GNATS.
>> =3D20
>> From: Benny Siegert <bsiegert%gmail.com@localhost>
>> To: gnats-bugs%netbsd.org@localhost
>> Cc: pkg-manager%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, =3D
> pkgsrc-bugs%netbsd.org@localhost
>> Subject: Re: pkg/54349: bootstrap with --prefix fails on Solaris 10
>> Date: Sun, 7 Jul 2019 11:01:16 +0200
>> =3D20
>> On Sun, Jul 7, 2019 at 8:49 AM <hiroshi-hakoyama%nagano.ac.jp@localhost> wrote:
>> =3D20
>>> =3D3D=3D3D=3D3D> bootstrap started: Sat Jul 6 18:58:16 JST 2019
>>> ./bootstrap: bad substitution
>> =3D20
>>>> Fix:
>>> a workaround:
>>> =3D20
>>> vi bootstrap
>>> #! /bin/sh -> #! /usr/bin/bash
>> =3D20
>> Thank you for the report! Do you happen to know where in the file =
this
>> happens, i.e. can you get a line number?
>> =3D20
>> =3D20
>> --=3D20
>> Benny
>> =3D20
>=20
Home |
Main Index |
Thread Index |
Old Index