Closed Bug 554201 Opened 14 years ago Closed 13 years ago

cmd.exe bin\activate complains "\ActiveState was unexpected at this time."

Categories

(Add-on SDK Graveyard :: General, defect, P3)

x86_64
Windows 7
defect

Tracking

(Not tracked)

RESOLVED FIXED
Future

People

(Reporter: myk, Unassigned)

Details

Attachments

(1 file)

When I run bin\activate in cmd.exe, it complains "\ActiveState was unexpected at this time."  Presumably this is a reference to my path, which looks like this before I run bin\activate:

PATH=C:\Python26\;C:\Program Files (x86)\ActiveState Komodo IDE 5\;C:\Windows\sy
stem32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell
\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\

It looks like this after I run bin\activate:

(C:\Users\myk\jetpack-sdk) C:\Users\myk\jetpack-sdk>PATH
PATH=C:\Users\myk\jetpack-sdk-0.2rc1\bin;C:\Python26\;C:\Program Files (x86)\Act
iveState Komodo IDE 5\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C
:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL
Server\90\Tools\binn\

It's not clear whether the complaint actually affects the activation (I see bug 553739 afterwards, but that seems coincidental), but the activation script should probably expect \ActiveState, which seems like part of a perfectly valid PATH.
Erm, after further testing, it looks like this only happens the second and subsequent times I run bin\activate in the same cmd.exe session.  The first time it doesn't raise that complaint.  So the behavior is as follows:

C:\Users\myk>PATH
PATH=C:\Python26\;C:\Program Files (x86)\ActiveState Komodo IDE 5\;C:\Windows\sy
stem32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell
\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\

C:\Users\myk>cd jetpack-sdk

C:\Users\myk\jetpack-sdk>bin\activate
Welcome to the Jetpack SDK. Run 'cfx docs' for assistance.
(C:\Users\myk\jetpack-sdk) C:\Users\myk\jetpack-sdk>PATH
PATH=C:\Users\myk\jetpack-sdk\bin;C:\Python26\;C:\Program Files (x86)\ActiveStat
e Komodo IDE 5\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windo
ws\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\
90\Tools\binn\

(C:\Users\myk\jetpack-sdk) C:\Users\myk\jetpack-sdk>bin\activate
\ActiveState was unexpected at this time.
(C:\Users\myk\jetpack-sdk) C:\Users\myk\jetpack-sdk>PATH
PATH=C:\Users\myk\jetpack-sdk\bin;C:\Python26\;C:\Program Files (x86)\ActiveStat
e Komodo IDE 5\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windo
ws\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\
90\Tools\binn\
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
Priority: -- → P3
Target Milestone: --- → Future
I just struck this - the problem generally starts with deactivate.bat:

if defined _OLD_VIRTUAL_PATH (
    set PATH=%_OLD_VIRTUAL_PATH%
)

If the expansion of _OLD_VIRTUAL_PATH has a closing parens then it closes the "if defined" block.  The trick is to quote the set statement.

As deactivate.bat fails it leaves some env vars set, so subsequent runs of activate.bat fail in the same way when using these variables.

In theory, the exact same problem will happen if prompt has parens.

Attaching a patch which quotes all occurrences of env var expansion inside an "if defined" block.
Attachment #539706 - Flags: review? → review?(myk)
Comment on attachment 539706 [details] [diff] [review]
Quote all env var expansion inside "if defined ..." blocks

Looks good, works well, r=myk!
Attachment #539706 - Flags: review?(myk) → review+
Thanks for the fix!

https://github.com/mozilla/addon-sdk/commit/8532a03acb36add86a6b6fc49deae09f114ae67e
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: