Commit Graph

13203 Commits

Author SHA1 Message Date
Takashi Yano aa49985245 Cygwin: pty, console: Fix deadlock in GDB regarding mutex.
- GDB inferior may be suspended while the inferior grabs mutex.
  This causes deadlock in terminal I/O. With this patch, timeout
  for waiting mutex is set to 0 for the debugger process when the
  process calls CreateProcess() with DEBUG_PROCESS flag to avoid
  deadlock. This may cause the race issue in GDB, however, there
  is no other way than that.

Addresses:
 https://cygwin.com/pipermail/cygwin-developers/2021-December/012542.html
2022-01-14 23:10:47 +09:00
Jon Turney 7e8031a5fd
Cygwin: doc: drop mention of 32-bit installer
Drop mention of 32-bit installer, since it's offically discouraged, and
planned to be dropped soon.

Adjust various references to be something more generic, like 'the Cygwin
Setup program' to accommodate this.
2022-01-12 19:17:10 +00:00
Brian Inglis bd179c36bf fhandler_proc.cc(format_proc_cpuinfo): add Linux 5.16 Gobble Gobble flags
0x00000007:1 Intel Advanced Matrix eXtensions:
		 EAX:22 amx_bf16 Brain Float 16 dot product
		 EAX:24 amx_tile Tile matrix multiply
		 EAX:25 amx_int8 Int 8 byte dot product
0x80000008:0 AMD EBX:27 cppc      Collaborative Processor Performance Control
2022-01-12 19:43:43 +01:00
Corinna Vinschen 935c33877d posix_spawn: fix get/set uid/gid calls for 32 bit Cygwin
32 bit Cygwin still exports function calls to support old applications.
E. g., when switching from 16 to 32 bit uid/gid values, new function
like getuid32 have been added and the old getuid function still only
provides 16 bit values.  Newly built applications using getuid are
actually calling getuid32.

However, this link magic isn't performed inside Cygwin itself, so if
newlib functions call getuid, they actually call the old getuid, not
the new getuid32.  This leads to truncated uid/gid values.

https://cygwin.com/pipermail/cygwin/2022-January/250453.html reports
how this leads to problems in posix_spawn.

Fix this temporarily. i686 support will go away soon in Cygwin and the
fix can be dropped.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-01-12 11:57:35 +01:00
Corinna Vinschen f574c30857 Cygwin: Makefile: add dependency to newlib's libs
We need deps to newlib's libc.a and libm.a, otherwise changes
in newlib code don't trigger a rebuild of the Cygwin DLL.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-01-12 11:45:54 +01:00
Corinna Vinschen a2bfe7cae6 Cygwin: ACLs: ignore *_INHERIT flags in file ACLs
get_posix_access() creates DEF_*_OBJ aclent_t entries from Windows ACEs
with INHERIT flags set, independent of the file type.  These flags only
make sense on directory objects, but certain Windows functions don't
check the file type and allow INHERIT ACE flags even on non-directories.

As a fix, make sure to ignore the INHERIT flags on non-directory ACLs
and don't propagate the matching DEF_*_OBJ aclent_t entries to callers.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-01-11 22:22:03 +01:00
Yaakov Selkowitz cf8aa43284 Cygwin: do not build MinGW testsuite/cygrun --with-cross-bootstrap 2022-01-10 09:59:08 -05:00
Ken Brown 0ce992c1e4 Cygwin: fhandler_pipe::get_query_hdl_per_process: avoid a crash
NtQueryInformationProcess(ProcessHandleInformation) can return
STATUS_SUCCESS with invalid handle data for certain processes
("minimal" processes on Windows 10).  This can cause a crash when
there's an attempt to access that data.  Fix that by setting
NumberOfHandles to zero before calling NtQueryInformationProcess.

Addresses: https://cygwin.com/pipermail/cygwin-patches/2021q4/011611.html
2021-12-26 18:29:23 -05:00
Jon Turney 3328740799
cygwin: Add cocom and patch to build prerequisites in FAQ
Add patch, and make cocom unconditional in list of build prerequisites.

Even though the products of these tools are checked in, these tools are
required when building in a fresh git checkout, presumably due to the
order in which git creates the files resulting in timestamps which
indicate that the output of rules using these tools are older than
the inputs.

