This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove trailing '/' from prefix
authorH.Merijn Brand - Tux <h.m.brand@xs4all.nl>
Thu, 25 Jul 2019 13:52:44 +0000 (15:52 +0200)
committerH.Merijn Brand - Tux <h.m.brand@xs4all.nl>
Thu, 25 Jul 2019 13:52:44 +0000 (15:52 +0200)
Change how/when the trailing '/' from a prefix is removed.

The original code had two problems:

1) it only stripped the trailing slash when value was predefined
   (either from -Dprefix=/foo/bar/ or from a previous configure run)
2) when it did strip the value then it also caused 'oldprefix' to
   be set. This in turns causes other predefined (/cached) paths to
   be ignored.

See https://rt.perl.org/Public/Bug/Display.html?id=134284

U/installdirs/prefix.U

index c990174..74f81cf 100644 (file)
 ?H:.
 : determine root of directory hierarchy where package will be installed.
 case "$prefix" in
-'')
-       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
+'')    dflt=`./loc . /usr/local /usr/local /local /opt /usr`
        ;;
-*?/)
-       dflt=`echo "$prefix" | sed 's/.$//'`
-       ;;
-*)
-       dflt="$prefix"
+*)     dflt="$prefix"
        ;;
 esac
 $cat <<EOM
@@ -72,14 +67,23 @@ rp='Installation prefix to use?'
 . ./getfile
 oldprefix=''
 case "$prefix" in
-'') ;;
-*)
-       case "$ans" in
+'')    ;;
+*)     case "$ans" in
        "$prefix") ;;
        *) oldprefix="$prefix";;
        esac
        ;;
 esac
-prefix="$ans"
-prefixexp="$ansexp"
+
+case "$ans" in
+*?/)   prefix=`echo "$ans" | sed 's/.$//'`
+       ;;
+*)     prefix="$ans"
+esac
+
+case "$ansexp" in
+*?/)   prefixexp=`echo "$ansexp" | sed 's/.$//'`
+       ;;
+*)     prefixexp="$ansexp"
+esac