[PATCH 1/3] [cmd] "PATH=value" fails whereas "PATH value" works
Ann and Jason Edmeades
jason at edmeades.me.uk
Tue Sep 4 17:48:22 CDT 2012
PATH=value syntax fails to work as the 'equals' sign is treated as
a command delimiter meaning the value ends up in param2 nor param1.
Whilst the actual params arent used once the syntax is recognized,
the lack of a first parameter causes the PATH code to assume it was
issued as a standalone command and hence echos the path back to the
user.
[BUG 26749]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120904/c25544dd/attachment.html>
-------------- next part --------------
From 910e41795e809f813ee02940717339352eedf562 Mon Sep 17 00:00:00 2001
From: Jason Edmeades <jason at edmeades.me.uk>
Date: Tue, 4 Sep 2012 00:30:17 +0100
Subject: [PATCH 1/3] [cmd] "PATH=value" fails whereas "PATH value" works
PATH=value syntax fails to work as the 'equals' sign is treated as
a command delimiter meaning the value ends up in param2 nor param1.
Whilst the actual params arent used once the syntax is recognized,
the lack of a first parameter causes the PATH code to assume it was
issued as a standalone command and hence echos the path back to the
user.
[BUG 26749]
---
programs/cmd/builtins.c | 2 +-
programs/cmd/tests/test_builtins.cmd | 11 +++++++++++
programs/cmd/tests/test_builtins.cmd.exp | 4 ++++
3 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 16f4eff..b2546d4 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -2371,7 +2371,7 @@ void WCMD_setshow_path (const WCHAR *command) {
static const WCHAR pathW[] = {'P','A','T','H','\0'};
static const WCHAR pathEqW[] = {'P','A','T','H','=','\0'};
- if (strlenW(param1) == 0) {
+ if (strlenW(param1) == 0 && strlenW(param2) == 0) {
status = GetEnvironmentVariableW(pathW, string, sizeof(string)/sizeof(WCHAR));
if (status != 0) {
WCMD_output_asis ( pathEqW);
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index 13b53c5..093cc23 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -1530,6 +1530,17 @@ if d==d goto dest4
:dest4 at space@
echo goto with a following space worked
+echo ------------ Testing PATH ------------
+set backup_path=%path%
+set path=original
+path
+path try2
+path
+path=try3
+path
+set path=%backup_path%
+set backup_path=
+
echo ------------ Testing combined CALLs/GOTOs ------------
echo @echo off>foo.cmd
echo goto :eof>>foot.cmd
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index b7bcd96..93b11e5 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -825,6 +825,10 @@ goto with no leading space worked
goto with a leading space worked
goto with a leading tab worked
goto with a following space worked
+------------ Testing PATH ------------
+PATH=original
+PATH=try2
+PATH=try3
------------ Testing combined CALLs/GOTOs ------------
world
cheball
--
1.7.5.4
More information about the wine-patches
mailing list