Do not use global $version when writing Makefile

In func_wrt_makefile, the two functions LUSER_wrt_unpack and
CHROOT_Unpack use the version variable without setting it.
This leads to the global version variable being used, which
writes garbage into the Makefile. Fix: just define version locally.

This bug does not occur often because those functions are only
used when using custom scripts for versioned packages (if building LFS).
It has been found by William Harrington.
This commit is contained in:
Pierre Labastie 2021-06-04 21:13:04 +02:00
parent cfdb089dcf
commit 0722dde31d

View file

@ -214,8 +214,12 @@ EOF
#----------------------------------#
LUSER_wrt_unpack() { # Unpack and set 'ROOT' var
#----------------------------------#
local FILE=$1
local optSAVE_PREVIOUS=$2
local FILE="$1"
local optSAVE_PREVIOUS="$2"
local version
if [ "$3" != "" ]; then
version=-"$3"
fi
if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
(
@ -239,6 +243,10 @@ CHROOT_Unpack() { #
#----------------------------------#
local FILE=$1
local optSAVE_PREVIOUS=$2
local version
if [ "$3" != "" ]; then
version=-"$3"
fi
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
(