Please add /cygdrive/c/Windows/Sysnative to the default PATH

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Please add /cygdrive/c/Windows/Sysnative to the default PATH

Cygwin list mailing list
Dear all:

### Background information (you can skip this)

I use Pluckeye 0.99.60 for Windows.  This is a self-control tool,
available online.  It can help to stop me from visiting certain
time-wasting websites.

I also use Pluckeye's command-line component, pluck.exe.  [I invoke the
tool from Bash 4.4.12.  I'm running Bash on 32-bit Cygwin
3.1.7(0.340/5/3) on 64-bit Windows 10 build 19041.]

pluck.exe is a 64-bit tool, stored in C:\Windows\System32.

### The problem

32-bit tools, such as 32-bit Cygwin, don't usually see the real System32
directory.  Instead, when they try to look inside System32, Windows
shows them the contents of a different directory, which contains only
32-bit System32 tools.

If 32-bit Cygwin needs to run a 64-bit tool, such as pluck.exe (from
Pluckeye) or wsl.exe (from the Windows Subsystem for Linux), it must
look in a different directory instead.  It must look in
C:\Windows\Sysnative.  In this virtual folder, 32-bit Cygwin can see all
the 64-bit System32 tools.

If you try to run pluck.exe without specifying that it's in
/cygdrive/c/Windows/Sysnative, you'll get the output:

[user@host ~]$ pluck
-bash: pluck: command not found

This 'virtual folder' stuff is non-obvious and confusing.  It took me
some time to figure it all out.

### Proposed solution

Cygwin's /etc/profile sets the PATH.

Could /etc/profile please also add /cygdrive/c/Windows/Sysnative to the
end of the PATH?

### Conclusion

Thank you for reading this!

Also, I thank all of you who help out with the Cygwin project.

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

Thomas Wolff


Am 17.11.2020 um 20:54 schrieb tealhill via Cygwin:

> Dear all:
>
> ### Background information (you can skip this)
>
>  ...
>
> ### The problem
>
> 32-bit tools, such as 32-bit Cygwin, don't usually see the real
> System32 directory.  Instead, when they try to look inside System32,
> Windows shows them the contents of a different directory, which
> contains only 32-bit System32 tools.
>
> If 32-bit Cygwin needs to run a 64-bit tool, such as pluck.exe (from
> Pluckeye) or wsl.exe (from the Windows Subsystem for Linux), it must
> look in a different directory instead.  It must look in
> C:\Windows\Sysnative.  In this virtual folder, 32-bit Cygwin can see
> all the 64-bit System32 tools.
>
> If you try to run pluck.exe without specifying that it's in
> /cygdrive/c/Windows/Sysnative, you'll get the output:
>
> [user@host ~]$ pluck
> -bash: pluck: command not found
>
> This 'virtual folder' stuff is non-obvious and confusing.  It took me
> some time to figure it all out.
I ran into this kind of problem myself. These virtual folders are a
nuisance and it's bothersome and tricky to find out, especially as
Sysnative is hidden by default.
But that's a Windows issue, not a cygwin issue. Cygwin doesn't handle
other Windows paths either.
>
> ### Proposed solution
>
> Cygwin's /etc/profile sets the PATH.
>
> Could /etc/profile please also add /cygdrive/c/Windows/Sysnative to
> the end of the PATH?
It doesn't add any other Windows folders so why this one. You should do
that in your ~/.profile.
I'd suggest however to make those virtual folders visible from Cygwin,
so you could find the hidden stuff from /Windows with ls, echo, or `find`.
Thomas
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

Cygwin list mailing list
On 2020-11-17 4:23 PM, Thomas Wolff wrote:
> Am 17.11.2020 um 20:54 schrieb tealhill via Cygwin:
 >>
>> Cygwin's /etc/profile sets the PATH.
>>
>> Could /etc/profile please also add /cygdrive/c/Windows/Sysnative to
>> the end of the PATH?
 >
> It doesn't add any other Windows folders so why this one.

### Summary

Why should Cygwin add Sysnative to $PATH?  As a workaround for
Microsoft's failure to add Sysnative to %PATH%.

### Full explanation

