Hi,

On Wed, Dec 04, 2024 at 09:31:02PM +0000, Mark Hindley wrote:
> I am going to remove the new environment santisation until I have something 
> more
> robust.

My proposed more robust solution which addresses the substantive issues you both
reported is below. Comments gratefully received.

Thanks

Mark

diff --git a/ucf b/ucf
index b627038..ac6c0d6 100755
--- a/ucf
+++ b/ucf
@@ -5,15 +5,15 @@ set -e
 
 # Sanitise environment
 while read -r env ; do
-    env="${env%%=*}"
     case "$env" in
+       '') continue ;;
        PATH|PWD|TERM) ;;
        DEB_*|DEBIAN_*|DEBCONF_*) ;;
        UCF_*) ;;
        *) unset "$env" ;;
     esac
 done<<EOF
-$(env)
+$(awk 'BEGIN{for(v in ENVIRON) print v}')
 EOF
 
 # set the version and revision
diff --git a/ucfr b/ucfr
index f71f572..b58b026 100755
--- a/ucfr
+++ b/ucfr
@@ -5,14 +5,14 @@ set -e
 
 # Sanitise environment
 while read -r env ; do
-    env="${env%%=*}"
     case "$env" in
+       '') continue ;;
        PATH|PWD|TERM) ;;
        UCF_*) ;;
        *) unset "$env" ;;
     esac
 done<<EOF
-$(env)
+$(awk 'BEGIN{for(v in ENVIRON) print v}')
 EOF
 
 # set the version and revision

Reply via email to