Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use %systemroot% in place of %windir%. PATH exceed 2048 breaks choco #252

Closed
davehorner opened this issue Apr 21, 2015 · 4 comments
Closed

Comments

@davehorner
Copy link

Pull request: #251

%windir% is broken when %path% exceeds 2048 chars, but %systemroot% continues to work.

I found this issue due to cygwin rewriting my PATH to larger than 2048 I believe...
when I echo %windir%, it just prints %windir%.
when I echo %systemroot%, it prints C:\Windows.

I found this from the superuser ticket.
http://superuser.com/questions/719459/strange-path-issue-in-windows-7-goes-null-after-being-set
http://allgeekallthetime.blogspot.com/2012/01/path-over-2048-chars-kills-windir.html

The user experiences something like this:
XXX not upgraded. An error occurred during installation: Unable to find suitable location for PowerShell. Searched the following locations: '%windir%\SysNative\WindowsPowerShell\v1.0\powershell.exe; %windir%\System32\WindowsPowerShell\v1.0\powershell.exe; powershell.exe'

Which is a little confusing, because running powershell.exe works fine. I leave it to the merger to decide if %systemroot% should replace the %windir%, the fix supplied simply adds %systemroot% in addition to %windir%...this works fine too.

Thanks for choco.
--dave

@ferventcoder
Copy link
Member

Interesting...

@davehorner
Copy link
Author

crazy that modern windows OS has a strict limit of 2048 and breaks %windir% which incidentally is just defined as %systemroot% anyways! frustrating...

I got my %windir% working again by pruning the path. No reason to use %windir% if it can fail like this.

@ferventcoder ferventcoder added this to the 0.9.9.7 milestone May 11, 2015
@ferventcoder
Copy link
Member

Cygwin can also have issues with several environment variable not being loaded.

ferventcoder added a commit that referenced this issue Jun 9, 2015
When path exceeds 2048 characters, windir will stop expanding as will
other environment variables. SystemRoot strangely will continue to
work, likely because it is a built-in system variable where windir
expands systemroot.
ferventcoder added a commit that referenced this issue Jun 9, 2015
* stable:
  (GH-252) use systemroot variable instead of windir
@ferventcoder
Copy link
Member

Fixed in 8f9b589 and will be released with 0.9.9.7.

@ferventcoder ferventcoder self-assigned this Jun 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants