By including sys/_stdint.h, all types from stdint.h are
exposed even if stdint.h isn't pulled in explicitely. Include
<machine/_default_types.h instead. Fix up newlib and Cygwin
files which rely on stdint.h types, too.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Even after fork, we might need the parent sigmask without having
access to the real _main_tls. There's a short time at process startup,
when _main_tls points to the system-allocated stack, but wait_sig is
already running. If we can't lock _main_tls, because find_tls can't
find it yet, we now access the parent's sigmask via child_info.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The x86_64 thread stack area collides with the share user data in
recent versions of Windows. Let's get ourselvels get out of the
way and move the thread stack area in the former slack space
between DLL area and heap, from 0x6:00000000 to 0x8:00000000.
That quadruplicates the stack area, so allow bigger maximum stack
sizes.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Originally the function was designed to be used in forked
processes as well, but it has never been used this way. Drop
the parameter only required for forkees.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
A recent patch fixed gmondump to stop printing "0x0x" as an address
prefix. It turns out the Cygwin User's Guide and the gmondump and
ssp man pages (all from utils.xml) have examples of the same error.
- In the latest GDB (11.2-1), Ctrl-C behaviour is broken a bit for
non-cygwin inferior. For example, Ctrl-C on GDB prompt is not sent
to GDB but to the inferior. This patch fixes the issue.
- The internal handles in HPCON should not be inheritable, however,
the current code duplicates them as inheritable when handing over
ownership of the pseudo console. This patch fixes the issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-April/251222.html
- Currently, close_pseudoconsole() is called unconditionally from
fhandler_termios::process_sigs() on Ctrl-C. This causes deadlock
if Ctrl-C is pressed while setup_pseudoconsole() is called. With
this patch, close_pseudoconsole() is called only if the master
process is the owner of the nat-pipe to avoid the deadlock.
- As mentioned in commit message of the commit b531d6b0, if multiple
writers including non-cygwin app exist, the non-cygwin app cannot
detect pipe closure on the read side when the pipe is created by
system account or the the pipe creator is running as service.
This is because query_hdl which is held in write side also is a
read end of the pipe, so the pipe is still alive for the non-cygwin
app even after the reader is closed.
To avoid this problem, this patch lets all processes in the same
process group close query_hdl using newly introduced internal signal
__SIGNONCYGCHLD when non-cygwin app is started.
Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251097.html
- Using memcmp() to compare structure such as INPUT_RECORD is not
correct manner because padding may not be initialized. This patch
stops to use memcmp() for comparison of INPUT_RECORD.
- dwControlKeyState also may be null'ed on WriteConsoleInputW().
Therefore ignore it in event comparison as well as wVirtualKeyCode
and wVirtualScanCode.
- The commit "Cygwin: console: Improve the code to avoid typeahead
key swapping." did not solve the problem enough. Two unexpected
things happen.
(1) wVirtualKeyCode and wVirtualScanCode of readback key event may
be null'ed even if they are not zero on WriteConsoleInputW().
Therefore, memcmp() may report the event sequence is not equal.
(2) WriteConsoleInputW() may not be atomic. The event sequence
which is written by WriteConsoleInputW() may be inserted by
key input in the middle of the sequence. Current code gives
up to fix in this situation.
This patch should fix that issue.
When using a compiler that automatically enables -D_FORTIFY_SOURCE,
building winsup fails with errors like below. Since winsup is not
setup to compile itself with _FORTIFY_SOURCE, disable it for now.
make[4]: Entering directory '.../x86_64-pc-cygwin/winsup/cygwin'
CC libc/minires-os-if.o
In file included from .../newlib/newlib/libc/include/ssp/strings.h:34,
from .../newlib/newlib/libc/include/strings.h:77,
from .../newlib/newlib/libc/include/string.h:24,
from ../../../../../winsup/cygwin/string.h:12,
from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154,
from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635,
from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163,
from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9,
from /usr/x86_64-pc-cygwin/usr/include/windows.h:69,
from ../../../../../winsup/cygwin/winlean.h:56,
from ../../../../../winsup/cygwin/winsup.h:84,
from ../../../../../winsup/cygwin/libc/minires-os-if.c:13:
.../newlib/winsup/cygwin/include/ssp/socket.h:9:1: error: conflicting types for 'recv';
have 'ssize_t(int, void *, size_t, int)' {aka 'long int(int, void *, long unsigned int, int)'}
9 | __ssp_redirect0(ssize_t, recv, \
| ^~~~~~~~~~~~~~~
In file included from /usr/x86_64-pc-cygwin/usr/include/w32api/ws2tcpip.h:17,
from ../../../../../winsup/cygwin/libc/minires-os-if.c:14:
/usr/x86_64-pc-cygwin/usr/include/w32api/winsock2.h:1022:34: note: previous declaration of 'recv' with
type 'int(SOCKET, char *, int, int)' {aka 'int(long long unsigned int, char *, int, int)'}
1022 | WINSOCK_API_LINKAGE int WSAAPI recv(SOCKET s,char *buf,int len,int flags);
| ^~~~
In file included from .../newlib/newlib/libc/include/ssp/strings.h:34,
from .../newlib/newlib/libc/include/strings.h:77,
from .../newlib/newlib/libc/include/string.h:24,
from ../../../../../winsup/cygwin/string.h:12,
from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154,
from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635,
from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163,
from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9,
from /usr/x86_64-pc-cygwin/usr/include/windows.h:69,
from ../../../../../winsup/cygwin/winlean.h:56,
from ../../../../../winsup/cygwin/winsup.h:84,
from ../../../../../winsup/cygwin/libc/minires-os-if.c:13:
.../newlib/winsup/cygwin/include/ssp/socket.h:13:1: error: conflicting types for 'recvfrom';
have 'ssize_t(int, void *, size_t, int, struct sockaddr *, socklen_t *)' {aka 'long int(int, void *, long unsigned int, int, struct sockaddr *, int *)'}
13 | __ssp_redirect0(ssize_t, recvfrom, \
| ^~~~~~~~~~~~~~~
In file included from /usr/x86_64-pc-cygwin/usr/include/w32api/ws2tcpip.h:17,
from ../../../../../winsup/cygwin/libc/minires-os-if.c:14:
/usr/x86_64-pc-cygwin/usr/include/w32api/winsock2.h:1023:34: note: previous declaration of 'recvfrom' with
type 'int(SOCKET, char *, int, int, struct sockaddr *, int *)' {aka 'int(long long unsigned int, char *, int, int, struct sockaddr *, int *)'}
1023 | WINSOCK_API_LINKAGE int WSAAPI recvfrom(SOCKET s,char *buf,int len,int flags,struct sockaddr *from,int *fromlen);
| ^~~~~~~~
make[4]: *** [Makefile:1930: libc/minires-os-if.o] Error 1
CC gmon.o
../../../../../winsup/cygwin/gmon.c:60: error: "bzero" redefined [-Werror]
60 | #define bzero(ptr,size) memset (ptr, 0, size);
|
In file included from .../newlib/newlib/libc/include/strings.h:77,
from .../newlib/newlib/libc/include/string.h:24,
from ../../../../../winsup/cygwin/string.h:12,
from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154,
from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635,
from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163,
from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9,
from /usr/x86_64-pc-cygwin/usr/include/windows.h:69,
from ../../../../../winsup/cygwin/winlean.h:56,
from ../../../../../winsup/cygwin/winsup.h:84,
from ../../../../../winsup/cygwin/gmon.h:69,
from ../../../../../winsup/cygwin/gmon.c:47:
.../newlib/newlib/libc/include/ssp/strings.h:43: note: this is the location of the previous definition
43 | #define bzero(dst, len) \
|
cc1: all warnings being treated as errors
Convert all the libc/ subdir makes into the top-level Makefile. This
allows us to build all of libc from the top Makefile without using any
recursive make calls. This is faster and avoids the funky lib.a logic
where we unpack subdir archives to repack into a single libc.a. The
machine override logic is maintained though by way of Makefile include
ordering, and source file accumulation in libc_a_SOURCES.
There's a few dummy.c files that are no longer necessary since we aren't
doing the lib.a accumulating, so punt them.
The winsup code has been pulling the internal newlib ssp library out,
but that doesn't exist anymore, so change that to pull the objects.
- If UNC path for DFS is mounted to a drive with drive letter, the
error "Too many levels of symbolic links" occurs when accessing
to that drive. This is because GetDosDeviceW() returns unexpected
string such as "\Device\Mup\DfsClient\;Z:000000000003fb89\dfsserver
\dfs\linkname" for the mounted UNC path "\??\UNC\fileserver\share".
This patch adds a workaround for this issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-March/250979.html
- After the commit "Cygwin: pty, console: Fix handle leak which
occurs on exec() error.", startxwin cannot start X due to the
error "Failed to activate virtual core keyboard: 2". The problem
is access violation in the code retrieving the pgid of the ctty.
This patch fixes the issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251013.html
- Currently, tty::pcon_start flag is cleared before transfer_input()
in master::write(), however, the code in setup_pseudoconsole()
waits for transfer_input() using tty::pcon_start. This possibly
causes the race issue. The patch fixes this potential issue.
- This patch removes the old code which calls transfer_input() but
is no longer needed. These code was necessary indeed in the past,
however, as a result of recent frequent code changes, it is no
longer needed.
- Previously, reset_switch_to_nat_pipe() is called from many places
in pty code. This patch reorganizes that. With this patch, it is
called only from bg_check() and setpgid_aux(). The calls which
does not have enough reason have been omitted.
- To make read() work properly in canonical mode, writing to the pty
pipe should be done line by line. However, only CR was treated as
line separator previously in transfer_input(). This patch fixes
the issue.
- Previously, the PID_NEW_PG flag was also used as a marker for GDB
with non-cygwin inferior, unlike its original meaning. With this
patch, the condition exec_dwProcessId == dwProcessId is used as a
marker for that instead.
glibc getconf doesn't print "undefined" for undefined values
in -a output. It just prints the empty string. Do it the
same way.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
We return -1 with errno set to EINVAL for sysconf options for
values required by POSIX, but not implemented on Cygwin.
This is incorrect. Return -1, but don't set errno for these options.
Drop the "nsup" enum to indicate unsupported values, it's not
required anymore.
Fixes: 59e3b6ca7d (CVS import)
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
When adding the timer_getoverrun function, DELAYTIMER_MAX was added
to limits.h, but the return value of sysconf(_SC_DELAYTIMER_MAX) wasn't
changed accordingly. Fix that now.
Fixes: 9e295a8d19 ("Cygwin: posix timers: implement timer_getoverrun")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- transfer_input() function uses console api, so it should be guarded
by attach_mutex. However, in most cases, it is missing. This patch
fixes the issue.
- This patch communalizes the code for attaching another console
temporarily and resuming to the original attach state, because
there were a plurality of similar codes throughout.
- This patch revises the acquiring/releasing timing for attach_mutex
to make the period in which it is being acquired shorter. Further,
acquiring/releasing are added to where they are missing but needed.
- In fhandler_console::cons_master_thread(), a struct which has
only a static function is used. In this case, struct instance
is not necessary. So with this patch, the static function is
invoked without creating instance.
So far the values of SigPnd and SigBlk were always 0 and SigIgn
was incorrectly set to the block mask of the current thread of
the calling process.
Fix that by adding a _pinfo::siginfo method and a PICOM_SIGINFO
message to allow to request actual signal info of any running process.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The "how" value only makes sense if a new set is given. If we
only read the current signal set, ignore the value of "how" per
POSIX:
"If set is a null pointer, the value of the argument how is not
significant"
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- With this patch, some pty functions/variables have been renamed
so that the name *pcon* is not used for those that are called
even when the pseudo console is not active.
- When Ctrl-C terminates a non-cygwin process on a pseudo console,
pty master attaches to the pseudo console first, and send
CTRL_C_EVENT. If the non-cygwin process closes the pseudo console
before the pty master calls FreeConsole(), the pty master process
will crash. With this patch, pty master process takes over the
ownership of the pseudo console, and closes it by myself.
- With this patch, unique invisible consoles are created for each pty
to isolate CTRL_C_EVENTs between ptys. This is necessary by Ctrl-C
handling in fhandler_termios::process_sigs() for non-cygwin apps
started in pty if the pseudo console is disabled.
- The commit "Cygwin: console: Prevent the order of typeahead input
from swapped." did not fully resolve the issue. If keys are typed
during input buffer fix, the order of key event may be swapped.
This patch fixes the issue again.
- The recent commit "Cygwin: pinfo: Fix exit code when non-cygwin app
exits by Ctrl-C." did not fix enough the issue. If a non-cygwin app
is reading the console, it will not return STATUS_CONTROL_C_EXIT
even if it is terminated by Ctrl-C. As a result, the previous patch
does not take effect.
This patch solves this issue by setting sigExeced to SIGINT in
ctrl_c_handler(). In addition, sigExeced will be cleared if the app
does not terminated within predetermined time period. The reason is
that the app does not seem to be terminated by the signal sigExeced.
- The commit "Cygwin: console: Fix issues of apps which open pty."
did not fix the second problem correctly. That commit looked to
fix the issue, but the actual problem was that ctrl_c_handler()
should be reregistered *AFTER* FreeConsole()/AttachConsole().
This patch correct that.
- The commit "Cygwin: console: Restore CTRL_BREAK_EVENT handling."
was accidentally mixed with experimental code in exceptions.cc.
Due to this, non-cygwin app receives CTRL_C_EVENT twice in the
following scenario.
1) Run 'sleep 10 | <non-cygwin app>'
2) Hit Ctrl-C.
3) The non-cygwin app receives CTRL_C_EVENT twice.
This patch reverts the code with the problem.
- If a lot of keys are typed very quickly in the app which does
not read console, the order of input keys in console input buffer
occasionally swapped. Although this extremely rarely happens,
is obviously a bug of cons_master_thread. This patch fixes the
issue.
- The commit "Cygwin: console: Redesign handling of special keys."
removes special treatment for pty in with pseudo console activated,
however, it is necessary on second thought. This is because sending
CTRL_C_EVENT to non-cygwin apps will be done in pseudo console,
therefore, sending it in fhandler_pty_master::write() duplicates
that event for non-cygwin apps.
- After some recent changes for special keys handling break the
apps which open pty (such as script command). If the app which
opens pty is executed in console, the following issues occur.
1) If the script command was started from non-cygwin shell
(such as cmd.exe), another cygwin app started in pty slave
cannot receive Ctrl-C.
2) If non-cygwin app is executed in pty slave, the app which
opened the pty (e.g. script command) crashes by Ctrl-C.
This patch fixes these issues.
- Previously, if non-cygwin app exits by Ctrl-C, exit code was
0x00007f00. With this patch, the exit code will be 0x00000002,
which means process exited by SIGINT.
- The recent change by the commit "Cygwin: console: Redesign handling
of special keys." breaks the handling of CTRL_BREAK_EVENT. The login
shell in console exits on Ctrl-Break key. This patch fixes the issue.
- The inferior of the GDB cannot be continued after SIGINT even
though nopass option is set. This seems because cygwin GDB does
not support hooking cygwin signal. Therefore, a workaround for
GDB is added. With this patch, only CTRL_C_EVENT is sent to the
GDB inferior by Ctrl-C and sending SIGINT is omitted. Note that
"handle SIGINT (no)pass" command does not take effect even with
or without this patch.
- This patch rearranges the cooperation between cons_master_thread,
line_edit, and ctrl_c_handler so that only one of them operates
at the same time. Since these handle Ctrl-C individually, so the
signal may be sent multiple times to the process. This patch fixes
the issue.
Bash has a very convenient feature that is called process substitution
(e.g. `diff -u <(seq 0 10) <(seq 1 11)`). To make this work, Bash
requires the `/dev/fd` symlink to exist, and Cygwin therefore creates
this symlink (together with the `stdin`, `stdout` and `stderr` ones)
upon start-up.
This strategy is incompatible with the idea of providing a subset of
Cygwin in a `.zip` file (because there is no standard way to represent
symlinks in `.zip` files, and besides, older Windows versions would
potentially lack support for them anyway).
That type of `.zip` file is what Git for Windows wants to use, though,
bundling a minimal subset for third-party applications in MinGit (see
https://github.com/git-for-windows/git/wiki/MinGit for details).
Let's side-step this problem completely by creating those symlinks
implicitly, similar to the way `/dev/` is populated with special
devices.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Remove dependency on __sdidinit member of struct _reent to check
object initialization. Like __sdidinit, the __cleanup member of
struct _reent is initialized in the __sinit() function. Checking
initialization against __cleanup serves the same purpose and will
reduce overhead in the __sfp() function in a follow up patch.
- This patch fixes the handle leak which occurs when exec() fails
with an error. The duplicated handles will be closed when the
exec'ed process is terminated. However, if exec() fails, the code
path does not reach to the code closing the duplicated handles.
To implement this fix more appropriately, the setup, cleanup and
closing pty codes which was previously located in spawn.cc are
encapsulated into the fhandler_pty_slave class functions.
- Calling fix_tab_position() is necessary in Windows 10 with xterm
compatible mode enabled, because it has a problem that the tab
positions will be broken when the window size is changed. Fortunately,
this problem has been fixed in Windows 11. Therefore, with this patch,
necessity of fix_tab_position() call is determined by referring to
wincap.has_con_broken_tabs(), which is recently introduced.
- With this patch, all set_(in|out)put_mode() calls are rearranged
as follows.
1) Setup for cygwin apps, started from non-cygwin app, is done
in fhandler_console::post_open_setup(), which overrides
fhandler_base::post_open_setup() called from dtable.cc.
2) Cleanup for cygwin app is done in fhandler_console::close().
3) Setup for cygwin apps is also in fhandler_console::bg_check(),
which overrides fhandler_termios::bg_check(). This is called
on read(), write() and select() for console. It is necessary
if cygwin and non-cygwin apps are started simultaneously in
the same process group.
4) Setup for non-cygwin apps is done in spawn.cc via
fhandler_console::setup_console_for_non_cygwin_app().
5) Cleanup for non-cygwin app is done in spawn.cc vid
fhandler_console::cleanup_console_for_non_cygwin_app().
6) Setup for non-cygwin app started by GDB is done in
fhandler_console::set_console_mode_to_native().
7) No explicit cleanup for non-cygwin app started by GDB, because
console mode is automatically reset to tty::cygwin on read()/
write() in GDB thanks to 3).
- This patch commonize the code which processes special keys in pty
and console to improve maintanancibility. As a result, some small
bugs have been fixed.
- The capability changes since Windows 11 have been reflected in
wincap.cc. The capability has_con_broken_tabs is added, which is
false since Windows 11.
- When non-cygwin app is started in console, console mode is set to
tty::native. However, if stdin is redirected, current code does not
set the input mode of the console. In this case, if the app opens
"CONIN$", the console mode will not be appropriate for non-cygwin
app. This patch fixes the issue.
Addresses:
https://github.com/GitCredentialManager/git-credential-manager/issues/576
- Currently, there is no chance to change console mode for non-cygwin
inferior of GDB. With this patch, the console mode is changed to
tty::native in CreateProcess() and ContinueDebugEvent() hooked in
fhandler_console.
- In tty_min::setpgid(), a pointer to fhandler instance is casted to
fhandler_pty_slave and accessed even if terminal is not a pty slave.
This patch fixes the issue.
- Currently, pty discards input only in from_master pipe on signal.
Due to this, if pty is started without pseudo console support and
start a non-cygwin process from cmd.exe, type adhead input is not
discarded on signals such as Ctrl-C. This patch fixes the issue.
- With this patch, the code to wait for completion of forwarding of
output from non-cygwin app is revised so that it can more reliably
detect the completion.
- If the slave process writes a lot of text output, doecho() can
cause deadlock. This is because output_mutex is held in slave::
write() and if WriteFile() is blocked due to pipe full, doecho()
tries to acquire output_mutex and gets into deadlock. With this
patch, the deadlock is prevented on the sacrifice of atomicity
of doecho().
- Previously, non-cygwin app running in pty started without pseudo
console support was suspended by Ctrl-Z rather than sending EOF.
Even worse, suspended app could not be resumed by fg command. With
this patch, Ctrl-Z (EOF for non-cygwin apps) is passed to non-cygwin
app instead of suspending that app. This patch also handles Ctrl-\
(QUIT) and Ctrl-D (EOF) as well.
- Currently, if cat is started from cmd.exe which is started in cygwin
console, Ctrl-C terminates not only cat but also cmd.exe. This also
happens in pty in which pseudo console is disabled. This patch fixes
the issue.
- Currently, ENABLE_INSERT_MODE and ENABLE_QUICK_EDIT_MODE are cleared
if cygwin is started in console. These flags will not be recovered
even when exiting from cygwin. Also note that if ENABLE_EXTENDED_FLAGS
is once unset, then the flag ENABLE_QUICK_EDIT_MODE it's associated
with will no longer be preserved. Unfortunately, we're accidentally
stepping on this in fhandler_console::set_input_mode().
This patch solves this by carrying forward these flags in the place
where it had been ignoring them. Since the previous behaviour of
leaving these flags unset would essentially maintain their existing
state, adding the carry-over of the flags now should not alter console
behaviour.
On second thought, we don't actually need this script.
Express the entire action as sufficiently simple Makefile rule.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- formatting
- use array pointer as argument rather than variable arguments
- syntactical fixes
- add comments
- drop unnecessary recomputation of all section VMAs.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
In Makefile.am, add the value of $(V) to the dllfixdbg call.
In dllfixdbg, if V=1, print what the script is doing.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Change dllfixdbg to keep the input DLL intact and just generate
a new DLL matching the debug file. Fix Makefile rule accordingly.
The result is, cygwin0.dll is the original DLL created with full
debug sections and stays that way throughout the build process.
Only new-cygwin1.dll will become the stripped DLL matching with
the file containing the debug sections cygwin1.dbg. This is ok,
because commit ba02fef995 ("Cygwin: Makefile.am: fix DLL build rule")
made new-cygwin1.dll the DLL to be installed.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- If an UNC path is mounted to a drive using SMB3.11, accessing to
the drive fails with error "Too many levels of symbolic links."
This patch fixes the issue.
A single Makefile rule creates three files in three steps, the second
and third one never showing up in dependencies. The next step creating
the link lib only depends on the first of these files. Even if the
second or third step in the DLL build rule fails, the next make
invocation never picks up on this and just goes ahead creating the
link lib.
Fix this by splitting the DLL build rule into three rules, with
every step on the way depending on the previous rule. Also fix up
the names, TEST_DLL_NAME just doesn't cut it.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This reverts commit 0390cc8572.
There's no indication what exact situation this patch was supposed to
solve, and local testing doesn't show any such problems. However, this
patch itself introduced a new problem, as outlined by
https://cygwin.com/pipermail/cygwin/2022-January/250629.html
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Commit a2bfe7cae6 introduced a change ignoring default ACEs on files
to come up with a valid POSIX ACL, reflecting the Windows ACEs actually
making sense on files.
However, if CREATOR OWNER or CREATOR GROUP ACEs - both only making sense
as default ACEs - are found in the ACL, a value indicating the presence
of default ACEs gets set, even on files. This in turn breaks a
subsequent integrity check and get_posix_access returns EINVAL.
The code path handling default ACEs on directories sets this indicator
anyway, so don't set it just because one of the above SIDs are found.
Fixes: a2bfe7cae6 ("Cygwin: ACLs: ignore *_INHERIT flags in file ACLs")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Unless make is invoked with V=1, have xmlto pass the parameter
'man.output.quietly=1' to xsltproc to suppress "Note: Writing foo.N"
output from the manpages stylesheet.
Unless make is invoked with V=1, have xmlto pass the parameter
'chunk.quietly=1' to xsltproc to suppress "Writing foo.html for
sect1(foo)" output from the chunker.xsl stylesheet.
Unless make is invoked with V=1, have xmlto pass '-q' to dblatex when
building PDFs, to supress repeated "default template used in
programlisting or screen" warnings from dblatex's verbatim.xsl
stylesheet.
In case when the native OS resolver is used (via os_query) the returned
response ID is always 0. It should actually match the ID passed in to
res_send() in the DNS request header. This patch fixes that
- Make sure the answer buffer is properly cleared so there is no trailing
garbage when the response does not fit entirely in;
- Make sure an internal decomp failure gets reported correctly (w/return code -1);
- Make sure that the buffer is not overrun when filling out the header.
When trying to create a directory called `xyz` in the presence of a
directory `xyz.lnk`, the Cygwin runtime errors out with an `ENOENT`.
The root cause is actually a bit deeper: the `symlink_info::check()`
method tries to figure out whether the given path refers to a symbolic
link as emulated via `.lnk` files, but since it is a directory, that is
not the case, and that hypothesis is rejected.
However, the `fileattr` field is not cleared, so that a later
`.exists()` call on the instance mistakenly thinks that the symlink
actually exists. Let's clear that field.
This fixes https://github.com/msys2/msys2-runtime/issues/81
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
AAAA records returned from Windows resolver were flagged as "No
structure" in debug output because of being processed (although
correctly) in the default catch-all case. This patch makes the AAAA
records properly recognized.
- If the from_master is closed before cleaning up other pipes, such
as from_slave_nat, the same pty may be allocated and pty master may
try to open the pipe which is not closed yet, and it will fail.
This patch fixes the issue.
- Closing attach_mutex and recreating it causes the race issue
between pty and console codes. With this patch, attach_mutex
is created only once in a process which opens pty, and never
closed in order to avoid this issue.
Addresses:
https://cygwin.com/pipermail/cygwin-developers/2021-December/012548.html
- If master_fwd_thread is terminated by cygthread::terminate_thread(),
the opportunity to release tmp_pathbuf is missed, resulting in a
memory leak. This patch fixes the issue.
- 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
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.
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>
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>
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>
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
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'.
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.)
- 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.
- 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.