Re: Cygwin64 does not show my desktop directories
Thank you both so much! This is very helpful. Orit. On Wed, 19 Jul 2023 at 22:17, Brian Inglis wrote: > On 2023-07-19 11:20, Voris, Ben via Cygwin wrote: > >> -Original Message- > >> From: Takashi Yano > >> Sent: 19 July 2023 03:15 > >> To: cygwin@cygwin.com > >> Cc: Orit Heimer > >> Subject: Re: Cygwin64 does not show my desktop directories > >> > >> On Wed, 19 Jul 2023 11:52:31 +0300 > >> Orit Heimer wrote: > >>> Hello to all, > >>> I am new to Cygwin64 and encountered a problem. > >>> I am using a Windows 10. > >>> I try to get cygwin64 to show my desktop directories. > >>> I use the following command to change to this directory: > >>> *cd /cygdrive/c/Users/Default/Desktop* > >>> But when I then use *ls* I get nothing. > >>> I suspect this is a permission problem, but I failed to overcome it. > >> > >> The directory you cd'ed is not correct. > >> Use: > >> /cygdrive/c/Users/$USER/Desktop > >> > >> -- > >> Takashi Yano > > > > If you can "cd" to a directory and "ls" shows it empty, permissions > > are unlikely to be the problem. > > > > Though the original example used "C:", the Windows desktop need not > > be on the C: drive. Assuming you're using bash, a more general command > > is: > > > > cd "${USERPROFILE}/Desktop" > > > > - Quoted because doing that helps to remind me that its safer. > > - ${USERPROFILE} because it includes the Windows drive. > > - "Desktop" instead of "desktop" because, though case-sensitivity is > >usually not enabled, the directory name is "Desktop". > > > > Also, it is possible that the directory that Windows Explorer shows > > as your desktop is something entirely different. For example, if you > > use OneDrive to mirror your desktop, the directory that Windows > > Explorer shows is "${OneDrive}/Desktop". And, at least on my system, > > Here, the quotes are necessary. > > > > I believe that OneDrive isn't the only thing that can change the > > "real" location of what Windows Explorer shows: > > > > The following command should always work but will emit > > "bash: warning: command substitution: ignored null byte in input". > > In case email makes a mess of the command, it is 128 characters. > > > > ls -ld "$(cat > "/proc/registry/HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/User > Shell Folders/Desktop")" > > Does not always work: > > $ regtool get > "/proc/registry/HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/User > > Shell Folders/Desktop" > %USERPROFILE%\Desktop > > to get absolute canonical path use: > > $ cygpath -aUD > /proc/cygdrive/c/Users/.../Desktop > > or for All users: > > $ cygpath -aAUD > /proc/cygdrive/c/Users/Public/Desktop > > For more useful known folder options see: > > $ man cygpath > > For Windows known folder ids (CSIDL) use: > > $ cygpath -aUF $id # 0...63 > > See links below and attached logs for more details about those known > folders: > > https://learn.microsoft.com/en-us/windows/win32/shell/csidl > > > https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid > > -- > Take care. Thanks, Brian Inglis Calgary, Alberta, Canada > > La perfection est atteinte Perfection is achieved > non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to > add > mais lorsqu'il n'y a plus rien à retirer but when there is no more to > cut > -- Antoine de Saint-Exupéry -- 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
Re: Cygwin64 does not show my desktop directories
On 2023-07-19 11:20, Voris, Ben via Cygwin wrote: -Original Message- From: Takashi Yano Sent: 19 July 2023 03:15 To: cygwin@cygwin.com Cc: Orit Heimer Subject: Re: Cygwin64 does not show my desktop directories On Wed, 19 Jul 2023 11:52:31 +0300 Orit Heimer wrote: Hello to all, I am new to Cygwin64 and encountered a problem. I am using a Windows 10. I try to get cygwin64 to show my desktop directories. I use the following command to change to this directory: *cd /cygdrive/c/Users/Default/Desktop* But when I then use *ls* I get nothing. I suspect this is a permission problem, but I failed to overcome it. The directory you cd'ed is not correct. Use: /cygdrive/c/Users/$USER/Desktop -- Takashi Yano If you can "cd" to a directory and "ls" shows it empty, permissions are unlikely to be the problem. Though the original example used "C:", the Windows desktop need not be on the C: drive. Assuming you're using bash, a more general command is: cd "${USERPROFILE}/Desktop" - Quoted because doing that helps to remind me that its safer. - ${USERPROFILE} because it includes the Windows drive. - "Desktop" instead of "desktop" because, though case-sensitivity is usually not enabled, the directory name is "Desktop". Also, it is possible that the directory that Windows Explorer shows as your desktop is something entirely different. For example, if you use OneDrive to mirror your desktop, the directory that Windows Explorer shows is "${OneDrive}/Desktop". And, at least on my system, Here, the quotes are necessary. I believe that OneDrive isn't the only thing that can change the "real" location of what Windows Explorer shows: The following command should always work but will emit "bash: warning: command substitution: ignored null byte in input". In case email makes a mess of the command, it is 128 characters. ls -ld "$(cat "/proc/registry/HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/User Shell Folders/Desktop")" Does not always work: $ regtool get "/proc/registry/HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/User Shell Folders/Desktop" %USERPROFILE%\Desktop to get absolute canonical path use: $ cygpath -aUD /proc/cygdrive/c/Users/.../Desktop or for All users: $ cygpath -aAUD /proc/cygdrive/c/Users/Public/Desktop For more useful known folder options see: $ man cygpath For Windows known folder ids (CSIDL) use: $ cygpath -aUF $id # 0...63 See links below and attached logs for more details about those known folders: https://learn.microsoft.com/en-us/windows/win32/shell/csidl https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut -- Antoine de Saint-ExupéryWindows Known Folder Ids cygpath -aU -F hex dec stdout 0x24 36 /proc/cygdrive/$SYSTEMDRIVE/Windows 0x14 20 /proc/cygdrive/$SYSTEMDRIVE/Windows/Fonts 0x38 56 /proc/cygdrive/$SYSTEMDRIVE/Windows/Resources 0x25 37 /proc/cygdrive/$SYSTEMDRIVE/Windows/System32 0x29 41 /proc/cygdrive/$SYSTEMDRIVE/Windows/SysWOW64 0x26 38 /proc/cygdrive/$SYSTEMDRIVE/Program Files 0x2b 43 /proc/cygdrive/$SYSTEMDRIVE/Program Files/Common Files 0x2a 42 /proc/cygdrive/$SYSTEMDRIVE/Program Files (x86) 0x2c 44 /proc/cygdrive/$SYSTEMDRIVE/Program Files (x86)/Common Files 0x28 40 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME 0x19 25 /proc/cygdrive/$SYSTEMDRIVE/Users/Public/Desktop 0x00 0 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/Desktop 0x10 16 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/Desktop 0x2e 46 /proc/cygdrive/$SYSTEMDRIVE/Users/Public/Documents 0x05 5 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/Documents 0x06 6 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/Favorites 0x1f 31 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/Favorites 0x35 53 /proc/cygdrive/$SYSTEMDRIVE/Users/Public/Music 0x0d 13 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/Music 0x36 54 /proc/cygdrive/$SYSTEMDRIVE/Users/Public/Pictures 0x27 39 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/Pictures 0x37 55 /proc/cygdrive/$SYSTEMDRIVE/Users/Public/Videos 0x0e 14 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/Videos 0x23 35 /proc/cygdrive/$SYSTEMDRIVE/ProgramData 0x1c 28 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/AppData/Local 0x3b 59 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/AppData/Local/Microsoft/Windows/Burn/Burn 0x22 34 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/AppData/Local/Microsoft/Windows/History 0x20 32 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/AppData/Local/Microsoft/Windows/INetCache 0x21 33 /proc/cygdrive/$HOMEDRIVE/Users/$USERNAME/AppData/Local/Microsoft/Windows/INetCookies 0x1a 26
RE: Cygwin64 does not show my desktop directories
> -Original Message- > From: Takashi Yano > Sent: 19 July 2023 03:15 > To: cygwin@cygwin.com > Cc: Orit Heimer > Subject: Re: Cygwin64 does not show my desktop directories > > On Wed, 19 Jul 2023 11:52:31 +0300 > Orit Heimer wrote: > > Hello to all, > > I am new to Cygwin64 and encountered a problem. > > I am using a Windows 10. > > I try to get cygwin64 to show my desktop directories. > > I use the following command to change to this directory: > > *cd /cygdrive/c/Users/Default/Desktop* > > But when I then use *ls* I get nothing. > > I suspect this is a permission problem, but I failed to overcome it. > > The directory you cd'ed is not correct. > Use: > /cygdrive/c/Users/$USER/Desktop > > -- > Takashi Yano If you can "cd" to a directory and "ls" shows it empty, permissions are unlikely to be the problem. Though the original example used "C:", the Windows desktop need not be on the C: drive. Assuming you're using bash, a more general command is: cd "${USERPROFILE}/Desktop" - Quoted because doing that helps to remind me that its safer. - ${USERPROFILE} because it includes the Windows drive. - "Desktop" instead of "desktop" because, though case-sensitivity is usually not enabled, the directory name is "Desktop". Also, it is possible that the directory that Windows Explorer shows as your desktop is something entirely different. For example, if you use OneDrive to mirror your desktop, the directory that Windows Explorer shows is "${OneDrive}/Desktop". And, at least on my system, Here, the quotes are necessary. I believe that OneDrive isn't the only thing that can change the "real" location of what Windows Explorer shows: The following command should always work but will emit "bash: warning: command substitution: ignored null byte in input". In case email makes a mess of the command, it is 128 characters. ls -ld "$(cat "/proc/registry/HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/User Shell Folders/Desktop")" If you don't like to see the warning and you want to have a variable that holds the desktop directory name, this works. Again, to help in case email makes a mess of it, the command is 202 characters. IFS= read -r -d '' WINDOWS_DESKTOP < "/proc/registry/HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/User Shell Folders/Desktop" && WINDOWS_DESKTOP="$(cygpath "${WINDOWS_DESKTOP}")" You can use the variable, like so: ls -ld "${WINDOWS_DESKTOP}" -- 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
Re: [PATCH 0/2] Testsuite adjustment and relevant fix
On Jul 19 13:41, Jon Turney wrote: > [1/2] has the side effect of flipping test stat06 from working to failing. > [2/2] fixes that > > When run with TDIRECTORY set, libltp just uses that directory and assumes > something else will clean it up. > > When TDIRECTORY is not set, libltp creates a subdirectory under /tmp, and when > the test is completed, removes the expected files and verifies that the > directory is empty. > > stat06 fails that check, because it creates the a file named "file" there, and > tries stat("file", -1), testing that it returns the expected value EFAULT. > > "file" is removed, but lingers in the STATUS_DELETE_PENDING state until the > Windows handle which stat_worker() leaks when an exception occurs is closed > (when the processes exits). Great find. Please push. > Future work: It looks like similar problems might generically occur in similar > code througout syscalls.cc. Uh oh... Corinna
[PATCH 2/2] Cygwin: Fix Windows file handle leak in stat("file", -1)
Don't leak a Windows file handle if stat() is called with a valid filename, but invalid stat buffer pointer. We do not destroy fh if an exception happens in the __try block, which closes a Windows handle it has opened. Fixes: 73151c54d581 ("syscalls.cc (stat_worker): Don't call build_fh_pc with invalid pc.") Signed-off-by: Jon Turney --- winsup/cygwin/syscalls.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 73343ecc1..c6999407e 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1955,6 +1955,7 @@ int stat_worker (path_conv , struct stat *buf) { int res = -1; + fhandler_base *fh = NULL; __try { @@ -1965,8 +1966,6 @@ stat_worker (path_conv , struct stat *buf) } else if (pc.exists ()) { - fhandler_base *fh; - if (!(fh = build_fh_pc (pc))) __leave; @@ -1976,13 +1975,14 @@ stat_worker (path_conv , struct stat *buf) res = fh->fstat (buf); if (!res) fh->stat_fixup (buf); - delete fh; } else set_errno (ENOENT); } __except (EFAULT) {} __endtry + + delete fh; syscall_printf ("%d = (%S,%p)", res, pc.get_nt_native_path (), buf); return res; } -- 2.39.0
[PATCH 0/2] Testsuite adjustment and relevant fix
[1/2] has the side effect of flipping test stat06 from working to failing. [2/2] fixes that When run with TDIRECTORY set, libltp just uses that directory and assumes something else will clean it up. When TDIRECTORY is not set, libltp creates a subdirectory under /tmp, and when the test is completed, removes the expected files and verifies that the directory is empty. stat06 fails that check, because it creates the a file named "file" there, and tries stat("file", -1), testing that it returns the expected value EFAULT. "file" is removed, but lingers in the STATUS_DELETE_PENDING state until the Windows handle which stat_worker() leaks when an exception occurs is closed (when the processes exits). Future work: It looks like similar problems might generically occur in similar code througout syscalls.cc. Jon Turney (2): Cygwin: testsuite: Drop setting TDIRECTORY Cygwin: Fix Windows file handle leak in stat("file", -1) winsup/cygwin/syscalls.cc | 6 +++--- winsup/testsuite/Makefile.am | 8 winsup/testsuite/cygrun.c | 5 + winsup/testsuite/winsup.api/winsup.exp | 4 +--- 4 files changed, 5 insertions(+), 18 deletions(-) -- 2.39.0
[PATCH 1/2] Cygwin: testsuite: Drop setting TDIRECTORY
Drop setting TDIRECTORY, just use /tmp in the 'test installation' now that we have it. This effectively reverts f3ed5f2fe029d74372aca68b18936e164ff47cf7 Signed-off-by: Jon Turney --- winsup/testsuite/Makefile.am | 8 winsup/testsuite/cygrun.c | 5 + winsup/testsuite/winsup.api/winsup.exp | 4 +--- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/winsup/testsuite/Makefile.am b/winsup/testsuite/Makefile.am index 60111a0aa..9159a1be8 100644 --- a/winsup/testsuite/Makefile.am +++ b/winsup/testsuite/Makefile.am @@ -334,17 +334,9 @@ DEJATOOL = winsup RUNTESTFLAGS_1 = -v RUNTESTFLAGS = $(RUNTESTFLAGS_$(V)) -# a temporary directory, to be used for files created by tests -tmpdir = $(abspath $(builddir)/tmp/) -# the same temporary directory, as an absolute, /cygdrive path (so it can be -# understood by the test DLL, which will have a different mount table) -testdll_tmpdir = $(shell cygpath -ma $(tmpdir) | sed -e 's#^\([A-Z]\):#/cygdrive/\L\1#') - site-extra.exp: ../config.status Makefile @rm -f ./tmp0 @echo "set runtime_root \"`pwd`/testinst/bin\"" >> ./tmp0 - @echo "set tmpdir $(tmpdir)" >> ./tmp0 - @echo "set testdll_tmpdir $(testdll_tmpdir)" >> ./tmp0 @echo "set cygrun \"`pwd`/mingw/cygrun\"" >> ./tmp0 @mv ./tmp0 site-extra.exp diff --git a/winsup/testsuite/cygrun.c b/winsup/testsuite/cygrun.c index 925b5513f..d8de7d158 100644 --- a/winsup/testsuite/cygrun.c +++ b/winsup/testsuite/cygrun.c @@ -26,13 +26,10 @@ main (int argc, char **argv) if (argc < 2) { - fprintf (stderr, "Usage: cygrun [program] [tmpdir]\n"); + fprintf (stderr, "Usage: cygrun [program]\n"); exit (0); } - if (argc >= 3) -SetEnvironmentVariable ("TDIRECTORY", argv[2]); - SetEnvironmentVariable ("CYGWIN_TESTING", "1"); memset (, 0, sizeof (sa)); diff --git a/winsup/testsuite/winsup.api/winsup.exp b/winsup/testsuite/winsup.api/winsup.exp index 111509511..76455a97c 100644 --- a/winsup/testsuite/winsup.api/winsup.exp +++ b/winsup/testsuite/winsup.api/winsup.exp @@ -62,10 +62,8 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.{cc } else { set redirect_output /dev/null } - file mkdir $tmpdir/$tmpfile set env(PATH) "$runtime_root:$env(PATH)" - ws_spawn "cygdrop $cygrun $exec $testdll_tmpdir/$tmpfile > $redirect_output" - file delete -force $tmpdir/$tmpfile + ws_spawn "cygdrop $cygrun $exec > $redirect_output" set env(PATH) "$orig_path" if { $rv } { fail "$testcase" -- 2.39.0
Re: Cygwin64 does not show my desktop directories
On Wed, 19 Jul 2023 11:52:31 +0300 Orit Heimer wrote: > Hello to all, > I am new to Cygwin64 and encountered a problem. > I am using a Windows 10. > I try to get cygwin64 to show my desktop directories. > I use the following command to change to this directory: > *cd /cygdrive/c/Users/Default/Desktop* > But when I then use *ls* I get nothing. > I suspect this is a permission problem, but I failed to overcome it. The directory you cd'ed is not correct. Use: /cygdrive/c/Users/$USER/Desktop -- Takashi Yano -- 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
Cygwin64 does not show my desktop directories
Hello to all, I am new to Cygwin64 and encountered a problem. I am using a Windows 10. I try to get cygwin64 to show my desktop directories. I use the following command to change to this directory: *cd /cygdrive/c/Users/Default/Desktop* But when I then use *ls* I get nothing. I suspect this is a permission problem, but I failed to overcome it. Thanks in advance, Orit. -- 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