Cygwin imports the Windows %PATH% variable at startup.

It would be ideal if Microsoft would add Sysnative to the default
Windows %PATH%.  Such a change would help Cygwin users and others.  But
I doubt that Microsoft will make this change.

Therefore, I am suggesting that Cygwin work around Microsoft's omission.
  My suggested workaround is for Cygwin to add Sysnative to its own
$PATH, automatically.

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

Bill Stewart
On Tue, Nov 17, 2020 at 4:42 PM tealhill via Cygwin wrote:

> Therefore, I am suggesting that Cygwin work around Microsoft's omission.
> My suggested workaround is for Cygwin to add Sysnative to its own
> $PATH, automatically.

I don't think that should be a default behavior in cygwin and is
likely to cause confusion. If you want to add it yourself, you can do
so.

Bill
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

Achim Gratz
In reply to this post by Cygwin list mailing list
tealhill via Cygwin writes:
> ### Summary
>
> Why should Cygwin add Sysnative to $PATH?  As a workaround for
> Microsoft's failure to add Sysnative to %PATH%.

With my maintainer hat for base-files on, I reject this proposal.

As already noted, there is no precedent for Cygwin doing things like
that, the functionality itself is useful only in a very narrow set of
circumstances and you can easily customize your Cygwin installation
yourself to do this if you need to.


Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

Andrey Repin
In reply to this post by Cygwin list mailing list
Greetings, tealhill!

> On 2020-11-17 4:23 PM, Thomas Wolff wrote:
>> Am 17.11.2020 um 20:54 schrieb tealhill via Cygwin:
 >>>
>>> Cygwin's /etc/profile sets the PATH.
>>>
>>> Could /etc/profile please also add /cygdrive/c/Windows/Sysnative to
>>> the end of the PATH?
 >>
>> It doesn't add any other Windows folders so why this one.

> ### Summary

> Why should Cygwin add Sysnative to $PATH?  As a workaround for
> Microsoft's failure to add Sysnative to %PATH%.

It was never a failure.
And if you use proper platform tools, it's not an issue either.

> ### Full explanation

> Cygwin imports the Windows %PATH% variable at startup.

Not necessarily. Depends on your .profile configuration.

> It would be ideal if Microsoft would add Sysnative to the default
> Windows %PATH%.

No, that would be a disaster.

> Such a change would help Cygwin users and others.  But
> I doubt that Microsoft will make this change.

> Therefore, I am suggesting that Cygwin work around Microsoft's omission.
>   My suggested workaround is for Cygwin to add Sysnative to its own
> $PATH, automatically.

I'm suggesting you install 64-bit Cygwin already.
32-bit Cygwin is rapidly running out of its usefulness.


--
With best regards,
Andrey Repin
Thursday, November 19, 2020 12:13:58

Sorry for my terrible english...

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

Brian Inglis
In reply to this post by Cygwin list mailing list
On 2020-11-17 16:41, tealhill via Cygwin wrote:

> On 2020-11-17 4:23 PM, Thomas Wolff wrote:
>> Am 17.11.2020 um 20:54 schrieb tealhill via Cygwin:
>  >>
>>> Cygwin's /etc/profile sets the PATH.
>>>
>>> Could /etc/profile please also add /cygdrive/c/Windows/Sysnative to the end
>>> of the PATH?
>  >
>> It doesn't add any other Windows folders so why this one.
>
> ### Summary
>
> Why should Cygwin add Sysnative to $PATH?  As a workaround for Microsoft's
> failure to add Sysnative to %PATH%.

You have the option to add SysNative to your system or user PATH under Windows,
although that would best be done in your login script.

> ### Full explanation
>
> Cygwin imports the Windows %PATH% variable at startup.
>
> It would be ideal if Microsoft would add Sysnative to the default Windows
> %PATH%.  Such a change would help Cygwin users and others.  But I doubt that
> Microsoft will make this change.
>
> Therefore, I am suggesting that Cygwin work around Microsoft's omission.  My
> suggested workaround is for Cygwin to add Sysnative to its own $PATH,
> automatically.

