[PATCH] Fix bug with unset on environment variables with newlines
by John Eckersberg
If an environment variable has a newline in it (my TERMCAP is like
this) then review-env.sh incorrectly tries to unset the first token
after the newline, which is typically not a valid variable.
This changes env and sed invocation to use null-byte terminators
instead of newlines, which avoids the problem altogether.
---
plugins/shell_api.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/shell_api.py b/plugins/shell_api.py
index fc4269f..b72c3e5 100644
--- a/plugins/shell_api.py
+++ b/plugins/shell_api.py
@@ -40,7 +40,7 @@ ENVIRON_TEMPLATE = """
# shell API plugin. No need to modify it or anything.
#
-unset $(env | sed -n 's/=.*//p')
+unset $(env -0 | sed -z -n 's/=.*/ /p')
PATH=/bin:/usr/bin:/sbin/:/usr/sbin
FR_FLAGS_generator
--
1.8.5.3
10 years, 1 month