Page MenuHomeFreeBSD

D46997.diff
No OneTemporary

D46997.diff

diff --git a/usr.bin/env/env.1 b/usr.bin/env/env.1
--- a/usr.bin/env/env.1
+++ b/usr.bin/env/env.1
@@ -28,7 +28,7 @@
.\" SUCH DAMAGE.
.\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp
.\"
-.Dd March 3, 2021
+.Dd October 7, 2024
.Dt ENV 1
.Os
.Sh NAME
@@ -171,6 +171,19 @@
and
.Ar utility
may not be specified together.
+.Pp
+The
+.Nm
+utility does not handle values of
+.Ar utility
+which have an equals sign
+.Pq Ql =
+in their name, for obvious reasons.
+This can easily be worked around by interposing the
+.Xr command 1
+utility, which simply executes its arguments; see
+.Sx EXAMPLES
+below.
.\"
.Ss Details of -S (split-string) processing
The processing of the
@@ -469,6 +482,11 @@
options:
.Pp
.Dl "#!/usr/bin/env -S-P/usr/local/bin:/usr/bin:${PATH} perl"
+.Pp
+To execute a utility with an equal sign in its name:
+.Bd -literal -offset indent
+env name=value ... command foo=bar arg ...
+.Ed
.Sh COMPATIBILITY
The
.Nm
@@ -514,14 +532,6 @@
.Sh BUGS
The
.Nm
-utility does not handle values of
-.Ar utility
-which have an equals sign
-.Pq Ql =
-in their name, for obvious reasons.
-.Pp
-The
-.Nm
utility does not take multibyte characters into account when
processing the
.Fl S
diff --git a/usr.bin/env/tests/env_test.sh b/usr.bin/env/tests/env_test.sh
--- a/usr.bin/env/tests/env_test.sh
+++ b/usr.bin/env/tests/env_test.sh
@@ -89,6 +89,25 @@
env -P "${PWD}" magic_words
}
+atf_test_case equal
+equal_head()
+{
+ atf_set "descr" "Command name contains equal sign"
+}
+equal_body()
+{
+ echo "echo ${magic_words}" >"magic=words"
+ chmod 0755 "magic=words"
+ atf_check -o match:"^${PWD}/magic=words$" \
+ env "${PWD}/magic=words"
+ atf_check -o match:"^magic=words$" \
+ env -P "${PATH}:${PWD}" "magic=words"
+ atf_check -o inline:"${magic_words}\n" \
+ env command "${PWD}/magic=words"
+ atf_check -o inline:"${magic_words}\n" \
+ env PATH="${PATH}:${PWD}" command "magic=words"
+}
+
atf_init_test_cases()
{
atf_add_test_case basic
@@ -97,4 +116,5 @@
atf_add_test_case true
atf_add_test_case false
atf_add_test_case altpath
+ atf_add_test_case equal
}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 11:02 PM (19 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14810812
Default Alt Text
D46997.diff (2 KB)

Event Timeline