Cygwin starts with Cygwin paths /usr/bin:/bin and everything else is up to you.
You may add to your Cygwin PATH in your shell profile with code that switches
depending on the existence of SysWOW64 and SysNative: cygpath -F 37 gives your
application sysdir path, and cygpath -F 41 gives your x86 sysdir if there is one:

        https://docs.microsoft.com/en-ca/dotnet/api/system.environment.specialfolder?view=net-5.0

        https://docs.microsoft.com/en-ca/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderidlist

        https://docs.microsoft.com/en-ca/windows/win32/shell/knownfolderid

and please note that SysNative appears nowhere!

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

L A Walsh
In reply to this post by Cygwin list mailing list
On 2020/11/17 15:41, tealhill via Cygwin wrote:

> ### Summary
> Why should Cygwin add Sysnative to $PATH?  As a workaround for
> Microsoft's failure to add Sysnative to %PATH%.
>
> ### Full explanation
>
> Cygwin imports the Windows %PATH% variable at startup.
>
> It would be ideal if Microsoft would add Sysnative to the default
> Windows %PATH%.  Such a change would help Cygwin users and others.  But
> I doubt that Microsoft will make this change.
>  
----
    Adding sysnative, **incorrectly** would add 64-bit applications to
a 32-bit path.  You are asking a non-windows environment, Cygwin, that in
order to be POSIX compatible, it should add a windows path?  Name ONE other
unix or posix platform that does this by default.


--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

Thomas Wolff
In reply to this post by Brian Inglis

Am 19.11.2020 um 16:57 schrieb Brian Inglis:

> On 2020-11-17 16:41, tealhill via Cygwin wrote:
>> On 2020-11-17 4:23 PM, Thomas Wolff wrote:
>>> Am 17.11.2020 um 20:54 schrieb tealhill via Cygwin:
>>  >>
>>>> Cygwin's /etc/profile sets the PATH.
>>>>
>>>> Could /etc/profile please also add /cygdrive/c/Windows/Sysnative to
>>>> the end of the PATH?
>>  >
>>> It doesn't add any other Windows folders so why this one.
>>
>> ### Summary
>>
>> Why should Cygwin add Sysnative to $PATH?  As a workaround for
>> Microsoft's failure to add Sysnative to %PATH%.
>
> You have the option to add SysNative to your system or user PATH under
> Windows, although that would best be done in your login script.
>
>> ### Full explanation
>>
>> Cygwin imports the Windows %PATH% variable at startup.
>>
>> It would be ideal if Microsoft would add Sysnative to the default
>> Windows %PATH%.  Such a change would help Cygwin users and others. 
>> But I doubt that Microsoft will make this change.
>>
>> Therefore, I am suggesting that Cygwin work around Microsoft's
>> omission.  My suggested workaround is for Cygwin to add Sysnative to
>> its own $PATH, automatically.
>
> Cygwin starts with Cygwin paths /usr/bin:/bin and everything else is
> up to you.
> You may add to your Cygwin PATH in your shell profile with code that
> switches depending on the existence of SysWOW64 and SysNative: cygpath
> -F 37 gives your application sysdir path, and cygpath -F 41 gives your
> x86 sysdir if there is one:
>
>     https://docs.microsoft.com/en-ca/dotnet/api/system.environment.specialfolder?view=net-5.0 
>
>
>     https://docs.microsoft.com/en-ca/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderidlist 
>
>
>     https://docs.microsoft.com/en-ca/windows/win32/shell/knownfolderid
>
> and please note that SysNative appears nowhere!

That's because Sysnative is not a known folder. It is rather unknown
just because it is virtual :)
And that is the problem I tried to address. In cygwin32, you can `cd
$WINDIR/Sysnative` but you wouldn't see the folder. For tools like ls or
find it simply does not exist, while obviously it exists somehow and can
be used in PATH.
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

Bill Stewart
On Tue, Nov 24, 2020 at 12:25 AM Thomas Wolff wrote:

> > and please note that SysNative appears nowhere!
>
> That's because Sysnative is not a known folder. It is rather unknown
> just because it is virtual :)
> And that is the problem I tried to address. In cygwin32, you can `cd
> $WINDIR/Sysnative` but you wouldn't see the folder. For tools like ls or
> find it simply does not exist, while obviously it exists somehow and can
> be used in PATH.

