Commit Graph

21010 Commits

Author SHA1 Message Date
Jon Turney 736e7c709b
Cygwin: Add '--names-only' flag to cygcheck
Add '--names-only' flag to cygcheck, to output just the bare package
names.

(cherry picked from commit 127166f707)
2023-11-29 16:10:14 +00:00
Corinna Vinschen 3b617528e7 Cygwin: bump DLL version to 3.4.11
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-29 12:44:46 +01:00
Corinna Vinschen 89a1e4a573 Cygwin: open(2): reset sparseness on O_TRUNCated files
open(2) implements O_TRUNC by just reducing the size of the file
to 0, to make sure EAs stay available.

Turns out, file sparseness is not removed this way either, so add
code to do just that.

Fixes: 603ef545bd ("* fhandler.cc (fhandler_base::open): Never open files with  FILE_OVERWITE/FILE_OVERWRITE_IF.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28 10:55:52 +01:00
Corinna Vinschen 8e009dce7c Cygwin: posix_fallocate: return ENODEV
The fhandler method ftruncate returns either EISDIR if it has been
called on directories, or EINVAL if called on files other than
regular files.  This matches what ftruncate(2) is supposed to return,
but it doesn't match posix_fallocate(3), which is supposed to return
ENODEV in both cases.

To accomplish that, return ENODEV from fhandler_base::ftruncate()
and convert it to EINVAL in ftruncate(2). In posix_fallocate(3),
convert EISDIR to ENODEV.

Fixes: 7636b58590 ("* autoload.cc (NtSetInformationFile): Define.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28 10:55:52 +01:00
Takashi Yano 4a7cc5af01 newlib: nl_langinfo: Fix a bug of time stuff.
Previously, e.g. nl_langinfo(_NL_TIME_WMONTH_1) returns "February"
due to the bug. Similarly, nl_langinfo(_NL_TIME_WWDAY_1) returns
"Mon". This occurs because wide char month and weekday arrays are
pointed off-by-one (e.g. the array wmon[12] is reffered as wmon[1-12]
rather than wmon[0-11]). This patch fixes that.

Fixes: d47d5b850b ("Extend locale support to maintain wide char values of native strings")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-11-24 09:53:31 +09:00
Corinna Vinschen 8d5043b32f Cygwin: rand(3): implement in terms of random(3)
This makes rand(3) ISO C compliant and adds locking to avoid
race conditions.

Reported-by: Bruno Haible <bruno@clisp.org>
Fixes: 8a0efa53e4 ("import newlib-2000-02-17 snapshot")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-14 17:54:55 +01:00
Mark Geisert 721b5e05b9 Fix profiler error() definition and usage
Minor updates to profiler and gmondump, which share some code:
- fix operation of error() so it actually works as intended
- resize 4K-size auto buffer reservations to BUFSIZ (==1K)
- remove trailing '\n' from 2nd arg on error() calls everywhere
- provide consistent annotation of Windows error number displays

Fixes: 9887fb27f6126 ("Cygwin: New tool: profiler")
Fixes: 087a3d76d7335 ("Cygwin: New tool: gmondump")
Signed-off-by: Mark Geisert <mark@maxrnd.com>
2023-11-14 11:53:08 +01:00
Corinna Vinschen 35bb10c895 Add release text for random(3) fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-13 20:01:36 +01:00
Corinna Vinschen ea980c5d41 Cygwin: random: drop unused function srandomdev()
Also drop includes only required for srandomdev().

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-13 19:54:59 +01:00
Corinna Vinschen 6461906beb Cygwin: random: make random(3) functions thread-safe
Add locking to the random(3) family of functions to gain
thread-safety per POSIX. Use NetBSD version of the file as
role-model.

Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-13 19:52:37 +01:00
Corinna Vinschen 97a975dac2 Cygwin: let feraiseexcept actually raise an exception
The exception handling inside of Cygwin functions marked as SIGFE
covers exceptions and lets the library code handle them gracefully.
If these functions want to raise an exception, they have to send a
signal explicitely via raise(3).

That's not what we want in feraiseexcept(). It triggers a floating
point exception explicitely by calling the i387 op "fwait".  Being
marked as SIGFE, this exception will be suppressed and the normal
exception handling won't kick in.

Fix this by moving feraiseexcept into the NOSIGFE realm.

Fixes: 0f81b5d4bc ("* Makefile.in (DLL_OFILES): Add new fenv.o module.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-10-31 13:29:15 +01:00
Corinna Vinschen f0c90d3a8a Cygwin: cwd: avoid releasing the cwdstuff SRW Lock twice
cwdstuff::set has a code snippet handling the case where a process
can't create a handle to a directory, e. g., due to permissions.

Commit 88443b0a22 ("cwdstuff: Don't leave from setting the CWD
prematurely on init") introduced a special case to handle this
situation at process initialization. It also introduces an early
mutex release, which is not required, but ok, because we're in the
init phase. Releasing the mutex twice is no problem since the mutexes
are recursive.

Fast forward to commit 0819679a7a ("Cygwin: cwd: use SRWLOCK
instead of muto"). The mechanical change from a recursive mutex
to a non-recursive SRWLOCK failed to notice that this very specific
situation will release the SRWLOCK twice.

Remove the superfluous release action. While at it, don't set dir to
NULL, but h, since dir will get the value of h anyway later on.
Setting h to NULL may not be necessary, but better safe than sorry.

Reported-by: tryandbuy >tryandbuy@proton.me>
Fixes: 88443b0a22 ("cwdstuff: Don't leave from setting the CWD prematurely on init")
Fixes: 0819679a7a ("Cygwin: cwd: use SRWLOCK instead of muto")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-10-31 10:52:02 +01:00
Takashi Yano 386e762aa1 Cygwin: dsp: Fix a bug that app hangs if it killed during write().
If app is killed during blocking write(), it sometimes hangs. This
patch fixes the issue.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-09-17 22:00:12 +09:00
Mark Geisert 4ef164d233
Cygwin: Add relnote to 3.4.10 release file
Document the most recent update to include/sys/cpuset.h.

(cherry picked from commit 27e8815535)
2023-09-10 14:36:53 +01:00
Mark Geisert 8ca815618d
Cygwin: Fix __cpuset_zero_s prototype
Add a missing "void" to the prototype for __cpuset_zero_s().

Reported-by: Marco Mason <marco.mason@gmail.com>
Addresses: https://cygwin.com/pipermail/cygwin/2023-September/254423.html
Signed-off-by: Mark Geisert <mark@maxrnd.com>
Fixes: c6cfc99648d6 (Cygwin: sys/cpuset.h: add cpuset-specific external functions)
(cherry picked from commit 003fc33942)
2023-09-10 14:36:41 +01:00
Corinna Vinschen 8cbda39f8a Cygwin: bump DLL version to 3.4.10
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-06 12:40:24 +02:00
Takashi Yano b48a497cf0 Cygwin: dps: Fix a bug that read() could not return -1 on error. 2023-09-05 17:09:31 +09:00
Jon Turney 567f3aae68
Cygwin: CI: Stop running testsuite on 3.4 branch
It often (always?) gets stuck and takes a long time
2023-09-02 17:54:39 +01:00
Corinna Vinschen 97a9684b99 Cygwin: document latest sys/cpuset.h fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-01 12:43:36 +02:00
Corinna Vinschen 6fbbb95e0d Cygwin: sys/cpuset.h: use internal base types
Use __size_t and __pid_t instead of size_t and pid_t to avoid
further dependencies to external headers.

Reported-by: Brian Inglis <Brian.Inglis@Shaw.ca>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-01 12:43:36 +02:00
Corinna Vinschen 797d1bbd2e Cygwin: sys/cpuset.h: add cpuset-specific external functions
The latest incarnation of sys/cpuset.h broke building coreutils.
The reason is the inclusion of stdlib.h and string.h and hence
premature requests for datatypes not yet defined in the include
chain.

Avoid this by defining __cpuset_alloc and __cpuset_free as external
functions, now defined in sched.cc.  Linux is doing this too, just
using different names for the functions. Redefine  __cpuset_zero_s
to use __builtin_memset only on compilers supporting it, otherwise
using a simple loop. Drop the stdlib.h and string.h includes.

Fixes: 3f2790e044 ("Cygwin: Make gcc-specific code in <sys/cpuset.h> compiler-agnostic")
Reported-by: Denis Excoffier <cygwin@Denis-Excoffier.org>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-01 12:43:36 +02:00
Takashi Yano 930f210b21 Cygwin: dsp: Fix a few trivial bugs.
Signed-off-by: Takashi Yano <takashi.yanao@nifty.ne.jp>
2023-09-01 19:06:24 +09:00
Corinna Vinschen d9476b95ea Cygwin: execve: drop argument size limit
Before commit 44f73c5a62 ("Cygwin: Fix segfalt when too many command
line args are specified.") we had no actual argument size limit, except
for the fact that the child process created another copy of the argv
array on the stack, which could result in a stack overflow and a
subsequent SEGV.  Commit 44f73c5a62 changed that by allocating the
additional argv array via malloc, and it introduced a new SC_ARG_MAX
limit along the lines of the typical Linux limit.

However, this new limit is artificial. Cygwin allocates all argument
and environment data on the cygheap.  We only run out of ARG_MAX space
if we're out of memory resources.

Change argument size handling accordingly:
- Drop the args size check from  child_info_spawn::worker.
- Return -1 from sysconf (SC_ARG_MAX), i. e., the argument size limit
  is undefined.
- Change argv handling in class av, so that a failing cmalloc is not
  fatal.  This allows the parent process to return E2BIG if it's out
  of cygheap resources.
- In the child, add a check around the new malloc call, so that it
  doesn't result in a SEGV if the child process gets unexpectedly into
  an ENOMEM situation at this point. In this (unlikely) case, proceed
  with the original __argv array instead.  Add comment to explain why.

Fixes: 44f73c5a62 ("Cygwin: Fix segfalt when too many command line args are specified.")
Tested-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-29 14:19:29 +02:00
Takashi Yano 33cddf7797 Cygwin: Fix segfalt when too many command line args are specified.
Previously, the number of command line args was not checked for
cygwin process. Due to this, segmentation fault was caused if too
many command line args are specified.
https://cygwin.com/pipermail/cygwin/2023-August/254333.html

Since char *argv[argc + 1] is placed on the stack in dll_crt0_1(),
STATUS_STACK_OVERFLOW occurs if the stack does not have enough
space.

With this patch, char *argv[] is placed in heap instead of stack
and ARG_MAX is increased from 32000 to 2097152 which is default
value of Linux. The argument length is also compared with ARG_MAX
and spawnve() returns E2BIG if it is too long.

Reported-by: Ed Morton
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-29 00:19:54 +09:00
Corinna Vinschen 208c3f68a3 Cygwin: document disabling mknod/mkfifo on NFS
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-25 14:50:56 +02:00
Corinna Vinschen f1189d596e Cygwin: mknod: disable creating special files on NFS
This simply doesn't work (yet?) but leaves unusable files behind.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-25 14:39:38 +02:00
Jon Turney d7a76c6b64
Cygwin: configure: Add option to disable building 'dumper'
Rather than guessing, based on just the presence of libbfd, add an
explicit configuration option, to build dumper or not, defaulting to
building it.

This might have some use when bootstrapping Cygwin for a new
architecture, or when building your own Cygwin-targetted cross-compiler,
rather than installing one from the copr, along with the dependencies of
libbfd.

(cherry picked from commit 1b5fc91a1d)
2023-08-19 16:50:03 +01:00
Takashi Yano 3cfd7896ea Cygwin: pty: Fix failure to clear switch_to_nat_pipe flag.
After the commit fbfea31dd9, switch_to_nat_pipe is not cleared
properly when non-cygwin app is terminated in the case where the
pseudo console is disabled. This is because get_winpid_to_hand_over()
sometimes returns PID of cygwin process even though it should return
only PID of non-cygwin process. This patch fixes the issue by adding
a new argument which requests only PID of non-cygwin process to
get_console_process_id().

Fixes: fbfea31dd9 ("Cygwin: pty: Avoid cutting the branch the pty master is sitting on.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-19 14:52:05 +09:00
Corinna Vinschen 1da39f52c5 Cygwin: bump DLL version to 3.4.9
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-17 18:06:05 +02:00
Takashi Yano c3eab1e295 Cygwin: shared: Fix access permissions setting in open_shared().
After the commit 62f11a5a57, the access permissions argument passed
to open_shared() is ignored and always replaced with (FILE_MAP_READ |
FILE_MAP_WRITE). This causes the weird behaviour that sshd service
process loses its cygwin PID. This triggers the failure in pty that
transfer_input() does not work properly.

This patch resumes the access permission settings to fix that.

Fixes: 62f11a5a57 ("Cygwin: open_shared: don't reuse shared_locations parameter as output")
Fixes: fb16f490bf ("Cygwin: open_shared: try harder allocating a shared region")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signedd-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-16 22:06:56 +09:00
Takashi Yano efba30dd1d Cygwin: pty: Add missing pinfo check in transfer_input().
The commit 10d083c745 has a bug that lacks a check for pinfo pointer
value for master_pid. This causes segmentation fault if the process
whose pid is master_pid no longer exists. This patch fixes the issue.

Fixes: 10d083c745 ("Cygwin: pty: Inherit typeahead data between two input pipes.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-16 08:34:25 +09:00
Takashi Yano d2354ee412 Cygwin: pty: Fix thread safety of readahead buffer handling in pty master.
Previously, though readahead buffer handling in pty master was not
fully thread-safe, accept_input() was called from peek_pipe() thread
in select.cc. This caused the problem reported in:
https://cygwin.com/pipermail/cygwin/2023-July/253984.html

The mechanism of the problem is:
1) accept_input() which is called from peek_pipe() thread calls
   eat_readahead(-1) before reading readahead buffer. This allows
   writing to the readahead buffer from another (main) thread.
2) The main thread calls fhandler_pty_master::write() just after
   eat_readahead(-1) was called and before reading the readahead
   buffer by accept_input() called from peek_pipe() thread. This
   overwrites the readahead buffer.
3) The read result from readahead buffer which was overwritten is
   sent to the slave.

This patch makes readahead buffer handling fully thread-safe using
input_mutex to resolve this issue.

Fixes: 7b03b0d8ce ("select.cc (peek_pipe): Call flush_to_slave whenever we're checking for a pty master.")
Reported-by: Thomas Wolff <towo@towo.net>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-04 17:53:17 +09:00
Takashi Yano 5259a3eee8 newlib: gdtoa: Suppress compiler warning.
Fixes: 5ac83ea47a ("newlib: Fix memory leak regarding gdtoa-based _ldtoa_r().")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-04 17:53:07 +09:00
Takashi Yano 841b7307d6 newlib: Fix memory leak regarding gdtoa-based _ldtoa_r().
After the commit a4705d387f, printf() for floating-point values
causes a memory leak. The legacy _ldtoa_r() assumed the char pointer
returned will be free'ed by Bfree(). However, gdtoa-based _ldtoa_r()
returns the pointer returned by gdtoa() which should be free'ed by
freedtoa(). Due to this issue, the caller of _ldtoa_r() fails to free
the allocated char buffer. This is the cause of the said memory leak.
https://cygwin.com/pipermail/cygwin/2023-July/254054.html

This patch makes rv_alloc()/freedtoa() allocate/free the buffer in
a compatible way with legacy _ldtoa_r().

Fixes: a4705d387f ("ldtoa: Import gdtoa from OpenBSD.")
Reported-by: natan_b <natan_b@libero.it>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-02 21:59:42 +09:00
Corinna Vinschen 60ae342e8f Rename _NL_CTYPE_OUTDIGITSx_MB/WC to _NL_CTYPE_OUTDIGITx_MB/WC
The extended _NL_foo names were originally designed after their GLibc
counterparts.  However, the OUTDIGIT macros were accidentally defined as
OUTDIGITS, plural.  Fix them.

Fixes: d47d5b850b ("Extend locale support to maintain wide char values of native strings")
Conflicts: Context formatting changes in winsup/utils/locale.cc not
           backported to 3.4 branch
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26 20:01:24 +02:00
Corinna Vinschen 9cff318f9f Cygwin: add AT_EMPTY_PATH fix to release message
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26 15:19:59 +02:00
Corinna Vinschen b56b4d7fd8 Cygwin: Fix and streamline AT_EMPTY_PATH handling
The GLIBC extension AT_EMPTY_PATH allows the functions fchownat
and fstatat to operate on dirfd alone, if the given pathname is an
empty string.  This also allows to operate on any file type, not
only directories.

Commit fa84aa4dd2 broke this.  It only allows dirfd to be a
directory in calls to these two functions.

Fix that by handling AT_EMPTY_PATH right in gen_full_path_at.
A valid dirfd and an empty pathname is now a valid combination
and, noticably, this returns a valid path in path_ret.  That
in turn allows to remove the additional path generation code
from the callers.

Fixes: fa84aa4dd2 ("Cygwin: fix errno values set by readlinkat")
Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26 15:19:59 +02:00
Corinna Vinschen a2e5f53217 Cygwin: use new _AT_NULL_PATHNAME_ALLOWED flag
Convert gen_full_path_at to take flag values from the caller, rather
than just a bool indicating that empty paths are allowed.  This is in
preparation of a better AT_EMPTY_PATH handling in a followup patch.

Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26 15:19:59 +02:00
Corinna Vinschen 38b8c322d4 Define _AT_NULL_PATHNAME_ALLOWED
Cygwin needs an internal flag to allow specifying an empty pathname
in utimesat (GLIBC extension). We define it in _default_fcntl.h to
make sure we never introduce a value collision accidentally.
While at it, define the values as 16 bit hex values.

Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26 15:19:59 +02:00
Corinna Vinschen 26775886a3 Cygwin: gen_full_path_at: drop never reached code
The check if the local variable p is NULL is useless.  The preceeding
code always sets p to a valid pointer, or it crashes if path_ret is
invalid (which would be a bug in Cygwin).

Fixes: c57b57e5c4 ("* cygwin.din: Sort.")
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26 15:19:59 +02:00
Mark Geisert 119c41065a Cygwin: Update release/3.4.8 for latest <sys/cpuset.h> commit
(cherry picked from commit c836d26d76)
2023-07-13 12:17:53 +02:00
Mark Geisert df0f296f59 Cygwin: Make gcc-specific code in <sys/cpuset.h> compiler-agnostic
The current version of <sys/cpuset.h> cannot be compiled by Clang due to
the use of builtin versions of malloc, free, and memset.  Their presence
here was a dubious optimization anyway, so their usage has been
converted to standard library functions.

The use of __builtin_popcountl remains because Clang implements it just
like gcc does.  If/when some other compiler (Rust? Go?) runs into this
issue we can deal with specialized handling then.

The "#include <sys/cdefs>" here to define __inline can be removed since
both of the new includes sub-include it.

Addresses: https://cygwin.com/pipermail/cygwin/2023-July/253927.html
Fixes: 9cc910dd33a5 (Cygwin: Make <sys/cpuset.h> safe for c89 compilations)
Signed-off-by: Mark Geisert <mark@maxrnd.com>
2023-07-10 10:29:41 +02:00
Corinna Vinschen 1a0530f3e0 Cygwin: Fix latest release message being in the wrong release file.
Fixes: 6422e76637 ("Cygwin: Make <sys/cpuset.h> safe for c89 compilations")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-04 16:51:37 +02:00
Mark Geisert 025aec7318 Cygwin: Make <sys/cpuset.h> safe for c89 compilations
Four modifications to include/sys/cpuset.h:
* Change C++-style comments to C-style also supported by C++
* Change "inline" to "__inline" on code lines
* Add "#include <sys/cdefs.h>" to make sure __inline is defined
* Don't declare loop variables on for-loop init clauses

Tested by first reproducing the reported issue with home-grown test
programs by compiling with gcc option "-std=c89", then compiling again
using the modified <sys/cpuset.h>. Other "-std=" options tested too.

Addresses: https://cygwin.com/pipermail/cygwin-patches/2023q3/012308.html
Fixes: 315e5fbd99ec ("Cygwin: Fix type mismatch on sys/cpuset.h")
Signed-off-by: Mark Geisert <mark@maxrnd.com>
2023-07-04 16:42:45 +02:00
Takashi Yano fcaa1c4967 Cygwin: thread: Reset _my_tls.tid if it's pthread_null in init_mainthread().
Currently, _my_tls.tid is set to pthread_null if pthread::self()
is called before pthread::init_mainthread(). As a result, pthread::
init_mainthread() does not set _my_tls.tid appropriately. Due to
this, pthread_join() fails in LDAP environment if the program is
the first program which loads cygwin1.dll.

https://cygwin.com/pipermail/cygwin/2023-June/253792.html

With this patch, _my_tls.tid is re-initialized in pthread::
init_mainthread() if it is pthread_null.

Reported-by: Mümin A. <muminaydin06@gmail.com>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-06-23 00:29:30 +09:00
Corinna Vinschen 8c2867eebf Cygwin: bump DLL version to 3.4.8
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-06-16 14:56:08 +02:00
Takashi Yano b553457f68 Cygwin: pty: Additional fix for transferring input at exit.
The commit 3456e8b7db does not fix transferring input at exit
appropriately. If the more than one non-cygwin apps are executed
simultaneously and one of them is terminated, the pty master failed
to send input to the other non-cygwin apps. This patch fixes that.

Fixes: 3456e8b7db ("Cygwin: pty: Fix transferring type-ahead input between input pipes.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-06-02 10:28:12 +09:00
Takashi Yano 3456e8b7db Cygwin: pty: Fix transferring type-ahead input between input pipes.
After the commit 595fcb21ff, transferring type-ahead input between
the pipe for cygwin app and the pipe for non-cygwin app will not be
done appropriately when the stdin of the non-cygwin app is not pty.
Due to this issue, sometimes the keyboard input might be lost which
should be sent to cygwin app. This patch fixes the issue.

Fixes: 595fcb21ff ("Cygwin: pty: Fix reading CONIN$ when stdin is not a pty.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-06-01 20:15:21 +09:00
Johannes Schindelin deca777a95
Cygwin: Adjust CWD magic to accommodate for the latest Windows previews
Reportedly Windows 11 build 25*** from Insider changed the current
working directory logic a bit, and Cygwin's "magic" (or:
"technologically sufficiently advanced") code needs to be adjusted
accordingly.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
(cherry picked from commit 4840a56325)
2023-05-24 22:06:22 +01:00
Biswapriyo Nath 1c63eaace8
Cygwin: Fix compiling with w32api-headers v11.0.0
This solves redefinition of FILE_CS_FLAG_CASE_SENSITIVE_DIR in winnt.h
and fixes the following compiler errors

ntdll.h:523:3: error: expected identifier before numeric constant
  523 |   FILE_CS_FLAG_CASE_SENSITIVE_DIR                       = 0x01
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ntdll.h:522:1: note: to match this ‘{’
  522 | {
      | ^

(cherry picked from commit 3bee68248f)
2023-05-01 18:24:36 +01:00