Age | Commit message (Collapse) | Author | Files | Lines |
|
Currently, when cygwin app is launched, the console input mode is
set to tty::cygwin, even if the stdin is not a console. However,
it is not necessary because the cygwin app does not use stdin.
This also applies to stdout and stderr.
With this patch, the console mode is set only when std{in,out,err}
is a console for the cygwin app for better coexistence with non-
cygwin apps.
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
With the commit 476135a24506, set_input_mode() reffers to the flag
disable_master_thread in tty::cygwin mode. So it is necessary to call
set_input_mode() after changing disable_master_thread flag. However,
the commit 476135a24506 was missing that.
With this patch, set_input_mode() is called after changing the flag
disable_master_thread, if the console input mode is tty::cygwin.
Fixes: 476135a24506 ("Cygwin: console: Set ENABLE_PROCESSED_INPUT when disable_master_thread");
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
A __WCTOMB call on the terminating NUL may emit more than a NUL byte.
This is the case if the string ends with a lone UTF-16 high surrogate.
Fixes: 2a3a02a68764 ("Add SUSV2 support for calculating size if output buffer is NULL")
Signed-off-by: Christian Franke <christian.franke@t-online.de>
|
|
for aarch64-pc-cygwin
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Fix typo - parenthesis without an opening parenthesis.
Signed-off-by: John Haugabook <johnhaugabook@gmail.com>
|
|
Running setup-x86_64.exe and performing an individual search for each package,
is a pain in the neck. And the user running "setup-x86_64.exe -q -P packageName"
may have a typo and the package would not be installed.
So by copying and pasting these commands into the terminal setup-x86_64.exe runs
a preliminary search, so when they reach the "Select Packages" window these packages
will be amongst the packages ready to be downloaded. Additionally sorting them makes it
easier to go down the list, and make sure all packages are listed.
Putting separate commands allows the user to pick which packages to download in the
case they want to run config, where those packages are not needed i.e. --without-cross-bootstrap.
Signed-off-by: John Haugabook <johnhaugabook@gmail.com>
|
|
Add 5 additional packages:
for build: libtool;
for dumper utility: libiconv, libiconv2;
for documentation: perl-XML-SAX-Expat, docbook-utils.
When building from a sandbox environment on Windows 11 using the packages currently listed
in faq 6.21, I got the below error after calling "make":
"""""""""""""""
make[3]: Leaving directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup/testsuite'
Making all in doc
make[3]: Entering directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup/doc'
GEN Makefile.dep
GEN cygwin-ug-net/cygwin-ug-net.pdf
GEN cygwin-api/cygwin-api.pdf
GEN cygwin-api/cygwin-api.html
etc...
GEN cygwin-api.info
could not find ParserDetails.ini in /usr/share/perl5/vendor_perl/5.40/XML/SAX
warning : xmlAddEntity: invalid redeclaration of predefined entity 'lt'
sh: line 1: /usr/bin/iconv: No such file or directory
-: warning: document without nodes
GEN cygwin-ug-net.info
could not find ParserDetails.ini in /usr/share/perl5/vendor_perl/5.40/XML/SAX
warning : xmlAddEntity: invalid redeclaration of predefined entity 'lt'
docbook2texi://refentry[@id='proc']/refnamediv: section is too deep
docbook2texi://refsect1[@id='proc-desc']: section is too deep
etc...
sh: line 1: /usr/bin/iconv: No such file or directory
-: warning: document without nodes
make[3]: *** [Makefile:721: cygwin-ug-net.info] Error 141
make[3]: Leaving directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup/doc'
make[2]: *** [Makefile:398: all-recursive] Error 1
make[2]: Leaving directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup'
make[1]: *** [Makefile:9464: all-target-winsup] Error 2
make[1]: Leaving directory '/home/WDAGUtilityAccount/build-newlib'
make: *** [Makefile:883: all] Error 2
"""""""""""""""
Added the packages: libtool, libiconv, libiconv2, perl-XML-SAX-Expat, and docbook-utils.
Ran "make" again, and the error was resolved, and the install completed.
In the case that someone is using a similar OS (Windows 10 and 11), architecture (x64-based PC),
and/or verions of cygwin (3.6.3) for building cygwin from newlib-cygwin, this commit may prevent
those errors from occuring.
Additionally sorting the packages makes it easier to go down the list when selecting from the
"Select Packages" GUI window from setup-x86_64.exe, making sure all packages have been checked.
Signed-off-by: John Haugabook <johnhaugabook@gmail.com>
|
|
GCC 13 does not define the __riscv_misaligned_* builtin defines. They are
supported by GCC 14 or later. Test for __riscv_misaligned_fast to select an
always correct memcpy() implementation for GCC 13.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
|
|
This patch resolves issues related to unsafe access to deallocated
stack memory in the pthread wrapper for AArch64.
Key changes:
- Removed use of x19 by directly loading the thread function and
argument using LDP from [WRAPPER_ARG], freeing one register.
- Stored thread function and argument in x20 and x21 before
VirtualFree to preserve them across calls.
- Used x1 as a temporary register to load the stack base,
subtract CYGTLS, and update SP.
- Moved the thread argument back into x0 after VirtualFree and
before calling the thread function.
Earlier, `wrapper_arg` lived on the stack, which was freed via
`VirtualFree`, risking segfaults on later access. Now, the thread
`func` and `arg` are loaded before the stack is freed, stored in
callee-saved registers, and restored to `x0` before calling the
thread function.
Fixes: f4ba145056db ("Aarch64: Add inline assembly pthread wrapper")
Signed-off-by: Thirumalai Nagalingam <thirumalai.nagalingam@multicorewareinc.com>
|
|
Currently, ENABLE_PROCESSED_INPUT is set in set_input_mode() if
master_thread_suspended is true. This enables Ctrl-C handling when
cons_master_thread is suspended, since Ctrl-C is normally handled
by cons_master_thread.
However, when disable_master_thread is true, ENABLE_PROCESSED_INPUT
is not set, even though this also disables Ctrl-C handling in
cons_master_thread. Due to this bug, the command
C:\cygwin64\bin\sleep 10 < NUL
in the Command Prompt cannot be terminated with Ctrl-C.
This patch addresses the issue by setting ENABLE_PROCESSED_INPUT
when either disable_master_thread or master_thread_suspended is true.
This bug also affects cases where non-Cygwin Git (Git for Windows)
launches Cygwin SSH. In such cases, SSH also cannot be terminated
with Ctrl-C.
Addresses: https://github.com/git-for-windows/git/issues/5682#issuecomment-2995983695
Fixes: 746c8116dd4f ("Cygwin: console: Allow pasting very long text input.")
Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
This is apparently relative to the new cwd, but my implementation is
currently treating it as relative to the parent's cwd, so it's worth
testing.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
This is a legal (if non-obvious) thing to do, so test it.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Test CWD and redirection of standard handles.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
This program is currently meant to test standard file handles and
current working directory (since these are settable via posix_spawn),
but could be extended to add additional checks if other cygwin-to-win32
process properties need to be tested.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Fixes: 940dbeffa713 ("Cygwin: pipe: Fix unexpected blocking mode change by pipe_data_available()")
Reported by: Andrew Ng <anng.sw@gmail.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
There are tree variables for similar purpose in raw_write(), avail,
chunk, and len1. avail is the amount of writable space in the pipe.
len1 is the data length to attempt to NtWriteFile(). And chunk is
intermediate value to calculate len1 from avail which holds
min(avail, len). Here, chunk has no clear role among them. In fact,
it appears to obscure the intent of the code for the reader.
This patch removes the use of chunk and obtains len1 directly from
avail.
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
ipipe_data_available() is called from raw_write(). If the pipe is in
real_non_blocking_mode at that time, calling pipe_data_available()
can, in some cases, inadvertently revert the pipe to blocking mode.
Here is the background: pipe_data_available() checks the amount of
writable space in the pipe by calling NtQueryInformationFile() with
the FilePipeLocalInformation parameter. However, if the read side of
the pipe is simultaneously consuming data with a large buffer,
NtQueryInformationFile() may return 0 for WriteQuotaAvailable.
As a workaround for this behavior, pipe_data_available() temporarily
attempts to change the pipe-mode to blocking. If the pipe contains
data, this operation fails-indicating that the pipe is full. If it
succeeds, the pipe is considered empty. The problem arises from the
assumption that the pipe is always in real blocking mode before
attempting to flip the mode. However, if raw_write() has already set
the pipe to non-blocking mode due to its failure to determine available
space, two issues occur:
1) Changing to non-blocking mode in pipe_data_available() always
succeeds, since the pipe is already in non-blocking mode.
2) After this, pipe_data_available() sets the pipe back to blocking
mode, unintentionally overriding the non-blocking state required
by raw_write().
This patch addresses the issue by having pipe_data_available() check
the current real blocking mode, temporarily flip the pipe-mode and
then restore the pipe-mode to its original state.
Addresses: https://github.com/git-for-windows/git/issues/5682#issuecomment-2997428207
Fixes: 7ed9adb356df ("Cygwin: pipe: Switch pipe mode to blocking mode by default")
Reported-by: Andrew Ng <andrew.ng@sony.com>
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
... rather than 1 when the pipe space estimation fails, so that
select() and raw_wrie() can perform appropriate fallback handling.
In select(), even if pipe space is unknown, return writable to avoid
deadlock. Even with select() returns writable, write() can blocked
anyway, if data is larger than pipe space. In raw_write(), if the
pipe is real non-blocking mode, attempting to write larger data than
pipe space is safe. Otherwise, return error.
For other cases than FH_PIPEW, PDA_UNKNOWN never orrurs. Therefore,
it is not necessary to handle it in that cases.
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
The commit "Cygwin: pipe: Fix SSH hang with non-cygwin pipe reader"
modifies how the amount of writable data is evaluated. This patch
updates the source comments to align with that change.
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
If ssh is used with non-cygwin pipe reader, ssh some times hangs.
This happens when non-cygwin git (Git for Windows) starts cygwin
ssh. The background of the bug is as follows.
Before attempting to NtWriteFile() in raw_write() in non-blocking
mode, the amount of writable space in the pipe is checked by calling
NtQueryInformationFile with FilePipeLocalInformation parameter.
The same is also done by pipe_data_available() in select.cc.
However, if the read side of the pipe is simultaneously consuming
data, NtQueryInformationFile() returns less value than the amount
of writable space, i.e. the amount of writable space minus the size
of buffer to be read. This does not happen when the reader is a
cygwin app because cygwin read() for the pipe attempts to read
the amount of the data in the pipe at most. This means NtReadFile()
never enters a pending state. However, if the reader is non-cygwin
app, this cannot be expected. As a workaround for this problem,
the code checking the pipe space temporarily attempts to toggle
the pipe-mode. If the pipe contains data, this operation fails
with STATUS_PIPE_BUSY indicating that the pipe is not empty. If
it succeeds, the pipe is considered empty. The current code uses
this technic only when NtQueryInformationFile() retuns zero.
Therefore, if NtQueryInformationFile() returns 1, the amount of
writable space is assumed to be 1 even in the case that e.g. the
pipe size is 8192 bytes and reader is pending to read 8191 bytes.
Even worse, the current code fails to write more than 1 byte
to 1 byte pipe space due to the remnant of the past design.
Then the reader waits for data with 8191 bytes buffer while the
writer continues to fail to write to 1 byte space of the pipe.
This is the cause of the deadlock.
In practice, when using Git for Windows in combination with Cygwin
SSH, it has been observed that a read of 8191 bytes is occasionally
issued against a pipe with 8192 bytes of available space.
With this patch, the blocking-mode-toggling-check is performed
even if NtQueryInformationFile() returns non-zero value so that
the amount of the writable space in the pipe is always estimated
correctly.
Addresses: https://github.com/git-for-windows/git/issues/5682
Fixes: 7ed9adb356df ("Cygwin: pipe: Switch pipe mode to blocking mode by default")
Reported-by: Vincent-Liem (@github), Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Addresses: https://cygwin.com/pipermail/cygwin/2025-June/258378.html
Fixes: 6ff28fc3b121 ("Allow CESU-8 surrogate value encoding")
Signed-off-by: Christian Franke <christian.franke@t-online.de>
|
|
This is required on Linux.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
The mechanism to convert characters invalid in DOS/Windows filenames
to the Unicode private use area starting at 0xf000 accidentally also
converts ASCII NUL to the private use area. That usually doesn't happen,
but what if the filename contains the 0xf000 character and we want to
convert it back to multibyte? In this case the 0xf000 becomes the ASCII
NUL again, and the resulting string is cut short and does not match with
the real filename. This leads to all sorts of problems like the
inability to unlink the file.
Fix this problem by not marking ASCII NUL as transposable character.
This problem has been introduced by adding code to support abstract
sockets which may contain a NUL char as part of the socket name. By
reverting the ASCII NUL in the transposition tables,
transform_chars_af_unix has to handle ASCII NUL explicitely now.
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Addresses: https://cygwin.com/pipermail/cygwin/2025-June/258367.html
Fixes: 7d260cfac42d ("Cygwin: add transform_chars_af_unix helper")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
When commit 28186e81d947 split _mbtowc_r into per-codeset functions, the
code generating wchar_t from UTF-8 input was slightly rearranged.
Unfortunately the new code introduced a bug:
On systems with wchar_t being UTF-16, 4 byte sequences have to be
converted to surrogate pairs. The low surrogate pair can be fully
created from the first 3 bytes of the sequence. However, the surrogates
should only be created if it's clear that the 4th byte is valid, and the
entire 4 byte string represents a valid UTF-8 sequence.
The code change in 28186e81d947 neglected just that: In contrast to the
original code, it now created the low surrogate after having read the
first 3 bytes of the sequence, without checking validity of the 4th byte.
This patch moves the test sequence to check the 4th byte in front of the
code generating the low surrogate. Make sure to return the value 3 (3
bytes digested) rather than the content of the local variable i, which
is already set to 4 at this point.
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Addresses: https://cygwin.com/pipermail/cygwin/2025-June/258358.html
Fixes: 28186e81d947 ("* libc/ctype/iswalpha.c: Handle all wchar_t as unicode on _MB_CAPABLE systems.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
After the commit f305ca916ad2, some stress-ng tests fail in arm64
windows. There seems to be two causes for this issue. One is that
calling SuspendThread(GetCurrentThread()) may suspend myself in
the kernel. Branching to sigdelayed in the kernel code does not
work as expected as the original _cygtls::interrup_now() intended.
The other cause is, single step exception sometimes does not trigger
exception::handle() for some reason. Therefore, register vectored
exception handler (VEH) and use it for single step exception instead.
Addresses: https://cygwin.com/pipermail/cygwin/2025-June/258332.html
Fixes: f305ca916ad2 ("Cygwin: signal: Prevent unexpected crash on frequent SIGSEGV")
Reported-by: Jeremy Drake <cygwin@jdrake.com>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Also test their interaction with addopen, as opens added subsequent to a
chdir need to be relative to that new cwd.
In order for the tests to compile on Linux, define O_SEARCH to O_PATH if
O_SEARCH is not defined, and use the *chdir_np names instead of the
now-standardized *chdir.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
|
This patch just follows the previous 5 patches changing newlib headers
for the matching symbols in Cygwin headers.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
Updated the guard for stdlib functions to use the POSIX Issue 8 guard
added in 2024.
|
|
Added prototype of ppoll() to
newlib/libc/sys/rtems/include/sys/poll.h
|
|
Added the prototype for sem_clockwait() to
newlib/libc/sys/rtems/include/semaphore.h
|
|
Updated the guard for pthread functions added in POSIX Issue 8
to use the POSIX Issue 8 guard added in 2024.
These functions are:
pthread_mutex_clocklock()
pthread_cond_clockwait()
pthread_rwlock_clockrdlock()
pthread_rwlock_clockwrlock()
|
|
Added timespec_get() prototype to libc/include/time.h
and removed the prototype from winsup/cygwin/include/cygwin/time.h
|
|
There are still more that could be tested, such as (f)chdir.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Test both that SIG_IGN and sigprocmask are inherited by default, and
that posix_spawnattr options can prevent this.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Given the limited binaries available (sh, ls, sleep), use sh -c true
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Currently just a couple of tests of error conditions, but I have more
tests to add.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
When running
CYGWIN=winsymlinks:nativestrict ln -s .. abc
the counter-intuitive result is _not_ a symbolic link to `..`, but
instead to `../../$(basename "$PWD")`.
The reason for this is that the search for the longest common prefix
assumes that the link target is not a strict prefix of the parent
directory of the link itself.
Let's fix that.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
|
Increase SYMLOOP_MAX limit to 63 per Win32 spec.
The spec at https://learn.microsoft.com/en-us/windows/win32/fileio/reparse-points
says:
... There is a limit of 63 reparse points on any given path.
NOTE: The limit can be reduced depending on the length of the
reparse point. For example, if your reparse point targets a fully
qualified path, the limit becomes 31. */
Signed-off-by: Sebastian Feld <sebastian.n.feld@gmail.com>
|
|
This patch adds AArch64-specific inline assembly block for the pthread
wrapper used to bootstrap new threads. It sets up the thread stack,
adjusts for __CYGTLS_PADSIZE__, releases the original stack via
VirtualFree, and invokes the target thread function.
Signed-off-by: Thirumalai Nagalingam <thirumalai.nagalingam@multicorewareinc.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
The define '_REENT_INIT' for the case '!_REENT_SMALL' was missing an initializing value for 'int _h_errno'.
If code uses the _REENT_INIT() macro to preset a variable of type struct _reent, this led to an issue when compiling with -Wmissing-field-initializers.
|
|
In order to avoid a restriction on any reinterpret_cast-like behavior in
constinit expressions, use assembly and the linker to define symbols
with the not-valid-address addresses.
Due to being built with -mcmodel=small, this linker trick does not
always work in the Cygwin DLL, specifically in the cases where they are
used in comparisons (==). As a result, leave the case where the
symbols would have had to have been classes rather than structs as casts
of integers. If Cygwin ever needs these to be constinit compliant, it
may need to move to the medium code model or add some other workaround.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|