* [PATCH] Cygwin: syscalls.cc: remove ".dll" from, blessed_executable_suffixes
@ 2022-08-04 12:00 Ken Brown
2022-08-04 18:37 ` Corinna Vinschen
0 siblings, 1 reply; 2+ messages in thread
From: Ken Brown @ 2022-08-04 12:00 UTC (permalink / raw)
To: cygwin-patches
[-- Attachment #1: Type: text/plain, Size: 101 bytes --]
Patch attached. I'm not 100% sure of this since it does change behavior (but in
a weird case).
Ken
[-- Attachment #2: 0001-Cygwin-syscalls.cc-remove-.dll-from-blessed_executab.patch --]
[-- Type: text/plain, Size: 2588 bytes --]
From 97a2fc0d07c8f9045b73716ac5a05f972d5bd75c Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Wed, 3 Aug 2022 16:45:23 -0400
Subject: [PATCH] Cygwin: syscalls.cc: remove ".dll" from
blessed_executable_suffixes
This reverts commit d9e9c7b5a7. The latter added ".dll" to the
blessed_executable_suffixes array because on 32-bit Windows, the
GetBinaryType function would report that a 64-bit DLL is an
executable, contrary to the documentation of that function.
That anomaly does not exist on 64-bit Windows, so we can remove ".dll"
from the list. Reverting the commit does, however, change the
behavior of the rename(2) syscall in the following unlikely situation:
Suppose we have an executable foo.exe and we make the call
rename ("foo", "bar.dll");
Previously, foo.exe would be renamed to bar.dll. So bar.dll would
then be an executable without the .exe extension. The new behavior is
that foo.exe will be renamed to bar.dll.exe. [Exception: If there
already existed an executable (not a DLL!) with the name bar.dll, then
.exe will not be appended.]
---
winsup/cygwin/globals.cc | 1 -
winsup/cygwin/syscalls.cc | 6 ------
2 files changed, 7 deletions(-)
diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index e8147cb5c..e909d0f8f 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -120,7 +120,6 @@ const int __collate_load_error = 0;
extern UNICODE_STRING _RDATA ro_u_empty = _ROU (L"");
extern UNICODE_STRING _RDATA ro_u_lnk = _ROU (L".lnk");
extern UNICODE_STRING _RDATA ro_u_exe = _ROU (L".exe");
- extern UNICODE_STRING _RDATA ro_u_dll = _ROU (L".dll");
extern UNICODE_STRING _RDATA ro_u_com = _ROU (L".com");
extern UNICODE_STRING _RDATA ro_u_scr = _ROU (L".scr");
extern UNICODE_STRING _RDATA ro_u_sys = _ROU (L".sys");
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index e6d68cc07..599b2b793 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -2133,12 +2133,6 @@ nt_path_has_executable_suffix (PUNICODE_STRING upath)
static const PUNICODE_STRING blessed_executable_suffixes[] =
{
&ro_u_com,
- &ro_u_dll, /* Messy, messy. Per MSDN, the GetBinaryType function is
- supposed to return with ERROR_BAD_EXE_FORMAT. if the file
- is a DLL. On 64-bit Windows, this works as expected for
- 32-bit and 64-bit DLLs. On 32-bit Windows this only works
- for 32-bit DLLs. For 64-bit DLLs, 32-bit Windows returns
- true with the type set to SCS_64BIT_BINARY. */
&ro_u_exe,
&ro_u_scr,
&ro_u_sys,
--
2.37.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Cygwin: syscalls.cc: remove ".dll" from, blessed_executable_suffixes
2022-08-04 12:00 [PATCH] Cygwin: syscalls.cc: remove ".dll" from, blessed_executable_suffixes Ken Brown
@ 2022-08-04 18:37 ` Corinna Vinschen
0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2022-08-04 18:37 UTC (permalink / raw)
To: cygwin-patches
On Aug 4 08:00, Ken Brown wrote:
> Patch attached. I'm not 100% sure of this since it does change behavior
> (but in a weird case).
>
> Ken
> From 97a2fc0d07c8f9045b73716ac5a05f972d5bd75c Mon Sep 17 00:00:00 2001
> From: Ken Brown <kbrown@cornell.edu>
> Date: Wed, 3 Aug 2022 16:45:23 -0400
> Subject: [PATCH] Cygwin: syscalls.cc: remove ".dll" from
> blessed_executable_suffixes
>
> This reverts commit d9e9c7b5a7. The latter added ".dll" to the
> blessed_executable_suffixes array because on 32-bit Windows, the
> GetBinaryType function would report that a 64-bit DLL is an
> executable, contrary to the documentation of that function.
>
> That anomaly does not exist on 64-bit Windows, so we can remove ".dll"
> from the list. Reverting the commit does, however, change the
> behavior of the rename(2) syscall in the following unlikely situation:
> Suppose we have an executable foo.exe and we make the call
>
> rename ("foo", "bar.dll");
>
> Previously, foo.exe would be renamed to bar.dll. So bar.dll would
> then be an executable without the .exe extension. The new behavior is
> that foo.exe will be renamed to bar.dll.exe. [Exception: If there
> already existed an executable (not a DLL!) with the name bar.dll, then
> .exe will not be appended.]
> ---
> winsup/cygwin/globals.cc | 1 -
> winsup/cygwin/syscalls.cc | 6 ------
> 2 files changed, 7 deletions(-)
LGTM.
Thanks,
Corinna
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-04 18:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-04 12:00 [PATCH] Cygwin: syscalls.cc: remove ".dll" from, blessed_executable_suffixes Ken Brown
2022-08-04 18:37 ` Corinna Vinschen
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).