[pacman-dev] [PATCH] makepkg: use more schema.sh to clean the environment of special variables
Fixes "arch" and "checkdepends" never having been unset, fixes b2sums (but not ${!b2sums_@}) being recently left out. The "build" function used to be unset as well, explicitly unset it as a function and do the same for other official functions as well. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> --- scripts/makepkg.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9708a65e..7f1a03df 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1214,9 +1214,9 @@ else fi fi -unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides -unset md5sums replaces depends conflicts backup source install changelog build -unset sha{1,224,256,384,512}sums makedepends optdepends options noextract validpgpkeys +unset "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}" +unset "${known_hash_algos[@]/%/sums}" +unset -f pkgver prepare build check package "${!package_@}" unset "${!makedepends_@}" "${!depends_@}" "${!source_@}" "${!checkdepends_@}" unset "${!optdepends_@}" "${!conflicts_@}" "${!provides_@}" "${!replaces_@}" unset "${!md5sums_@}" "${!sha1sums_@}" "${!sha224sums_@}" "${!sha256sums_@}" -- 2.21.0
On 1/4/19 2:51 am, Eli Schwartz wrote:
Fixes "arch" and "checkdepends" never having been unset, fixes b2sums (but not ${!b2sums_@}) being recently left out. The "build" function used to be unset as well, explicitly unset it as a function and do the same for other official functions as well.
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> --- scripts/makepkg.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9708a65e..7f1a03df 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1214,9 +1214,9 @@ else fi fi
-unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides -unset md5sums replaces depends conflicts backup source install changelog build -unset sha{1,224,256,384,512}sums makedepends optdepends options noextract validpgpkeys +unset "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}" +unset "${known_hash_algos[@]/%/sums}" +unset -f pkgver prepare build check package "${!package_@}" unset "${!makedepends_@}" "${!depends_@}" "${!source_@}" "${!checkdepends_@}" unset "${!optdepends_@}" "${!conflicts_@}" "${!provides_@}" "${!replaces_@}" unset "${!md5sums_@}" "${!sha1sums_@}" "${!sha224sums_@}" "${!sha256sums_@}"
No. allan@kamala ~ $ pkgver=1 allan@kamala ~ $ unset -f pkgver allan@kamala ~ $ echo $pkgver 1 allan@kamala ~ $ unset pkgver allan@kamala ~ $ echo $pkgver The unset of the ${!package_@} needs its own line if you really want the -f there. A
On 5/7/19 8:10 PM, Allan McRae wrote:
On 1/4/19 2:51 am, Eli Schwartz wrote:
Fixes "arch" and "checkdepends" never having been unset, fixes b2sums (but not ${!b2sums_@}) being recently left out. The "build" function used to be unset as well, explicitly unset it as a function and do the same for other official functions as well.
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> --- scripts/makepkg.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9708a65e..7f1a03df 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1214,9 +1214,9 @@ else fi fi
-unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides -unset md5sums replaces depends conflicts backup source install changelog build -unset sha{1,224,256,384,512}sums makedepends optdepends options noextract validpgpkeys +unset "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}" +unset "${known_hash_algos[@]/%/sums}" +unset -f pkgver prepare build check package "${!package_@}" unset "${!makedepends_@}" "${!depends_@}" "${!source_@}" "${!checkdepends_@}" unset "${!optdepends_@}" "${!conflicts_@}" "${!provides_@}" "${!replaces_@}" unset "${!md5sums_@}" "${!sha1sums_@}" "${!sha224sums_@}" "${!sha256sums_@}"
No.
allan@kamala ~ $ pkgver=1
allan@kamala ~ $ unset -f pkgver
allan@kamala ~ $ echo $pkgver 1
allan@kamala ~ $ unset pkgver
allan@kamala ~ $ echo $pkgver
pkgver= should be unset by unsetting "${pkgbuild_schema_strings[@]}". The existence of the unset -f line is just to do additional cleanup of the functions themselves.
The unset of the ${!package_@} needs its own line if you really want the -f there.
A
-- Eli Schwartz Bug Wrangler and Trusted User
On 8/5/19 10:10 am, Allan McRae wrote:
On 1/4/19 2:51 am, Eli Schwartz wrote:
Fixes "arch" and "checkdepends" never having been unset, fixes b2sums (but not ${!b2sums_@}) being recently left out. The "build" function used to be unset as well, explicitly unset it as a function and do the same for other official functions as well.
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> --- scripts/makepkg.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9708a65e..7f1a03df 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1214,9 +1214,9 @@ else fi fi
-unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides -unset md5sums replaces depends conflicts backup source install changelog build -unset sha{1,224,256,384,512}sums makedepends optdepends options noextract validpgpkeys +unset "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}" +unset "${known_hash_algos[@]/%/sums}" +unset -f pkgver prepare build check package "${!package_@}" unset "${!makedepends_@}" "${!depends_@}" "${!source_@}" "${!checkdepends_@}" unset "${!optdepends_@}" "${!conflicts_@}" "${!provides_@}" "${!replaces_@}" unset "${!md5sums_@}" "${!sha1sums_@}" "${!sha224sums_@}" "${!sha256sums_@}"
No.
allan@kamala ~ $ pkgver=1 ...
And I've been away for too long. This is unsetting the pkgver() function. However, we are missing pkgname here. A
Fixes "arch" and "checkdepends" never having been unset, fixes b2sums (but not ${!b2sums_@}) being recently left out. The "build" function used to be unset as well, explicitly unset it as a function and do the same for other official functions as well. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> --- v2: explicitly unset pkgname as it is not in schema.sh (it can be either a string or an array, so fits in neither ATM). scripts/makepkg.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 275410e7..6f346ff3 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1208,9 +1208,9 @@ else fi fi -unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides -unset md5sums replaces depends conflicts backup source install changelog build -unset sha{1,224,256,384,512}sums makedepends optdepends options noextract validpgpkeys +unset pkgname "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}" +unset "${known_hash_algos[@]/%/sums}" +unset -f pkgver prepare build check package "${!package_@}" unset "${!makedepends_@}" "${!depends_@}" "${!source_@}" "${!checkdepends_@}" unset "${!optdepends_@}" "${!conflicts_@}" "${!provides_@}" "${!replaces_@}" unset "${!md5sums_@}" "${!sha1sums_@}" "${!sha224sums_@}" "${!sha256sums_@}" -- 2.21.0
participants (2)
-
Allan McRae
-
Eli Schwartz