John Eckersberg
2015-Aug-12 14:43 UTC
[Libguestfs] [PATCH v2] dib: handle unsetting functions in environment
When I turned off debug and actually looked at the normal output, this is a bit noisy... [jeckersb@baozi libguestfs]$ ./run virt-dib -B ~/git/diskimage-builder/lib/ --element-path ~/git/diskimage-builder/elements/ fedora-minimal [ 0.0] Elements: base fedora-minimal [ 0.0] Expanded elements: base dib-init-system dib-run-parts fedora-minimal install-types package-installs pkg-map redhat-common rpm-distro yum yum-minimal [ 0.0] Carried environment variables: [ 0.0] Preparing auxiliary data [ 0.2] Running: extra-data.d/10-create-pkg-map-dir /tmp/dib.dQ8W3Z/aux/fake-bin/sudo: line 39: unset: `BASH_FUNC_module()': not a valid identifier /tmp/dib.dQ8W3Z/aux/fake-bin/sudo: line 39: unset: `BASH_FUNC_scl()': not a valid identifier /tmp/dib.dQ8W3Z/aux/fake-bin/sudo: line 39: unset: `BASH_FUNC_module()': not a valid identifier /tmp/dib.dQ8W3Z/aux/fake-bin/sudo: line 39: unset: `BASH_FUNC_scl()': not a valid identifier /tmp/dib.dQ8W3Z/aux/fake-bin/sudo: line 39: unset: `BASH_FUNC_module()': not a valid identifier /tmp/dib.dQ8W3Z/aux/fake-bin/sudo: line 39: unset: `BASH_FUNC_scl()': not a valid identifier [ 0.2] Running: extra-data.d/50-store-build-settings [ 0.2] Running: extra-data.d/99-enable-install-types [ 0.2] Running: extra-data.d/99-squash-package-install [ 0.3] Running: extra-data.d/99-yum-repo-conf [ 0.3] Opening the disks ...etc... So this one instead dumps the noise into /dev/null
John Eckersberg
2015-Aug-12 14:43 UTC
[Libguestfs] [PATCH] dib: handle unsetting functions in environment
If a function name, with its trailing parentheses, is in the
environment , trying to unset it will error out with a message of "not
a valid identifier". In this case, try to unset it again with the -f
option which can handle the parentheses in the supplied identifier.
---
dib/dib.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dib/dib.ml b/dib/dib.ml
index d730527..519da51 100644
--- a/dib/dib.ml
+++ b/dib/dib.ml
@@ -283,7 +283,7 @@ if [ -z \"$preserve_env\" ]; then
for envvar in `env | grep '^\\w' | cut -d= -f1`; do
case \"$envvar\" in
PATH | USER | USERNAME | HOSTNAME | TERM | LANG | HOME | SHELL | LOGNAME
) ;;
- *) unset $envvar ;;
+ *) unset $envvar || unset -f $envvar;;
esac
done
fi
--
2.4.3
Reasonably Related Threads
- Re: [PATCH] dib: handle unsetting functions in environment
- [PATCH] dib: handle unsetting functions in environment
- [PATCH v4] dib: handle unsetting functions in environment
- [PATCH 0/1] dib: handle unsetting functions in environment
- [PATCH v2] dib: handle unsetting functions in environment