Control: tags -1 patch

Colin,

On Wed, Dec 04, 2024 at 04:29:31PM +0000, Colin Watson wrote:
> Package: ucf
> Version: 3.0044
> Severity: important
> 
> I noticed https://salsa.debian.org/cjwatson/debusine/-/jobs/6699495
> today, containing:

Thanks for this.

I think using awk might work well here. Suggested patch attached.

Mu initial test here is promising. Can you verify it fixes the behaviour for 
you?

Thanks

Mark
>From fd2cf84de498b4bc08f30773a1e77629730209c9 Mon Sep 17 00:00:00 2001
From: Mark Hindley <[email protected]>
Date: Wed, 4 Dec 2024 18:02:42 +0000
Subject: [PATCH] When sanitizing the environment, handle multiline variables.

Closes: #1089043
---
 ucf  | 3 +--
 ucfr | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/ucf b/ucf
index b627038..34d4c38 100755
--- a/ucf
+++ b/ucf
@@ -5,7 +5,6 @@ set -e
 
 # Sanitise environment
 while read -r env ; do
-    env="${env%%=*}"
     case "$env" in
 	PATH|PWD|TERM) ;;
 	DEB_*|DEBIAN_*|DEBCONF_*) ;;
@@ -13,7 +12,7 @@ while read -r env ; do
 	*) unset "$env" ;;
     esac
 done<<EOF
-$(env)
+$(env -0 | awk -v RS='\0' -F= '{print $1}')
 EOF
 
 # set the version and revision
diff --git a/ucfr b/ucfr
index f71f572..077260c 100755
--- a/ucfr
+++ b/ucfr
@@ -5,14 +5,13 @@ set -e
 
 # Sanitise environment
 while read -r env ; do
-    env="${env%%=*}"
     case "$env" in
 	PATH|PWD|TERM) ;;
 	UCF_*) ;;
 	*) unset "$env" ;;
     esac
 done<<EOF
-$(env)
+$(env -0 | awk -v RS='\0' -F= '{print $1}')
 EOF
 
 # set the version and revision
-- 
2.39.5

Reply via email to