Addresses: https://cygwin.com/pipermail/cygwin/2021-December/250124.html

Also drop a duplicate sentence about 'fetch sources from git'.
2021-12-20 14:00:21 +00:00
Jon Turney f4a26ececa
Cygwin: Conditionally build documentation
Add a configure option '--disable-doc' to disable building of the
documentation by the 'all' target.

Check for the required tools at configure time, and require them if
building documentation is enabled.

Even if building the documentation was diabled with '--disable-doc',
'make -C doc' at the top-level can still make the documentation, if the
documentation tools were found. If the tools were not found, 'missing'
is used to issue a warning about that.

Update instructions for building Cygwin appropriately.

(Building documentation remains the default to increase the chances of
noticing when building the documentation is broken.)
2021-12-17 22:28:16 +00:00
Takashi Yano 80f4b7d545 Cygwin: pty: Fix input switching failure.
- This patch fixes the failure of input switching between io_handle
  and io_handle_nat. This very rarely happens, however, input is
  wrongly switched to io_handle_nat even though the non-cygwin app
  is in the background.
2021-12-15 12:25:58 +09:00
Takashi Yano 0795f704f7 Cygwin: pty: Fix conditions for input transfer again. 2021-12-14 19:20:34 +09:00
Takashi Yano 720234b78a Cygwin: pty: Fix conditions for input transfer.
- The recent commit "Cygwin: pty: Add missing input transfer when
  switch_to_pcon_in state." causes regression that rlwrap cannot
  work with cmd.exe. This patch fixes the issue.
2021-12-14 12:32:36 +09:00
Jon Turney 90950758eb
Cygwin: Use AS_HELP_STRING for --enable-debugging
Use AS_HELP_STRING in AC_ARG_WITH for --enable-debugging to ensure
correct formatting in 'configure --help' output.
2021-12-13 17:47:54 +00:00
Takashi Yano 8d8724ee1b Cygwin: pty: Fix Ctrl-C handling further for non-cygwin apps.
- The recent commit: "Cygwin: pty: Fix Ctrl-C handling for non-cygwin
  apps in background." causes the problem that cmd.exe is terminated
  by Ctrl-C even if it is running in pseudo console. This patch fixes
  the issue.
2021-12-13 19:43:02 +09:00
Takashi Yano 90788821b7 Cygwin: pipe: Restore blocking mode for cygwin process at startup.
- Set blocking mode properly at startup of cygwin process. This is
  needed if the cygwin process is executed from non-cygwin process.
2021-12-12 22:14:29 +09:00
Ken Brown 451bbfb9f3 Cygwin: Document that the pipe_byte option is now set by default 2021-12-12 22:14:12 +09:00
Ken Brown d9c1aeaddf Cygwin: fhandler_pipe::raw_read: minor code cleanup
Remove references to STATUS_THREAD_SIGNALED and
STATUS_THREAD_CANCELED, which can't occur any more.
2021-12-12 22:11:06 +09:00
Takashi Yano 9e4d308cd5 Cygwin: pipe: Adopt FILE_SYNCHRONOUS_IO_NONALERT flag for read pipe.
- With this patch, FILE_SYNCHRONOUS_IO_NONALERT flag is applied to
  the read pipe so that native C# programs work with cygwin pipe.
  To handle signals in reading pipe with this flag set, the read
  pipe itself is always set to nonblocking mode and simulates the
  blocking behaviour in raw_read().

- Default to byte mode rather than message mode in order to make
  C# programs work with cygwin pipe.

Addresses: https://cygwin.com/pipermail/cygwin/2021-March/247987.html
2021-12-12 22:11:05 +09:00
Takashi Yano f3d719c694 Cygwin: console: Fix console mode of non-cygwin apps in background.
- If the non-cygwin app is started in the background in console, the
  console mode is broken for the app. This patch fixes the issue.
2021-12-12 21:46:37 +09:00
Takashi Yano d593c3e17e Cygwin: pty: Fix console mode of non-cygwin apps in background.
- If the non-cygwin app is started in the background in pseudo
  console, the console mode is broken for the app. This patch fixes
  the issue.