For the benefit of other readers regarding the Sysnative virtual directory:

https://docs.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector

The other links on the Microsoft documentation page regarding WoW64
are also quite helpful.

Bill
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

Cygwin list mailing list
On 24/11/2020 14:52, Bill Stewart wrote:

> On Tue, Nov 24, 2020 at 12:25 AM Thomas Wolff wrote:
>
>>> and please note that SysNative appears nowhere!
>> That's because Sysnative is not a known folder. It is rather unknown
>> just because it is virtual :)
>> And that is the problem I tried to address. In cygwin32, you can `cd
>> $WINDIR/Sysnative` but you wouldn't see the folder. For tools like ls or
>> find it simply does not exist, while obviously it exists somehow and can
>> be used in PATH.
> For the benefit of other readers regarding the Sysnative virtual directory:
>
> https://docs.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector
>
> The other links on the Microsoft documentation page regarding WoW64
> are also quite helpful.
>
> Bill
Thanks for the link, it does help my understanding for sure. I was
following along with moderate interest but now I understand better what
the problem is and find it less confusing.

Hamish


--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

0x87B761FE07F548D6.asc (3K) Download Attachment
signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH

Brian Inglis
In reply to this post by Thomas Wolff
On 2020-11-24 00:24, Thomas Wolff wrote:

> Am 19.11.2020 um 16:57 schrieb Brian Inglis:
>> On 2020-11-17 16:41, tealhill via Cygwin wrote:
>>> On 2020-11-17 4:23 PM, Thomas Wolff wrote:
>>>> Am 17.11.2020 um 20:54 schrieb tealhill via Cygwin:
>>>  >>
>>>>> Cygwin's /etc/profile sets the PATH.
>>>>>
>>>>> Could /etc/profile please also add /cygdrive/c/Windows/Sysnative to the end
>>>>> of the PATH?
>>>  >
>>>> It doesn't add any other Windows folders so why this one.
>>>
>>> ### Summary
>>>
>>> Why should Cygwin add Sysnative to $PATH?  As a workaround for Microsoft's
>>> failure to add Sysnative to %PATH%.
>>
>> You have the option to add SysNative to your system or user PATH under
>> Windows, although that would best be done in your login script.
>>
>>> ### Full explanation
>>>
>>> Cygwin imports the Windows %PATH% variable at startup.
>>>
>>> It would be ideal if Microsoft would add Sysnative to the default Windows
>>> %PATH%.  Such a change would help Cygwin users and others. But I doubt that
>>> Microsoft will make this change.
>>>
>>> Therefore, I am suggesting that Cygwin work around Microsoft's omission.  My
>>> suggested workaround is for Cygwin to add Sysnative to its own $PATH,
>>> automatically.
>>
>> Cygwin starts with Cygwin paths /usr/bin:/bin and everything else is up to you.
>> You may add to your Cygwin PATH in your shell profile with code that switches
>> depending on the existence of SysWOW64 and SysNative: cygpath -F 37 gives your
>> application sysdir path, and cygpath -F 41 gives your x86 sysdir if there is one:
>>
>>     https://docs.microsoft.com/en-ca/dotnet/api/system.environment.specialfolder?view=net-5.0 
>>
>>     https://docs.microsoft.com/en-ca/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderidlist 
>>
>>     https://docs.microsoft.com/en-ca/windows/win32/shell/knownfolderid
>>
>> and please note that SysNative appears nowhere!
>
> That's because Sysnative is not a known folder. It is rather unknown just
> because it is virtual :)
> And that is the problem I tried to address. In cygwin32, you can `cd
> $WINDIR/Sysnative` but you wouldn't see the folder. For tools like ls or find it
> simply does not exist, while obviously it exists somehow and can be used in PATH.

It is visible to find and ls when explicitly specified as

        /proc/cygdrive/c/Windows/SysNative/

so the contents can be listed and searched, but you have to know to do so, as it
does not appear to be derivable from Windows information like other folders.

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]


--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple