Corinna Vinschen [Wed, 24 Mar 2021 09:58:56 +0000 (10:58 +0100)]
fenv: drop Cygwin-specific implementation in favor of newlib code
Drop the Cygwin-specific fenv.cc and fenv.h file and use the equivalent
newlib functionality now, so we have at least one example of a user for
this new mechanism.
fenv.c: allow _feinitialise to be called from Cygwin startup code
fenv.h: add declarations for fegetprec and fesetprec for Cygwin only.
Fix a comment.
Corinna Vinschen [Wed, 24 Mar 2021 09:32:50 +0000 (10:32 +0100)]
Add build mechanism to share common header files between machines
So far the build mechanism in newlib only allowed to either define
machine-specific headers, or headers shared between all machines.
In some cases, architectures are sufficiently alike to share header
files between them, but not with other architectures. A good example
is ix86 vs. x86_64, which share certain traits with each other, but
not with other architectures.
Introduce a new configure variable called "shared_machine_dir". This
dir can then be used for headers shared between architectures.
Kito Cheng [Tue, 13 Apr 2021 09:33:03 +0000 (17:33 +0800)]
RISC-V: Using SYS_clock_gettime64 for rv32 libgloss.
- RISC-V 32 bits linux/glibc didn't provide gettimeofday anymore
after upstream, because RV32 didn't have backward compatible issue,
so RV32 only support 64 bits time related system call.
- So using clock_gettime64 call instead for rv32 libgloss.
An FD_CLOSE event sets a socket descriptor ready for writing.
This is incorrect if the FD_CLOSE is a result of shutdown(SHUT_RD).
Only set the socket descriptor ready for writing if the FD_CLOSE
is indicating an connection abort or reset error condition.
This requires to tweak fhandler_socket_wsock::evaluate_events.
FD_CLOSE in conjunction with FD_ACCEPT/FD_CONNECT special cases
a shutdown condition by setting an error code. This is correct
for accept/connect, but not for select. In this case, make sure
to return with an error code only if FD_CLOSE indicates a
connection error.
Cygwin: select: don't set ready for exception on socket shutdown
So far select wrongly sets the descriptor as ready for exception
when a shutdown occurs. This is entirely non-standard. Only set
this bit on an out-of-band event.
Cygwin: fhandler: Rename handles from XXX_cyg/XXX to XXX/XXX_nat.
- Currently, functions/variables regarding the handles for cygwin
apps are with "_cyg", and those of handles for non-cygwin apps
are without "_cyg", such as get_handle_cyg() and get_handle().
This patch renames these to the names without "_nat" and with
"_nat" respectively, such as get_handle() and get_handle_nat().
Cygwin: Treat Windows Store's "app execution aliases" as symbolic links
When the Windows Store version of Python is installed, so-called "app
execution aliases" are put into the `PATH`. These are reparse points
under the hood, with an undocumented format.
We do know a bit about this format, though, as per the excellent analysis:
https://www.tiraniddo.dev/2019/09/overview-of-windows-execution-aliases.html
The first 4 bytes is the reparse tag, in this case it's
0x8000001B which is documented in the Windows SDK as
IO_REPARSE_TAG_APPEXECLINK. Unfortunately there doesn't seem to
be a corresponding structure, but with a bit of reverse
engineering we can work out the format is as follows:
Cygwin: Allow executing Windows Store's "app execution aliases"
The Windows Store version of Python (and apparently other Windows Store
applications) install a special reparse point called "app execution
alias" into the user's `PATH`.
These applications can be executed without any problem, but they cannot
be read as if they were files. This trips up Cygwin's beautiful logic that
tries to determine whether we're about to execute a Cygwin executable or
not: instead of executing the application, it will fail, saying
"Permission denied".
Let's detect this situation (`NtOpenFile()` helpfully says that this
operation is not supported on this reparse point type), and simply skip
the logic: Windows Store apps are not Cygwin executables (and even if
they were, it is unlikely that they would come with a compatible
`cygwin1.dll` or `msys-2.0.dll`).
This fixes https://github.com/msys2/MSYS2-packages/issues/1943
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Currently, names of output pipes are "pty%d-to-master" and "pty%d-
to-master-cyg" and names of input pipes are "pty%d-to-slave" and
"pty%d-from-master". With this patch, these pipes are renamed to
"pty%d-to-master-nat", "pty%d-to-master", "pty%d-from-master-nat"
and "pty%d-from-master" respectively.
Cygwin: pty: Transfer input for native app only if the stdin is pcon.
- Currently, transfer input is triggered even if the stdin of native
app is not a pseudo console. With this patch it is triggered only
if the stdin is a pseudo console.
Cygwin: pty: Attach to stub process when non-cygwin app inherits pcon.
- If two non-cygwin apps are started simultaneously, attaching to
pseudo console sometimes fails. This is because the second app
trys to attach to the process not started yet. This patch avoids
the issue by attaching to the stub process rather than the other
non-cygwin app.
Cygwin: console, pty: Stop ignoring Ctrl-C by IGNBRK.
- Perhaps current code misunderstand meaning of the IGNBRK. As far
as I investigated, IGNBRK is concerned with break signal in serial
port but there is no evidence that it has effect to ignore Ctrl-C.
This patch stops ignoring Ctrl-C by IGNBRK for non-cygwin apps.
It turned out that this patch has undesired side effects. To wit, if a
newer, post-uname_x executable was linked against or loading an older,
pre-uname_x DLL, and this DLL called uname. This call would jump into
the old uname with the old struct utsname as parameter, but given the
newer executable it would get redirected to uname_x. uname_x in turn
would overwrite stack memory it should leave well alone, given it
expects the newer, larger struct utsname.
For the entire discussion see the thread starting at
https://cygwin.com/pipermail/cygwin/2021-February/247870.html
and continuing in March at
https://cygwin.com/pipermail/cygwin/2021-March/247930.html
For a description where we're coming from, see
https://cygwin.com/pipermail/cygwin/2021-March/247959.html
While we *could* make the scenario in question work by patching dlsym,
the problem would actually be the same, just for dynamic loading. In
the end, we're missing the information, which Cygwin version has been
used when building DLLs.
Cygwin: pty: Fix a race issue in startup of pseudo console.
- If two non-cygwin apps are started simultaneously and this is the
first execution of non-cygwin apps in the pty, these occasionally
hang up. The cause is the race issue between term_has_pcon_cap(),
reset_switch_to_pcon() and setup_pseudoconsole(). This patch fixes
the issue.
Ken Brown [Thu, 25 Feb 2021 12:54:10 +0000 (07:54 -0500)]
Cygwin: simplify linkat with AT_EMPTY_PATH
linkat(olddirfd, oldpath, oldname, newdirfd, newname, AT_EMPTY_PATH)
is supposed to create a link to the file referenced by olddirfd if
oldname is the empty string. Currently this is done via the /proc
filesystem by converting the call to
Ken Brown [Wed, 24 Feb 2021 15:43:15 +0000 (10:43 -0500)]
Cygwin: fix linkat(2) on sockets that are not socket files
If linkat(2) is called with AT_EMPTY_PATH on an AF_LOCAL or
AF_UNIX socket that is not a socket file, the current code calls
fhandler_disk_file::link in most cases. The latter expects to be
operating on a disk file and uses the socket's io_handle, which
is not a file handle.
Fix this by calling fhandler_disk_file::link only if the
fhandler_socket object is a file (determined by testing
dev().isfs()).
Also fix the case of a socket file opened with O_PATH by setting
the fhandler_disk_file's io_handle.
Ken Brown [Mon, 22 Feb 2021 15:13:09 +0000 (10:13 -0500)]
Cygwin: fix facl on sockets that are not socket files
If facl(2) is called on an AF_LOCAL or AF_UNIX socket that is not a
socket file, the current code calls fhandler_disk_file::facl in most
cases. The latter expects to be operating on a disk file and uses the
socket's io_handle, which is not a file handle.
Fix this by calling fhandler_disk_file::facl only if the
fhandler_socket object is a file (determined by testing dev().isfs()).
Ken Brown [Mon, 22 Feb 2021 14:50:34 +0000 (09:50 -0500)]
Cygwin: fix fchown on sockets that are not socket files
If fchown(2) is called on an AF_LOCAL or AF_UNIX socket that is not a
socket file, the current code calls fhandler_disk_file::fchown in most
cases. The latter expects to be operating on a disk file and uses the
socket's io_handle, which is not a file handle.
Fix this by calling fhandler_disk_file::fchown only if the
fhandler_socket object is a file (determined by testing dev().isfs()).
Ken Brown [Mon, 22 Feb 2021 14:34:36 +0000 (09:34 -0500)]
Cygwin: fix fchmod on sockets that are not socket files
If fchmod(2) is called on an AF_LOCAL or AF_UNIX socket that is not a
socket file, the current code calls fhandler_disk_file::fchmod in most
cases. The latter expects to be operating on a disk file and uses the
socket's io_handle, which is not a file handle.
Fix this by calling fhandler_disk_file::fchmod only if the
fhandler_socket object is a file (determined by testing dev().isfs()).
Ken Brown [Mon, 22 Feb 2021 14:21:00 +0000 (09:21 -0500)]
Cygwin: fix fstatvfs on sockets that are not socket files
If fstatvfs(2) is called on an AF_LOCAL or AF_UNIX socket that is not
a socket file, the current code calls fhandler_disk_file::fstatvfs in
most cases. The latter expects to be operating on a disk file and
uses the socket's io_handle, which is not a file handle.
Fix this by calling fhandler_disk_file::fstatvfs only if the
fhandler_socket object is a socket file (determined by testing
dev().isfs()).
Ken Brown [Mon, 22 Feb 2021 14:08:04 +0000 (09:08 -0500)]
Cygwin: fix fstat on sockets that are not socket files
If fstat(2) is called on an AF_LOCAL or AF_UNIX socket that is not a
socket file, the current code calls fstat_fs. The latter expects to
be operating on a disk file and uses the socket's io_handle, which is
not a file handle.
Fix this by calling fstat_fs only if the fhandler_socket object is a
file (determined by testing dev().isfs()).
Ken Brown [Tue, 23 Feb 2021 22:07:00 +0000 (17:07 -0500)]
Cygwin: facl: fail with EBADF on files opened with O_PATH
This is in the spirit of the Linux requirement that file operations
like fchmod(2), fchown(2), and fgetxattr(2) fail with EBADF on files
opened with O_PATH.
Ken Brown [Tue, 23 Feb 2021 16:48:46 +0000 (11:48 -0500)]
Cygwin: AF_UNIX: allow opening with the O_PATH flag
This was done for the fhandler_socket_local class in commits 3a2191653a, 141437d374, and 477121317d, but the fhandler_socket_unix
class was overlooked.
Kito Cheng [Tue, 23 Feb 2021 08:14:36 +0000 (16:14 +0800)]
Bump config.guess and config.sub
Hi:
RISC-V has added big-endian support recently, which require config.*
stuff update, and we'll send further patch for fix big-endian build,
so I believe this fundamental change should upstream first.
Cygwin: pty: Fix segfault caused when tcflush() is called.
- After commit 253352e796ff9ec9a447e5375f5bc3e2b92b5293, mc (midnight
commander) crashes with segfault if the shell is bash. This is due
to NULL pointer access in read(). This patch fixes the issue.
Addresses::
https://cygwin.com/pipermail/cygwin/2021-February/247870.html
Ken Brown [Tue, 9 Feb 2021 17:11:02 +0000 (12:11 -0500)]
Cygwin: FIFO: temporarily keep a conv_handle in syscalls.cc:open
When a FIFO is opened, syscalls.cc:open always calls fstat on the
newly-created fhandler_fifo. This results from a call to
device_access_denied.
To speed-up this fstat call, and therefore the open(2) call, use
PC_KEEP_HANDLE when the fhandler is created. The resulting
conv_handle is retained until after the fstat call if the fhandler is
a FIFO; otherwise, it is closed immediately.
Ken Brown [Thu, 11 Feb 2021 02:15:20 +0000 (21:15 -0500)]
Cygwin: fstat_helper: always use handle in call to get_file_attribute
Previously, the call to get_file_attribute for FIFOs set the first
argument to NULL instead of the handle h returned by get_stat_handle,
thereby forcing the file to be opened for fetching the security
descriptor in get_file_sd(). This was done because h might have been
a pipe handle rather than a file handle, and its permissions would not
necessarily reflect those of the file.
That situation can no longer occur with the new fhandler_fifo::fstat
introduced in the previous commit.
Ken Brown [Thu, 18 Feb 2021 15:18:41 +0000 (10:18 -0500)]
Cygwin: define fhandler_fifo::fstat
Previously fstat on a FIFO would call fhandler_base::fstat.
The latter is not appropriate if fhandler_fifo::open has already been
called (and O_PATH is not set), for the following reason. If a FIFO
has been opened as a writer or duplexer, then it has an io_handle that
is a pipe handle rather than a file handle. fhandler_base::fstat will
use this handle and potentially return incorrect results. If the FIFO
has been opened as a reader, then it has no io_handle, and a call to
fhandler_base::fstat will lead to a call to fhandler_base::open.
Opening the fhandler a second time can change it in undesired ways;
for example, it can modify the flags and status_flags.
The new fhandler_fifo::fstat avoids these problems by creating an
fhandler_disk_file and calling its fstat method in case
fhandler_fifo::open has already been called and O_PATH is not set.
This scenario circumventing the mount point handling which is automated
in terms of /, depending on the path returned from GetModuleFileNameW
for the Cygwin DLL. When calling D:\cygwin64\bin\bash the dir returned
from GetModuleFileNameW is D:\cygwin64\bin, thus root is D:\cygwin64.
However, junctions are treated as symlinks in Cygwin which explains why
the path gets converted to a cygdrive path.
Fix this by calling GetFinalPathNameByHandleW on the result from
GetModuleFileNameW to get the correct root path, even if accessed via
a junction point.
Corinna Vinschen [Fri, 19 Feb 2021 17:12:37 +0000 (18:12 +0100)]
Cygwin: default to O_BINARY in fhandler_base::reset_to_open_binmode()
This only affects the very seldom bordercase of apps calling setmode(fd,
0) on fhandlers not calling fhandler_base::set_open_status(). All
fhandlers not calling set_open_status() are binary mode only, but the
way reset_to_open_binmode worked, calling setmode(fd, 0) would have
"reset" their open flags to O_TEXT accidentally.
- If ENABLE_LINE_INPUT is set, Ctrl-S is handled by Windows if the
OS is Windows 7. This conflicts with Ctrl-S handling in cygwin
console code. This patch unsets ENABLE_LINE_INPUT flag in cygwin
and set it when native app is executed.
- If ENABLE_VIRTUAL_TERMINAL_INPUT is not set, changing window height
does not generate WINDOW_BUFFER_SIZE_EVENT. This happens if console
is in the legacy mode. Therefore, with this patch, the windows size
is checked every time in cons_master_thread() if the cosole is in
the legacy mode.
Brian Inglis [Wed, 17 Feb 2021 16:28:36 +0000 (09:28 -0700)]
cpuinfo: add AVX features; move SME, SEV/_ES features
Linux 5.11 💕 Valentine's Day Edition 💕 added features and changes:
add Intel 0x00000007 EDX:23 avx512_fp16 and 0x00000007:1 EAX:4 avx_vnni;
group scattered AMD 0x8000001f EAX Secure Mem/Encrypted Virt features at end:
0 sme, 1 sev, 3 sev_es (more to come not yet displayed)
Cygwin: console: Introduce new thread which handles input signal.
- Currently, Ctrl-Z, Ctrl-\ and SIGWINCH does not work in console
if the process does not call read() or select(). This is because
these are processed in process_input_message() which is called
from read() or select(). This is a long standing issue of console.
Addresses:
https://cygwin.com/pipermail/cygwin/2020-May/244898.html
https://cygwin.com/pipermail/cygwin/2021-February/247779.html
With this patch, new thread which handles only input signals is
introduced so that Crtl-Z, etc. work without calling read() or
select(). Ctrl-S and Ctrl-Q are also handled in this thread.
Complete revert of 2019-08-19, st_atime in libc/include/sys/stat.h
The revert-part of the revert-and-fix commit, b99887c4283f a.k.a.
"Revert previous change to sys/stat.h and fix cris libgloss",
apparently intending to revert f75aa6785151 a.k.a. "Fix regression in
cris-elf caused by sys/stat.h change" and fix it in another way,
wasn't complete. Although the fix-part added the prerequisite "#undef
st_atime" (et al) to gensyscalls, the revert-part didn't revert the
"&& !defined(__cris__)" in sys/stat.h, stopping st_atime (et al) from
being defined.
The effect of the unreverted change is that accessing the struct stat
compatibility member names "st_atime" (et al) as in "struct stat
mystat; mystat.st_atime;" yields errors, observable for example when
building libgfortran in gcc:
/x/gcc/libgfortran/intrinsics/stat.c:114:42: error: 'struct stat' has \
no member named 'st_atime'; did you mean 'st_atim'?
114 | sarray->base_addr[8 * stride] = sb.st_atime;
| ^~~~~~~~
| st_atim
(etc.)
Trivially fixed by completing the reversion, removing the "&&
!defined(__cris__)" in sys/stat.h.
Beware: the net effect of the earlier related change to struct stat in
sys/stat.h, leading up to the fix, *does* change its definition as a
type. Thankfully, replacing members like "time_t st_atime; long
st_spare1;" by "struct timespec st_atim;", ditto st_mtim and st_ctim,
is layout-compatible. To wit, that change is "binary compatible".
Incidentally, related to the simulator / Linux ABI, there's a
transitional stage (see gensyscalls), reloading between "struct stat"
(sys/stat.h) and "struct new_stat" (kernel/simulator) as necessary.
Tested by a cris-elf gcc build (including libgfortran).
Brian Inglis [Mon, 15 Feb 2021 22:35:39 +0000 (15:35 -0700)]
winsup/doc/posix.xml: add note for getrlimit, setrlimit, xrefs to notes
change notes to see "Implementation Notes" to xref to std-notes;
add xref to std-notes to getrlimit, setrlimit;
add note to document limitations of getrlimit, setrlimit resources support
Cygwin: console: Abort read() on signal if SA_RESTART is not set.
- Currently, console read() keeps reading after SIGWINCH is sent
even if SA_RESTART flag is not set. With this patch, read()
returns EINTR on SIGWINCH if SA_RESTART flag is not set.
The same problem for SIGQUIT and SIGTSTP has also been fixed.
- Currently, input transfer is performed every time one line is read(),
if the non-cygwin app is running in the background. With this patch,
transfer is triggered by setpgid() rather than read() so that the
unnecessary input transfer can be reduced much in that situation.
Mark Geisert [Thu, 11 Feb 2021 06:53:05 +0000 (22:53 -0800)]
Cygwin: Have tmpfile(3) use O_TMPFILE
Per discussion on cygwin-developers, a Cygwin tmpfile(3) implementation
has been added to syscalls.cc. This overrides the one supplied by
newlib. Then the open(2) flag O_TMPFILE was added to the open call that
tmpfile internally makes.
This v2 patch removes O_CREAT from open() call as O_TMPFILE obviates it.
Note that open() takes a directory's path but returns an fd to a file.
Corinna Vinschen [Wed, 10 Feb 2021 09:42:05 +0000 (10:42 +0100)]
Cygwin: fhandler: clean up 'copyto' logic
Analyzing the fhandler::copyto logic shows that the fhandler_base::reset
method was only called from copyto anyway.
Trying to convert reset to a protected method uncovered that the copyto
method is actually thought upside down from an object oriented POV.
Rather than calling copyto, manipulating the object given as parameter,
rename the method to copy_from, which manipulates the calling object
itself with data from the object given as parameter.
Eventually make reset a protected method and rename it to
_copy_from_reset_helper to clarify it's only called from copy_from.
Corinna Vinschen [Wed, 10 Feb 2021 09:39:03 +0000 (10:39 +0100)]
Cygwin: check path_conv_handle for NULL before trying to dup it
path_conv_handle::dup calls DuplicateHandle unconditionally,
but we only have a handle in some cases. Check handle for being
non-NULL before calling DuplicateHandle.
Corinna Vinschen [Wed, 10 Feb 2021 09:37:13 +0000 (10:37 +0100)]
Cygwin: drop path_conv::reset_conv_handle
path_conv::reset_conv_handle is only called after fhandler::copyto
has been called. This duplicated the path_conv_handle if there was
one, so just setting the conv handle to NULL potentially produces a
handle leak. Replace reset_conv_handle calls with calls to
close_conv_handle and drop the reset_conv_handle method.
Corinna Vinschen [Wed, 10 Feb 2021 09:33:36 +0000 (10:33 +0100)]
Cygwin: don't copy path_conv in fhandler_base::reset
There's a slim chance that duplicating fhandlers may end up duplicating
path_conv_handle handles twice ending up with a handle leak, due to
fhandler_base::reset calling path_conv::operator<< after the only
caller, fhandler::copyto, already called path_conv::operator=.
Just drop the call which basically duplicates what path_conv::operator=
already did.
Ken Brown [Mon, 8 Feb 2021 20:00:24 +0000 (15:00 -0500)]
Revert "Cygwin: fstat_helper: always use handle in call to get_file_attribute"
This reverts commit 76dca77f049271e2529c25de8a396e65dbce615d. That
commit was based on the incorrect assumption that get_stat_handle,
when called on a FIFO in fstat_helper, would always return a handle
that is safe to use for getting the file information.
That assumption is true in many cases but not all. For example, if
the call to fstat_helper arises from a call to fstat(2) on a FIFO that
has been opened for writing, then get_stat_handle will return a pipe
handle instead of a file handle.
Eshan dhawan [Wed, 3 Feb 2021 22:04:06 +0000 (03:34 +0530)]
Removed Soft float from MIPS
This Patch removes Soft Float code from MIPS.
Instead It adds the soft float code from RISCV
The code came from FreeBSD and assumes the FreeBSD softfp
implementation not the one with GCC. That was an overlooked and
fixed in the other fenv code already.
Ken Brown [Sat, 30 Jan 2021 15:28:06 +0000 (10:28 -0500)]
Cygwin: recognize native Windows AF_UNIX sockets as reparse points
Allow check_reparse_point_target to recognize reparse points with
reparse tag IO_REPARSE_TAG_AF_UNIX. These are used in recent versions
of Windows 10 to represent AF_UNIX sockets.
check_reparse_point_target now returns PATH_REP on files of this type,
so that they are treated as known reparse points (but not as sockets).
This allows tools like 'rm', 'ls', etc. to operate on these files.
Ken Brown [Fri, 29 Jan 2021 14:14:35 +0000 (09:14 -0500)]
Cygwin: remove the OPEN_MAX_MAX macro
Replace all occurrences of OPEN_MAX_MAX by OPEN_MAX, and define the
latter to be 3200, which was the value of the former. In view of the
recent change to getdtablesize, there is no longer a need to
distinguish between these two macros.
Now that getdtablesize always returns OPEN_MAX_MAX, we can simplify
sysconf(_SC_OPEN_MAX) and getrlimit(RLIMIT_NOFILE) to just use that
same constant instead of calling getdtablesize.
Ken Brown [Thu, 28 Jan 2021 01:06:22 +0000 (20:06 -0500)]
Cygwin: getdtablesize: always return OPEN_MAX_MAX
According to the Linux man page for getdtablesize(3), the latter is
supposed to return "the maximum number of files a process can have
open, one more than the largest possible value for a file descriptor."
The constant OPEN_MAX_MAX is the only limit enforced by Cygwin, so we
now return that.
Previously getdtablesize returned the current size of cygheap->fdtab,
Cygwin's internal file descriptor table. But this is a dynamically
growing table, and its current size does not reflect an actual limit
on the number of open files.
With this change, gnulib now reports that getdtablesize and
fcntl(F_DUPFD) work on Cygwin. Packages like GNU tar that use the
corresponding gnulib modules will no longer use gnulib replacements on
Cygwin.
Cygwin: exceptions.cc: Suspend all threads in sig_handle_tty_stop().
- Currently, thread created by pthread_create() is not suspended by
the signal SIGTSTP. For example, even if a process with a thread
is suspended by Ctrl-Z, the thread continues running. This patch
fixes the issue.
Cygwin: console: Align the behaviour against signal with pty.
- Currently, read() returns -1 with EINTR if the process is suspended
by Ctrl-Z and resumed by fg command, while pty continues to read.
For example, xxd command stops with error "Interrupted system call"
after Ctrl-Z and fg. This patch aligns the behaviour with pty (and
Linux).
Ken Brown [Tue, 26 Jan 2021 20:54:05 +0000 (15:54 -0500)]
Cygwin: fchmodat: add limited support for AT_SYMLINK_NOFOLLOW
Allow fchmodat with the AT_SYMLINK_NOFOLLOW flag to succeed on
non-symlinks. Previously it always failed, as it does on Linux. But
POSIX permits it to succeed on non-symlinks even if it fails on
symlinks.
The reason for following POSIX rather than Linux is to make gnulib
report that fchmodat works on Cygwin. This improves the efficiency of
packages like GNU tar that use gnulib's fchmodat module. Previously
such packages would use a gnulib replacement for fchmodat on Cygwin.
Cygwin: pty: Allow multiple apps to enable pseudo console simultaneously.
- After commit bb428520, there has been the disadvantage:
7) Pseudo console cannot be activated if it is already activated for
another process on same pty.
This patch clears this disadvantage.
Cygwin: pty: Make apps using console APIs be able to debug with gdb.
- After commit bb428520, there has been the disadvantage:
2) The apps which use console API cannot be debugged with gdb. This
is because pseudo console is not activated since gdb uses
CreateProcess() rather than exec(). Even with this limitation,
attaching gdb to native app, in which pseudo console is already
activated, works.
This patch clears this disadvantage.
Cygwin: pty: Keep code page between non-cygwin apps.
- After commit bb428520, there has been the disadvantage:
4) Code page cannot be changed by chcp.com. Acctually, chcp works
itself and changes code page of its own pseudo console. However,
since pseudo console is recreated for another process, it cannot
inherit the code page.
This patch clears this disadvantage.
Cygwin: pty: Inherit typeahead data between two input pipes.
- PTY has a problem that the key input, which is typed during windows
native app is running, disappears when it returns to shell. This is
beacuse pty has two input pipes, one is for cygwin apps and the other
one is for native windows apps. The key input during windows native
program is running is sent to the second input pipe while cygwin
shell reads input from the first input pipe. This issue had been
fixed once by commit 29431fcb, however, the new implementation of
pseudo console support by commit bb428520 could not inherit this
feature. This patch realize transfering input data between these
two pipes bidirectionally by utilizing cygwin-console-helper process.
The helper process is launched prior to starting the non-cygwin app,
however, exits immediately unlike previous implementation.
Ken Brown [Tue, 26 Jan 2021 02:05:37 +0000 (21:05 -0500)]
Cygwin: chown: make sure ctime gets updated when necessary
Following POSIX, ensure that ctime is updated if chown succeeds,
unless the new owner is specified as (uid_t)-1 and the new group is
specified as (gid_t)-1. Previously, ctime was unchanged whenever the
owner and group were both unchanged.
Aside from POSIX compliance, this fix makes gnulib report that chown
works on Cygwin. This improves the efficiency of packages like GNU
tar that use gnulib's chown module. Previously such packages would
use a gnulib replacement for chown on Cygwin.