2021-12-12 21:46:31 +09:00
Takashi Yano e91ea41ef1 Cygwin: pty: Fix Ctrl-C handling for non-cygwin apps in background.
- With pseudo console enabled, if the non-cygwin app is started in
  the background and put it into the foreground, the process cannot
  be stopped by Ctrl-C. This patch fixes the issue.
2021-12-12 21:46:24 +09:00
Takashi Yano acc44e09d1 Cygwin: pty: Add missing input transfer when switch_to_pcon_in state.
- This patch fixes the bug that input is wrongly sent to io_handle_nat
  rather than io_handle when neither read() nor select() is called
  after the cygwin app is started from non-cygwin app. This happens
  only if psuedo console is disabled.

Addresses:
  https://cygwin.com/pipermail/cygwin-patches/2021q4/011587.html
2021-12-12 21:46:05 +09:00
Takashi Yano 72175bbd28 Cygwin: clipboard: Make intent of the code clearer. 2021-12-11 23:25:16 +09:00
Takashi Yano 5aa2be8ac2 Cygwin: path: Fix path conversion of virtual drive.
- The last change in path.cc introduced a bug that causes an error
  when accessing a virtual drive which mounts UNC path such as
  "\\server\share\dir" rather than "\\server\share". This patch
  fixes the issue.
