Cygwin: stop handling files with .com suffix like .exe files

.com is a remnant from the past.  There are only five executables
left:

  chcp.com
  format.com
  mode.com
  more.com
  tree.com

Calling them on the command line already requires to use the
suffix anyway.  So drop useless .com test from the execve test
for scripts (they are handled earlier in the same function
as executables) and do not handle them like .exe suffixes in
other functions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2022-10-28 12:42:51 +02:00
parent 213b53ed35
commit 339bb6e932
5 changed files with 4 additions and 7 deletions

View File

@ -518,8 +518,7 @@ fhandler_base::fstat_helper (struct stat *buf)
PUNICODE_STRING path = pc.get_nt_native_path ();
if (RtlEqualUnicodePathSuffix (path, &ro_u_exe, TRUE)
|| RtlEqualUnicodePathSuffix (path, &ro_u_lnk, TRUE)
|| RtlEqualUnicodePathSuffix (path, &ro_u_com, TRUE))
|| RtlEqualUnicodePathSuffix (path, &ro_u_lnk, TRUE))
pc.set_exec ();
}
/* No known suffix, check file header. This catches binaries and

View File

@ -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_com = _ROU (L".com");
extern UNICODE_STRING _RDATA ro_u_scr = _ROU (L".scr");
extern UNICODE_STRING _RDATA ro_u_sys = _ROU (L".sys");
extern UNICODE_STRING _RDATA ro_u_proc = _ROU (L"proc");

View File

@ -5,6 +5,9 @@ What's new:
- Drop support for 32 bit Windows and WOW64.
- Remove any special handling for the .com filename suffix. It has to
be used always explicitely.
- Add code to handle setrlimit(RLIMIT_AS).
- Add code to handle signal masks in /proc/<PID>/status.

View File

@ -34,7 +34,6 @@ static const suffix_info exe_suffixes[] =
{
suffix_info ("", 1),
suffix_info (".exe", 1),
suffix_info (".com"),
suffix_info (NULL)
};
@ -1366,8 +1365,6 @@ av::setup (const char *prog_arg, path_conv& real_path, const char *ext,
set_errno (ENOEXEC);
return -1;
}
if (ascii_strcasematch (ext, ".com"))
break;
pgm = (char *) "/bin/sh";
arg1 = NULL;
}

View File

@ -2097,7 +2097,6 @@ nt_path_has_executable_suffix (PUNICODE_STRING upath)
{
static const PUNICODE_STRING blessed_executable_suffixes[] =
{
&ro_u_com,
&ro_u_exe,
&ro_u_scr,
&ro_u_sys,