public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Please add /cygdrive/c/Windows/Sysnative to the default PATH
@ 2020-11-17 19:54 tealhill
  2020-11-17 21:23 ` Thomas Wolff
  0 siblings, 1 reply; 12+ messages in thread
From: tealhill @ 2020-11-17 19:54 UTC (permalink / raw)
  To: cygwin

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.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-17 19:54 Please add /cygdrive/c/Windows/Sysnative to the default PATH tealhill
@ 2020-11-17 21:23 ` Thomas Wolff
  2020-11-17 23:41   ` tealhill
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas Wolff @ 2020-11-17 21:23 UTC (permalink / raw)
  To: cygwin



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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-17 21:23 ` Thomas Wolff
@ 2020-11-17 23:41   ` tealhill
  2020-11-18 15:21     ` Bill Stewart
                       ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: tealhill @ 2020-11-17 23:41 UTC (permalink / raw)
  To: cygwin

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.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-17 23:41   ` tealhill
@ 2020-11-18 15:21     ` Bill Stewart
  2020-11-18 15:45     ` Achim Gratz
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Bill Stewart @ 2020-11-18 15:21 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-17 23:41   ` tealhill
  2020-11-18 15:21     ` Bill Stewart
@ 2020-11-18 15:45     ` Achim Gratz
  2020-11-19  9:15     ` Andrey Repin
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Achim Gratz @ 2020-11-18 15:45 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-17 23:41   ` tealhill
  2020-11-18 15:21     ` Bill Stewart
  2020-11-18 15:45     ` Achim Gratz
@ 2020-11-19  9:15     ` Andrey Repin
  2020-11-19 15:57     ` Brian Inglis
  2020-11-24  1:58     ` L A Walsh
  4 siblings, 0 replies; 12+ messages in thread
From: Andrey Repin @ 2020-11-19  9:15 UTC (permalink / raw)
  To: tealhill, cygwin

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...


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-17 23:41   ` tealhill
                       ` (2 preceding siblings ...)
  2020-11-19  9:15     ` Andrey Repin
@ 2020-11-19 15:57     ` Brian Inglis
  2020-11-24  7:24       ` Thomas Wolff
  2020-11-24  1:58     ` L A Walsh
  4 siblings, 1 reply; 12+ messages in thread
From: Brian Inglis @ 2020-11-19 15:57 UTC (permalink / raw)
  To: cygwin

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.]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-17 23:41   ` tealhill
                       ` (3 preceding siblings ...)
  2020-11-19 15:57     ` Brian Inglis
@ 2020-11-24  1:58     ` L A Walsh
  4 siblings, 0 replies; 12+ messages in thread
From: L A Walsh @ 2020-11-24  1:58 UTC (permalink / raw)
  To: cygwin

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.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-19 15:57     ` Brian Inglis
@ 2020-11-24  7:24       ` Thomas Wolff
  2020-11-24 14:52         ` Bill Stewart
  2020-11-24 21:06         ` Brian Inglis
  0 siblings, 2 replies; 12+ messages in thread
From: Thomas Wolff @ 2020-11-24  7:24 UTC (permalink / raw)
  To: cygwin


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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-24  7:24       ` Thomas Wolff
@ 2020-11-24 14:52         ` Bill Stewart
  2020-11-24 15:10           ` Hamish McIntyre-Bhatty
  2020-11-24 21:06         ` Brian Inglis
  1 sibling, 1 reply; 12+ messages in thread
From: Bill Stewart @ 2020-11-24 14:52 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-24 14:52         ` Bill Stewart
@ 2020-11-24 15:10           ` Hamish McIntyre-Bhatty
  0 siblings, 0 replies; 12+ messages in thread
From: Hamish McIntyre-Bhatty @ 2020-11-24 15:10 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1.1: Type: text/plain, Size: 985 bytes --]

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


[-- Attachment #1.1.2: 0x87B761FE07F548D6.asc --]
[-- Type: application/pgp-keys, Size: 3235 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Please add /cygdrive/c/Windows/Sysnative to the default PATH
  2020-11-24  7:24       ` Thomas Wolff
  2020-11-24 14:52         ` Bill Stewart
@ 2020-11-24 21:06         ` Brian Inglis
  1 sibling, 0 replies; 12+ messages in thread
From: Brian Inglis @ 2020-11-24 21:06 UTC (permalink / raw)
  To: cygwin

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.]



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-11-24 21:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 19:54 Please add /cygdrive/c/Windows/Sysnative to the default PATH tealhill
2020-11-17 21:23 ` Thomas Wolff
2020-11-17 23:41   ` tealhill
2020-11-18 15:21     ` Bill Stewart
2020-11-18 15:45     ` Achim Gratz
2020-11-19  9:15     ` Andrey Repin
2020-11-19 15:57     ` Brian Inglis
2020-11-24  7:24       ` Thomas Wolff
2020-11-24 14:52         ` Bill Stewart
2020-11-24 15:10           ` Hamish McIntyre-Bhatty
2020-11-24 21:06         ` Brian Inglis
2020-11-24  1:58     ` L A Walsh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).