2021-12-11 22:49:52 +09:00
Jon Turney 366e43a30c
Cygwin: Update configure.ac to use AC_CONFIG_HEADERS
This avoids warning with autoconf >= 2.70:

  configure.ac:47: warning: The macro `AC_CONFIG_HEADER' is obsolete.

AC_CONFIG_HEADERS has been supported since before autconf 2.59, the
minimum version we can be using, controlled by AC_PREREQ.
2021-12-08 14:10:55 +00:00
Takashi Yano 30089b3fbd Cygwin: path: Convert UNC path prefix back to drive letter.
- When symlink_info::check() is called with the path having drive
  letter and UNC path is mounted to the drive, the path is replaced
  with UNC path. With this patch, UNC path prefix is converted back
  to drive letter.  This fixes the issue:
  https://cygwin.com/pipermail/cygwin/2021-November/250087.html
  https://cygwin.com/pipermail/cygwin/2021-December/250103.html
2021-12-08 20:20:30 +09:00
Takashi Yano 69ed8ca20c Cygwin: clipboard: Fix a bug in read().
- Fix a bug in fhandler_dev_clipboard::read() that the second read
  fails with 'Bad address'.

Addresses:
  https://cygwin.com/pipermail/cygwin/2021-December/250141.html
2021-12-07 23:38:50 +09:00
Takashi Yano 8dd641f236 Cygwin: Fix typo in new-features.xml 2021-12-03 12:19:44 +09:00
Corinna Vinschen fb1fe93203 Cygwin: errno: handle ERROR_CASE_DIFFERING_NAMES_IN_DIR
Rather than special case status code 0xc00004b3, add status and matching
error code to ntdll.h and handle it as part of the standard error mapping.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-12-02 14:16:05 +01:00
Takashi Yano e1026837dd Cygwin: console: Fix OSC sequence handling.
- Currently, some OSC escape sequences, such as 'OSC 110 BEL', are
  not handled correctly. This patch fixes the issue.
2021-12-02 11:26:26 +09:00
Corinna Vinschen 3edea7cd55 Cygwin: get/setrlimit: move RLIMIT_AS handling into static functions
To keep getrlimit/setrlimit clean, move the RLIMIT_AS code into
local static functions __set_rlimit_as and __get_rlimit_as.

Also, make adding process to the job the last step, to be able to
close and release the job resources if anything failed.  Add matching
comment.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-30 12:55:14 +01:00
Corinna Vinschen 670beaed02 Cygwin: setrlimit: Add a permission check
If the incoming soft limit is less restrictive than the current
hard limit, bail out with EPERM.  Given the previous sanity check,
this implies trying to raise the hard limit.  While, theoretically,
this should be allowed for privileged processes, Windows has no
matching concept in terms of job limits

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-30 12:55:14 +01:00
Corinna Vinschen d64cd470ae Cygwin: get_rlimit_stack: add a comment
...just to see what it's used for.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-30 12:54:40 +01:00
Corinna Vinschen 3502a6ff2e Cygwin: add 3.4 release messages
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-26 17:06:00 +01:00
Corinna Vinschen 1c7384f9d1 Cygwin: get/setrlimit: implement RLIMIT_AS
Code based on the idea implemented by the oneTBB project,
see https://github.com/oneapi-src/oneTBB

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-26 17:01:28 +01:00
Ken Brown 4f47e64b11 Cygwin: fhandler_fifo::raw_read: handle STATUS_PENDING
NtReadFile can return STATUS_PENDING occasionally even in non-blocking
mode.  Check for this and wait for NtReadFile to complete.  To avoid
code repetition, do this in a static helper function nt_read.
2021-11-23 15:50:01 -05:00
Ken Brown 6d34b62cb8 Cygwin: fhandler_pipe::raw_read: fix handle leak
Slightly rearrange the code to avoid returning without closing the
event handle.
2021-11-23 10:19:49 -05:00
Takashi Yano e84b43ea93 Cygwin: Fix release note 3.3.3.
- Removes the bug fix entry that was accidentally added to the
  release notes 3.3.3, even though it had been already fixed in
  3.3.2.
2021-11-23 01:19:56 +09:00
Takashi Yano a496c9cdf8 Cygwin: sigproc: Fix potential race issue regarding exit_state.
- If sig_send() is called while another thread is processing exit(),
  race issue regarding exit_state may occur. This patch fixes the
  issue.
2021-11-22 23:26:06 +09:00
Corinna Vinschen 68faeef4be ldtoa: don't restrict outbuf size to ndigits
https://cygwin.com/pipermail/cygwin/2021-November/249930.html
reported a regression introduce by using a dynamically sized local
char array in favor of a statically sized array.

Fix this by reverting to a statically sized array, using a small
buffer on the stack for a reasonable number of requested digits, a
big mallocated buffer otherwise.  This should work for small targets
as well, given that malloc is used in printf anyway right now.

This is *still* hopefully just a temporary measure, unless somebody
actually provides a new ldtoa.

Fixes: 4d90e53359 ("ldtoa: fix dropping too many digits from output")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-22 13:57:16 +01:00
Corinna Vinschen 1fda4aebd6 Cygwin: add release message for raise fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-22 12:38:15 +01:00
Corinna Vinschen afb7c557d2 Cygwin: raise: align return value and error checking to Linux
raise(2) on Linux returns the same values and sets errno
independent of calling kill(2) or pthread_kill(3).  Align
code to behave the same.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-22 12:37:12 +01:00
Corinna Vinschen 24bffff63e Cygwin: raise: fix check for multithreaded process
The check for the pthread self pointer in TLS is misleading,
given the main thread has this pointer initialized as well.
Check for the global __isthreaded flag as well.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-22 12:37:12 +01:00
Corinna Vinschen d54d8f173d Cygwin: pthread_kill: check for invalid signal number
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-22 12:37:12 +01:00
Corinna Vinschen f03222f242 Cygwin: fhandler_netdrive: improve debug output
Add debug output for errors when calling WNet functions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-22 10:38:09 +01:00
Takashi Yano a92d69d743 Cygwin: sigproc: Do not send signal to myself if exiting.
- This patch fixes the issue that process sometimes hangs for 60
  seconds with the following scenario.
    1) Open command prompt.
    2) Run "c:\cygwin64\bin\bash -l"
    3) Compipe the following source with mingw compiler.
       /*--- Begin ---*/
       #include <stdio.h>
       int main() {return getchar();}
       /*---- End ----*/
    4) Run "tcsh -c ./a.exe"
    5) Hit Ctrl-C.
2021-11-20 02:37:52 +09:00
Takashi Yano c8b779aff4 Cygwin: console: Fix interference issue regarding master thread.
- This patch fixes the issue that ReadConsoleInputW() call in the
  master thread interferes with the input process of non-cygwin apps.
2021-11-18 14:17:15 +09:00
Takashi Yano 8c1bbf2f2c Cygwin: pipe: Suppress unnecessary set_pipe_non_blocking() call.
- Call set_pipe_non_blocking(false) only if the pipe will be really
  inherited to non-cygwin process.
2021-11-18 02:58:54 +09:00
Takashi Yano b959a54321 Cygwin: Correct the release notes 3.3.3.
- Fix incorrect description of the bug fixes part.
2021-11-18 02:46:02 +09:00
Takashi Yano 5badb8aa0a Cygwin: pipe: Handle STATUS_PENDING even for nonblocking mode.
- NtReadFile() and NtWriteFile() seems to return STATUS_PENDING
  occasionally even in nonblocking mode. This patch adds handling
  for STATUS_PENDING in nonblocking mode.

Addresses:
  https://cygwin.com/pipermail/cygwin/2021-November/249910.html
2021-11-17 08:14:23 +09:00
Corinna Vinschen 41de4b6fd7 Cygwin: fix up cached DOS file attributes after file creation
The file attributes after creating a file are not necessarily
identical to the attributes we passed as argument to NtCreateFile.
This results in subsequent operations like fchmod or facl to
set the DOS file attributes to unexpected values.

The fix is to request file attributes from the OS after file creation
and cache those.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-16 19:58:56 +01:00
Corinna Vinschen 9980177def Revert "Cygwin: set the FILE_ATTRIBUTE_ARCHIVE DOS attribute on file creation"
This reverts commit 2b28977149.

This patch fixes the symptoms, but not the actual problem.  Revert
and try again.
2021-11-16 19:58:56 +01:00
Johannes Schindelin 782aac590a Cygwin: console: Handle Unicode surrogate pairs.
When running Cygwin's Bash in the Windows Terminal (see
https://docs.microsoft.com/en-us/windows/terminal/ for details), Cygwin
is receiving keyboard input in the form of UTF-16 characters.

UTF-16 has that awkward challenge that it cannot map the full Unicode
range, and to make up for it, there are the ranges U+D800-U+DBFF and
U+DC00-U+DFFF which are illegal except when they come in a pair encoding
for Unicode characters beyond U+FFFF.

Cygwin does not handle such surrogate pairs correctly at the moment, as
can be seen e.g. when running Cygwin's Bash in the Windows Terminal and
then inserting an emoji (e.g. via Windows + <dot>, which opens an emoji
picker on recent Windows versions): Instead of showing an emoji, this
shows the infamous question mark in a black triangle, i.e. the invalid
Unicode character.

Let's special-case surrogate pairs in this scenario.

This fixes https://github.com/git-for-windows/git/issues/3281

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-11-16 23:20:43 +09:00
Mike Frysinger 6226bad0ea change _COMPILING_NEWLIB to _LIBC
Use the same name as glibc & gnulib to indicate "newlib itself is
being compiled".  This also harmonizes the codebase a bit in that
_LIBC was already used in places instead of _COMPILING_NEWLIB.

Building for bfin-elf, mips-elf, and x86_64-pc-cygwin produces
the same object code.
2021-11-15 19:32:23 -05:00
Corinna Vinschen 2b28977149 Cygwin: set the FILE_ATTRIBUTE_ARCHIVE DOS attribute on file creation
Do this for normal files and symlinks, not for temporary files,
device files or unix sockets.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-15 20:59:41 +01:00
Corinna Vinschen 98d10e5fd2 Cygwin: dllfixdbg: create .gnu_debuglink section in the right spot
A recent change in binutils marks the .gnu_debuglink_overlay section
as debug section.  When dllfixdbg calls objcopy -g, the section
is removed and the --add-gnu-debuglink option on the same command line
appends the section consequentially at the end of the sections.
This in turn breaks Windows Version info and, potentially, raising
the cygheap size at runtime.

Fix this by adding an explicit --keep-section=.gnu_debuglink_overlay
to the objcopy command line.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-15 13:44:57 +01:00
Corinna Vinschen 88c9008bb2 Cygwin: add 3.3.3 release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-11 11:01:23 +01:00
Corinna Vinschen 7e7d471644 Cygwin: introduce isabspath_strict macro
isabspath handles a path "X:", without trailing slash or backslash,
as absolute path.  This breaks some scenarios with relative paths
starting with "X:".  For instance, fstatat will mishandle a call
with valid dirfd and "c:" as path.

The reason is that gen_full_path_at() will check for isabspath("C:")
which returns true.  So the path will be used verbatim in fstatat,
rather than being converted to a path "<dirfd-path>/c:".

So, introduce isabspath_strict, which returns true for paths starting
with "X:" only if the next char is actually a slash or backslash.
Use it from gen_full_path_at().

This still fixes only half the problem.  The right thing would have been
to disallow using DOS paths in the first place.  Unfortunately it's much
too late for that.

Addresses: https://cygwin.com/pipermail/cygwin/2021-November/249837.html
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-11 10:48:22 +01:00
Corinna Vinschen eaf0725486 Cygwin: drop unused isabspath_u and iswabspath macros
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-11 10:48:22 +01:00
Takashi Yano 576ace1f2f Cygwin: pipe: Fix raw_write() for non-cygwin pipe with size zero.
- Currently, raw_write() fails to handle size zero pipe which may
  be created by non-cygwin apps (e.g. Windows native ninja). This
  patch fixes the issue.

Addresses:
  https://cygwin.com/pipermail/cygwin/2021-November/249844.html
2021-11-11 14:02:19 +09:00
Mike Frysinger 24491c1251 winsup: delete old _LIBC logic
This logic has never been used as we don't define _LIBC and the
reentrant.h header doesn't exist, so delete it all.
2021-11-10 20:16:15 -05:00
Takashi Yano c6f0a46d71 Cygwin: pipe: Handle WAIT_CANCELED when waiting read_mtx.
- Add missing handling for WAIT_CANCELED in cygwait() for read_mtx
  in raw_read().
2021-11-10 21:12:21 +09:00
Takashi Yano 365199090c Cygwin: pipe: Avoid false EOF while reading output of C# programs.
- If output of C# program is redirected to pipe, pipe reader falsely
  detects EOF. This happens after overhaul of pipe implementation.
  This patch fixes the issue.

Addresses:
  https://cygwin.com/pipermail/cygwin/2021-November/249777.html
2021-11-08 11:06:58 +01:00
Corinna Vinschen 55dd0676ce Cygwin: fix permission problem when writing DAC info on Samba shares
Cygwin always requests FILE_WRITE_ATTRIBUTES permissions when trying to
change DAC information.  This can lead to permission problems when
trying to chmod/chown files on Samba shares.  Drop requesting
FILE_WRITE_ATTRIBUTES on Samba shares and go with WRITE_DAC/WRITE_OWNER
only.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-04 21:52:35 +01:00
Corinna Vinschen e37bfc8ba1 Cygwin: Add a new 3.4.0 rel notes file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-04 13:14:17 +01:00
Corinna Vinschen c41fd516e0 Cygwin: add release note for rounding issue
Also rename release 3.4.0 to 3.3.2.  It doesn't make sense to
duplicate the issues fixed in 3.3.x into the 3.4.0 relnotes.
Only patches not backported into 3.3.x belong into 3.4.0.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-04 13:14:17 +01:00
Takashi Yano d4e42ceb96 Cygwin: console: Prevent the exec'ed bash from exiting by Ctrl-C.
- Currently, bash occasionally exits by Ctrl-C with the following
  scenario.
    1) Start bash in the command prompt.
    2) Run 'exec bash'.
    3) Press Ctrl-C several times.
  This patch fixes the issue.
2021-11-03 14:52:03 +01:00
Corinna Vinschen eb628ca8ea Cygwin: add release note
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-02 15:10:58 +01:00
Takashi Yano 2221bebd71 Cygwin: console: Fix yet another bug on input when signalled.
- Currently, read() returns EINTR due to a bug if signal handler
  is SIG_DFL and the process is suspended by Ctrl-Z and restarted.
  This patch fixes the issue.
2021-11-02 11:20:50 +01:00
Takashi Yano 561767fc59 Cygwin: console: Fix a bug on input when signalled.
- This patch fixes the bug that Ctrl-C sometimes does not work as
  expected in Windows Terminal.

Addresses:
  https://cygwin.com/pipermail/cygwin/2021-November/249749.html
2021-11-02 11:20:50 +01:00
Corinna Vinschen 045ce20177 Cygwin: remove unused lsaauth authentication function
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 21:03:07 +02:00
Corinna Vinschen a4efb2a669 Cygwin: remove support for Vista entirely
Fix up a few comments while at it

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:45 +02:00
Corinna Vinschen 080eae709f Cygwin: drop support for systems not supporting the CONSOLE LOGON SID
i. e. Vista/2008.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:45 +02:00
Corinna Vinschen b794f2c603 Cygwin: drop support for systems not supporting RFC 4646 locales
i. e. Vista/2008.  This drops support for the sr_CS locale.

Regenerate LC_MESSAGES and LC_TIME ERA data from more recent Linux

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:45 +02:00
Corinna Vinschen 687c4bad28 Cygwin: drop support for systems not supporting processor groups
i. e., Vista/2008.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:45 +02:00
Corinna Vinschen 4bc8f1adb4 Cygwin: drop support for simple invisible console code
i. e., Vista/2008.

AllocConsole appears to allow creating a console only on the currently
visible desktop since Windows 7, which broke the simple code opening
the console on an invisible desktop in an invisible window station.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:45 +02:00
Corinna Vinschen e8bfe36281 Cygwin: drop support for systems not supporting QueryUnbiasedInterruptTime
i. e., Vista/2008

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 18:19:40 +02:00
Corinna Vinschen e36811afb4 Cygwin: drop Vista WOW64 specific child process handle bug
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-29 14:52:58 +02:00
Corinna Vinschen 7a3df8bb6f Cygwin: bump DLL major version
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-28 22:29:42 +02:00
Corinna Vinschen 3860338968 Cygwin: bump DLL minor version
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-28 13:41:19 +02:00
Corinna Vinschen 44a79a6eca Cygwin: convert malloc lock to SRWLOCK
Per https://cygwin.com/pipermail/cygwin-developers/2021-October/012429.html,
we may encounter a crash when starting multiple threads during process
startup (here: fhandler_fifo::fixup_after_{fork,exec}) which in turn
allocate memory via malloc.

The problem is concurrent usage of malloc before the malloc muto has
been initialized.

To fix this issue, convert the muto to a SRWLOCK and make sure it is
statically initalized.  Thus, malloc can be called as early as necessary
and malloc_init is only required to check for user space provided malloc.

Note that this requires to implement a __malloc_trylock macro to be
called from fork.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-26 18:47:22 +02:00
Mark Geisert 23b1400f83 Cygwin: Make native clipboard layout same for 32- and 64-bit
This patch unifies the layout of the clipboard descriptor cygcb_t for
32- and 64-bit Cygwin.  It allows correct copy/paste between the two
environments without corruption of user's copied data and without access
violations due to interpreting that data as a size field.

The definitions of CYGWIN_NATIVE and cygcb_t are moved to a new include
file, sys/clipboard.h.  The include file is used by fhandler_clipboard.cc
as well as getclip.c and putclip.c in the Cygwin cygutils package.

When copy/pasting between 32- and 64-bit Cygwin environments, both must
be running version 3.3.0 or later for successful operation.
2021-10-26 12:42:21 +02:00
Ken Brown 65d6818661 Cygwin: document sig2str and str2sig in version.h 2021-10-22 13:56:05 -04:00
Corinna Vinschen cb21b9cc57 Cygwin: drop outdated -O3 optimization for malloc and sync
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-22 12:47:09 +02:00
Corinna Vinschen 548f124698 Cygwin: update cygcheck OS information
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-21 18:33:35 +02:00
Takashi Yano 745b547ebd Cygwin: pipe: Use NtQuerySystemInformation() instead of EnumProcesses().
- Using EnumProcess() breaks Windows Vista compatibility. This patch
  replaces EnumProcesses() with NtQuerySystemInformation().

Addresses:
https://cygwin.com/pipermail/cygwin-developers/2021-October/012422.html
2021-10-19 11:09:47 +02:00
Takashi Yano dcd564f65c Cygwin: pty: Fix handle leak regarding attach_mutex.
- If the process having master pty opened is forked, attach_mutex
  fails to be closed when master is closed. This patch fixes the
  issue.
2021-10-10 08:57:51 -04:00
Takashi Yano 8a09deb1b7 Cygwin: pty: Fix master closing error regarding attach_mutex.
- If two or more pty masters are opened in a process, closing master
  causes error when closing attach_mutex. This patch fixes the issue.

Addresses:
https://cygwin.com/pipermail/cygwin-developers/2021-October/012418.html
2021-10-08 13:27:50 -04:00
Takashi Yano 6c1f49f83f Cygwin: pipe: Use ProcessHandleInformation if available.
- The commit b531d6b0 introduced temporary_query_hdl() which uses
  SystemHandleInformation. With this patch, ProcessHandleInformation
  rather than SystemHandleInformation is used if it is available.
  This request is faster, however, is only available since Windows 8,
  therefore, SystemHandleInformation is used for Windows Vista and 7
  as before.
2021-09-23 12:24:19 -04:00
Takashi Yano b531d6b06e Cygwin: pipe: Introduce temporary query_hdl.
- The commit f79a4611 introduced query_hdl, which is the read pipe
  handle kept in the write pipe instance in order to determine if
  the pipe is ready to write in select().  This implementation has
  a potential risk that the write side fails to detect the closure
  of the read side if more than one writer exists and one of them
  is a non-cygwin process.

  With this patch, the strategy of commit f79a4611 is used only if
  the process is running as a service.  For a normal process,
  instead of keeping query_hdl in the write pipe instance, it is
  retrieved temporarily when select() is called.  Actually, we
  want to use tenporary query_hdl for all processes, however, it
  does not work for service processes due to OpenProcess()
  failure.
2021-09-21 14:47:33 -04:00
Ken Brown 643db9ec9e Cygwin: pipes: remove unnecessary NULL checks for hdl_cnt_mtx
In view of the previous changes to open_setup, we can always assume
that hdl_cnt_mtx is non-NULL.
2021-09-18 09:25:20 -04:00
Ken Brown be08c5c40b Cygwin: make callers of open_setup check for failure
open_setup is called by dtable::init_std_file_from_handle and
fhandler_base::open_with_arch.  In both cases, failure of open_setup
is now a fatal error.

Currently this can only happen in the following situation: A Cygwin
process is started by a non-Cygwin process, one of the standard IO
handles is a pipe handle, and Cygwin is unable to create a required
mutex (read_mtx or hdl_cnt_mtx).
2021-09-18 09:10:23 -04:00
Ken Brown 6fc0aa8e5d Cygwin: fhandler_pipe::open_setup: fail on error creating mutexes 2021-09-18 08:49:06 -04:00
Ken Brown e5fcb021cc Cygwin: allow open_setup to fail
Convert fhandler_base::open_setup to a (virtual) method that returns a
bool result.  For the moment, it and its overrides always return true.
2021-09-18 08:40:11 -04:00
Ken Brown 9b0841aa78 Cygwin: statically link the tools in winsup/utils/mingw
This fixes the problem reported here:

  https://cygwin.com/pipermail/cygwin-developers/2021-September/012375.html
2021-09-17 21:38:07 -04:00
Ken Brown 98859e00d0 Cygwin: fix typos in release notes 2021-09-17 16:16:14 -04:00
Takashi Yano 9814cfd8f6 Cygwin: pipe, fifo: Move query_hdl and hdl_cnt_mtx to fhandler_pipe.
- query_hdl and hdl_cnt_mtx are moved from fhandler_pipe_fifo to
  fhandler_pipe. Then reader_closed() is changed to virtual and
  overridden in fhandler_pipe.
2021-09-16 15:53:57 -04:00
Takashi Yano 199482654b Cygwin: pipe: Fix race issue regarding handle count.
- This patch fixes the race issue in the handle counting to detect
  closure of read pipe, which is introduced by commit f79a4611.
  A mutex hdl_cnt_mtx is introduced for this issue.
2021-09-16 10:57:36 -04:00
Takashi Yano d8614e355d Cygwin: pipe: Fix error handling in fhandler_pip::create().
- Currently, error handling in fhandler_pipe::create() is broken.
  This patch fixes that.
2021-09-16 10:57:24 -04:00