]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
3 years agoCygwin: exceptions.cc: Suspend all threads in sig_handle_tty_stop().
Takashi Yano via Cygwin-patches [Fri, 29 Jan 2021 03:46:26 +0000 (12:46 +0900)]
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.

3 years agoCygwin: console: Align the behaviour against signal with pty.
Takashi Yano via Cygwin-patches [Fri, 29 Jan 2021 03:45:44 +0000 (12:45 +0900)]
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).

3 years agoCygwin: pty: Make slave read() thread-safe.
Takashi Yano via Cygwin-patches [Thu, 28 Jan 2021 14:11:33 +0000 (23:11 +0900)]
Cygwin: pty: Make slave read() thread-safe.

- Currently slave read() is somehow not thread-safe. This patch
  fixes the issue.

3 years agoCygwin: console: Make read() thread-safe.
Takashi Yano via Cygwin-patches [Thu, 28 Jan 2021 14:11:32 +0000 (23:11 +0900)]
Cygwin: console: Make read() thread-safe.

- Currently read() is somehow not thread-safe. This patch fixes
  the issue.

3 years agoCygwin: fchmodat: add limited support for AT_SYMLINK_NOFOLLOW
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.

3 years agoCygwin: pty: Allow multiple apps to enable pseudo console simultaneously.
Takashi Yano via Cygwin-patches [Thu, 28 Jan 2021 03:26:14 +0000 (12:26 +0900)]
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.

3 years agoCygwin: pty: Make apps using console APIs be able to debug with gdb.
Takashi Yano via Cygwin-patches [Thu, 28 Jan 2021 03:26:13 +0000 (12:26 +0900)]
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.

3 years agoCygwin: pty: Keep code page between non-cygwin apps.
Takashi Yano via Cygwin-patches [Thu, 28 Jan 2021 03:26:12 +0000 (12:26 +0900)]
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.

3 years agoCygwin: pty: Inherit typeahead data between two input pipes.
Takashi Yano via Cygwin-patches [Thu, 28 Jan 2021 03:26:11 +0000 (12:26 +0900)]
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.

3 years agoCygwin: Align *utime*() with POSIX/glibc
Corinna Vinschen [Tue, 26 Jan 2021 16:26:35 +0000 (17:26 +0100)]
Cygwin: Align *utime*() with POSIX/glibc

Followup to previous patch, this time matching definitions in Cygwin

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoAlign *utime*() with POSIX/glibc
Sebastian Huber [Tue, 26 Jan 2021 14:16:31 +0000 (15:16 +0100)]
Align *utime*() with POSIX/glibc

Change the prototypes to be in line with POSIX/glibc.  This may fix
issues with new warnings produced by GCC 11.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
3 years agoCygwin: chown: make sure ctime gets updated when necessary
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.

3 years agosyscalls.cc: Deduplicate remove
Ben Wijen [Fri, 22 Jan 2021 15:47:12 +0000 (16:47 +0100)]
syscalls.cc: Deduplicate remove

The remove code is already in the _remove_r function.
So, just call the _remove_r function.

3 years agoCygwin: console: Add missing guard regarding attach_mutex.
Takashi Yano via Cygwin-patches [Mon, 25 Jan 2021 09:18:11 +0000 (18:18 +0900)]
Cygwin: console: Add missing guard regarding attach_mutex.

- The commit a5333345 did not fix the problem enough. This patch
  provides additional guard for the issue.

3 years agosyscalls.cc: unlink_nt: Try FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE
Ben Wijen [Fri, 22 Jan 2021 15:47:11 +0000 (16:47 +0100)]
syscalls.cc: unlink_nt: Try FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE

I think we don't need an extra flag as we can utilize: access & FILE_WRITE_ATTRIBUTES
What do you think?

Ben Wijen (1):
  syscalls.cc: unlink_nt: Try FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE

 winsup/cygwin/ntdll.h     |  3 ++-
 winsup/cygwin/syscalls.cc | 22 +++++++--------
 winsup/cygwin/wincap.cc   | 11 ++++++++
 winsup/cygwin/wincap.h    | 56 ++++++++++++++++++++-------------------
 4 files changed, 53 insertions(+), 39 deletions(-)

--
2.30.0

>From 2d0ff6fec10d03c24d11c747852018b7bc1136ac Mon Sep 17 00:00:00 2001
In-Reply-To: <20210122105201.GD810271@calimero.vinschen.de>
References: <20210122105201.GD810271@calimero.vinschen.de>
From: Ben Wijen <ben@wijen.net>
Date: Tue, 17 Dec 2019 15:15:25 +0100
Subject: [PATCH v3 1/8] syscalls.cc: unlink_nt: Try
 FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE

Implement wincap.has_posix_unlink_semantics_with_ignore_readonly and when set
skip setting/clearing of READONLY attribute and instead use
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE

3 years agoCygwin: ptsname_r: always return an error number on failure
Ken Brown [Wed, 20 Jan 2021 17:01:13 +0000 (12:01 -0500)]
Cygwin: ptsname_r: always return an error number on failure

Return EBADF on a bad file descriptor.  Previously 0 was returned, in
violation of the requirement in
https://man7.org/linux/man-pages/man3/ptsname_r.3.html that an error
number should be returned on failure.

We are intentionally deviating from Linux, on which ENOTTY is
returned.

Addresses: https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00245.html

3 years agoCygwin: normalize_posix_path: fix error handling when .. is encountered
Ken Brown [Wed, 20 Jan 2021 15:12:58 +0000 (10:12 -0500)]
Cygwin: normalize_posix_path: fix error handling when .. is encountered

When .. is in the source path and the path prefix exists but is not a
directory, return ENOTDIR instead of ENOENT.  This fixes a POSIX
compliance issue for realpath(3):

  https://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html

Addresses: https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00214.html

3 years agoCygwin: Move post-dir unlink check
Ben Wijen [Wed, 20 Jan 2021 16:10:51 +0000 (17:10 +0100)]
Cygwin: Move post-dir unlink check

Move post-dir unlink check from fhandler_disk_file::rmdir to
_unlink_nt_post_dir_check

If a directory is not removed through fhandler_disk_file::rmdir
we can now make sure the post dir check is performed.

3 years agoCygwin: console: Fix "Bad file descriptor" error in script command.
Takashi Yano via Cygwin-patches [Wed, 20 Jan 2021 09:16:20 +0000 (18:16 +0900)]
Cygwin: console: Fix "Bad file descriptor" error in script command.

- After the commit 72770148, script command exits occasionally with
  the error "Bad file descriptor" if it is started in console on Win7
  and non-cygwin process is executed. This patch fixes the issue.

3 years agoCygwin: pty: Reduce buffer size in get_console_process_id().
Takashi Yano via Cygwin-patches [Wed, 20 Jan 2021 00:57:00 +0000 (09:57 +0900)]
Cygwin: pty: Reduce buffer size in get_console_process_id().

- The buffer used in get_console_process_id(), introduced by commit
  72770148, is too large and ERROR_NOT_ENOUGH_MEMORY occurs in Win7.
  Therefore, the buffer size has been reduced.

3 years agoCygwin: pty: Lessen the side effect of workaround for rlwarp.
Takashi Yano via Cygwin-patches [Tue, 19 Jan 2021 09:27:02 +0000 (18:27 +0900)]
Cygwin: pty: Lessen the side effect of workaround for rlwarp.

- This patch lessens the side effect of the workaround for rlwrap
  introduced by commit 4e16b033.

3 years agoCygwin: spawn.cc: Fix typo in comment by commit 974e6d76.
Takashi Yano via Cygwin-patches [Mon, 18 Jan 2021 18:45:24 +0000 (03:45 +0900)]
Cygwin: spawn.cc: Fix typo in comment by commit 974e6d76.

3 years agoCygwin: rmdir: handle /dev in fhandler_dev::rmdir
Corinna Vinschen [Tue, 19 Jan 2021 09:50:36 +0000 (10:50 +0100)]
Cygwin: rmdir: handle /dev in fhandler_dev::rmdir

The isdev_dev check in rmdir is unclean.  Create a virtual method
fhandler_dev::rmdir to handle this transparently.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: document a recent bug fix
Ken Brown [Fri, 15 Jan 2021 17:37:57 +0000 (12:37 -0500)]
Cygwin: document a recent bug fix

This documents commit aec64798, "Cygwin: add flag to indicate reparse
points unknown to WinAPI".

3 years agoCygwin: pty: Set input_available_event only for cygwin pipe.
Takashi Yano via Cygwin-patches [Fri, 15 Jan 2021 09:26:31 +0000 (18:26 +0900)]
Cygwin: pty: Set input_available_event only for cygwin pipe.

- cat exits immediately in the following senario.
    1) Execute env CYGWIN=disable_pcon script
    2) Execute cmd.exe
    3) Execute cat in cmd.exe.
  This is caused by setting input_available_event for the pipe for
  non-cygwin app. This patch fixes the issue.

3 years agoCygwin: pty: Make master thread functions be static.
Takashi Yano via Cygwin-patches [Fri, 15 Jan 2021 08:32:13 +0000 (17:32 +0900)]
Cygwin: pty: Make master thread functions be static.

- The functions pty_master_thread() and pty_master_fwd_thread()
  should be static (i.e. should not access class member) because
  the instance is deleted if the master is dup()'ed and the first
  master is closed. In this case, because the dup()'ed instance
  still exists, these master threads are also still alive even
  though the instance has been deleted. As a result, accesing
  class members in these functions causes accessi violation.

  Addresses:
  https://cygwin.com/pipermail/cygwin-developers/2021-January/012030.html

3 years agoCygwin: pty: Prevent pty from changing code page of parent console.
Takashi Yano via Cygwin-patches [Mon, 18 Jan 2021 13:10:57 +0000 (22:10 +0900)]
Cygwin: pty: Prevent pty from changing code page of parent console.

- After commit 232fde0e, pty changes console code page when the first
  non-cygwin app is executed. If pty is started in real console device,
  pty changes the code page of root console. This causes very annoying
  result because changing code page changes the font of command prompt
  if console is in legacy mode. This patch avoids this by creating a
  new invisible console for the first pty started in console device.

3 years agocxx.cc: Fix dynamic initialization for static local variables
Ben Wijen [Fri, 15 Jan 2021 13:45:29 +0000 (14:45 +0100)]
cxx.cc: Fix dynamic initialization for static local variables

The old implementation for __cxa_guard_acquire did not return 1,
therefore dynamic initialization was never performed.

If concurrent-safe dynamic initialisation is ever needed, CXX ABI
must be followed when re-implementing __cxa_guard_acquire (et al.)

3 years agosyscalls.cc: Use EISDIR
Ben Wijen [Fri, 15 Jan 2021 13:45:27 +0000 (14:45 +0100)]
syscalls.cc: Use EISDIR

This is the non-POSIX value returned by Linux since 2.1.132.

3 years agosyscalls.cc: Fix num_links
Ben Wijen [Fri, 15 Jan 2021 13:45:26 +0000 (14:45 +0100)]
syscalls.cc: Fix num_links

NtQueryInformationFile on fh_ro needs FILE_READ_ATTRIBUTES
to succeed.

3 years agoCygwin: Add Ben Wijen to list of contributors
Corinna Vinschen [Mon, 18 Jan 2021 11:01:11 +0000 (12:01 +0100)]
Cygwin: Add Ben Wijen to list of contributors

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: pty: Make close_pseudoconsole() be a static member function.
Takashi Yano via Cygwin-patches [Fri, 15 Jan 2021 08:32:11 +0000 (17:32 +0900)]
Cygwin: pty: Make close_pseudoconsole() be a static member function.

- The function close_pseudoconsole() should be static so that it
  can be safely called in spawn.cc even after the fhandler_pty_slave
  instance has been deleted. That is, there is a problem with the
  current code. This patch fixes the issue.

3 years agoCygwin: console: Revise the code to switch xterm mode.
Takashi Yano via Cygwin-patches [Fri, 15 Jan 2021 08:32:10 +0000 (17:32 +0900)]
Cygwin: console: Revise the code to switch xterm mode.

- If application changes the console mode, mode management introduced
  by commit 10d8c278 will be corrupted. For example, stdout of jansi
  v2.0.1 or later is piped to less, jansi resets the xterm mode flag
  ENABLE_VIRTUAL_TERMINA_PROCESSING when jansi is terminated. This
  causes garbled output in less because less needs this flag enabled.
  This patch fixes the issue.

3 years agoCygwin: pty: Add workaround for rlwrap 0.40 or later.
Takashi Yano via Cygwin-patches [Fri, 15 Jan 2021 08:32:09 +0000 (17:32 +0900)]
Cygwin: pty: Add workaround for rlwrap 0.40 or later.

- The workaround for rlwrap introduced by commit 8199b0cc does not
  take effect for rlwrap 0.40 or later. This patch add a workaround
  for rlwrap 0.40 or later as well.

3 years agoCygwin: fstatat: call fstat64 instead of fstat
Ken Brown [Tue, 12 Jan 2021 19:18:28 +0000 (14:18 -0500)]
Cygwin: fstatat: call fstat64 instead of fstat

This fixes a bug on 32-bit Cygwin that was introduced in commit
84252946, "Cygwin: fstatat, fchownat: support the AT_EMPTY_PATH flag".

Add a comment explaining why fstat should not be called.

Addresses: https://cygwin.com/pipermail/cygwin/2021-January/247399.html

3 years agoRTEMS: Add <poll.h> and <sys/poll.h>
Sebastian Huber [Mon, 4 Jan 2021 18:41:43 +0000 (19:41 +0100)]
RTEMS: Add <poll.h> and <sys/poll.h>

Add the POSIX header file <poll.h> which is used by the GCC 11 Ada
runtime support.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
3 years agoBump up newlib version to 4.1.0 newlib-4.1.0
Jeff Johnston [Fri, 18 Dec 2020 23:50:49 +0000 (18:50 -0500)]
Bump up newlib version to 4.1.0

3 years agofixes to make compilation succeeds
Paul Zimmermann [Fri, 18 Dec 2020 08:52:40 +0000 (09:52 +0100)]
fixes to make compilation succeeds

3 years agoUpdate gamma functions from code in picolibc
Jeff Johnston [Thu, 17 Dec 2020 20:58:49 +0000 (15:58 -0500)]
Update gamma functions from code in picolibc

- fixes issue with inf sign when x is -0

3 years agofhandler_proc.cc(format_proc_cpuinfo): report Intel SGX bits
Brian Inglis [Thu, 17 Dec 2020 07:11:28 +0000 (00:11 -0700)]
fhandler_proc.cc(format_proc_cpuinfo): report Intel SGX bits

Update to Linux next 5.10 cpuinfo flags for Intel SDM 36.7.1 Software
Guard Extensions, and 38.1.4 SGX Launch Control Configuration.
Launch control restricts what software can run with enclave protections,
which helps protect the system from bad enclaves.

3 years agoRISC-V: Add semihosting support
Craig Blackmore [Tue, 15 Dec 2020 12:00:27 +0000 (12:00 +0000)]
RISC-V: Add semihosting support

3 years agoAdd declarations for __ieee754_tgamma functions to fdlibm.h
Jeff Johnston [Wed, 16 Dec 2020 20:25:25 +0000 (15:25 -0500)]
Add declarations for __ieee754_tgamma functions to fdlibm.h

3 years agoCygwin: pty: Revise the workaround for rlwrap.
Takashi Yano via Cygwin-patches [Wed, 16 Dec 2020 09:10:58 +0000 (18:10 +0900)]
Cygwin: pty: Revise the workaround for rlwrap.

- Previous workaround has a problem that screen is distorted if up
  arrow key is pressed at the first line after running "rlwrap cmd".
  This patch fixes the issue.

3 years agoCygwin: pty: Check response for CSI6n more strictly.
Takashi Yano via Cygwin-patches [Wed, 16 Dec 2020 09:10:15 +0000 (18:10 +0900)]
Cygwin: pty: Check response for CSI6n more strictly.

- Previous code to read response for CSI6n allows invalid response
  such as "CSI Pl; Pc H" other than correct response "CSI Pl; Pc R".
  With this patch, the response is checked more strictly.

3 years agoCygwin: Make sure newer apps get uname_x even when loading uname dynamically
Corinna Vinschen [Mon, 14 Dec 2020 11:29:23 +0000 (12:29 +0100)]
Cygwin: Make sure newer apps get uname_x even when loading uname dynamically

if an application built after API version 334 loads uname dynamically,
it actually gets the old uname, rather than the new uname_x.  Fix this by
checking the apps API version in uname and call uname_x instead, if it's
a newer app.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoarm: Fix memchr() for Armv8-R
Sebastian Huber [Fri, 4 Dec 2020 07:42:04 +0000 (08:42 +0100)]
arm: Fix memchr() for Armv8-R

The Cortex-R52 processor is an Armv8-R processor with a NEON unit.  This
fix prevents conflicting architecture profiles A/R errors issued by the
linker.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
3 years agoCygwin: pty: Add a workaround for rlwrap.
Takashi Yano via Cygwin-patches [Mon, 14 Dec 2020 08:26:47 +0000 (17:26 +0900)]
Cygwin: pty: Add a workaround for rlwrap.

- If rlwrap is used with non-cygwin apps, it fails to setup pseudo
  console. This patch adds a workaround for this issue.

3 years agoCygwin: pty: Revise the code for timeout in term_has_pcon_cap().
Takashi Yano via Cygwin-patches [Mon, 14 Dec 2020 08:26:09 +0000 (17:26 +0900)]
Cygwin: pty: Revise the code for timeout in term_has_pcon_cap().

- Sometimes timeout period in term_has_pcon_cap() may not be enough
  when the machine slows down for some reason. This patch eases the
  issue. In the new code, effective timeout period is expected to be
  extended as a result due to slowing-down the wait loop as well when
  the machine gets into busy.

3 years agoCygwin: pty: Skip term_has_pcon_cap() if pseudo console is disabled.
Takashi Yano via Cygwin-patches [Mon, 14 Dec 2020 08:25:33 +0000 (17:25 +0900)]
Cygwin: pty: Skip term_has_pcon_cap() if pseudo console is disabled.

- This patch skips unnecessary term_has_pcon_cap() call if pseudo
  console is disabled.

3 years agoFix error in powf for x close to 1 and large y
Fabian Schriever [Fri, 11 Dec 2020 15:57:35 +0000 (16:57 +0100)]
Fix error in powf for x close to 1 and large y

This patch fixes the error found by Paul Zimmermann (see
https://homepages.loria.fr/PZimmermann/papers/#accuracy) regarding x
close to 1 and rather large y (specifically he found the case
powf(0x1.ffffeep-1,-0x1.000002p+27) which returns +Inf instead of the
correct value). We found 2 more values for x which show the same faulty
behaviour, and all 3 are fixed with this patch. We have tested all
combinations for x in [+1.fffdfp-1, +1.00020p+0] and y in
[-1.000007p+27, -1.000002p+27] and [1.000002p+27,1.000007p+27].

3 years agoBump newlib release to 4.0.0
Jeff Johnston [Tue, 17 Nov 2020 21:47:35 +0000 (16:47 -0500)]
Bump newlib release to 4.0.0

3 years agocygwin: use CREATE_DEFAULT_ERROR_MODE in spawn
Jeremy Drake via Cygwin-patches [Wed, 9 Dec 2020 19:27:11 +0000 (11:27 -0800)]
cygwin: use CREATE_DEFAULT_ERROR_MODE in spawn

This allows native processes to get Windows-default error handling
behavior (such as invoking the registered JIT debugger).

3 years agoCygwin: dtable::dup_worker: update comment and debug output
Ken Brown [Mon, 7 Dec 2020 21:19:57 +0000 (16:19 -0500)]
Cygwin: dtable::dup_worker: update comment and debug output

The comment and debug output became obsolete in commit 23771fa1f7 when
dup_worker started calling fhandler_base::clone instead of build_fh_pc
and fhandler_base::operator=.

3 years agoCygwin: Allow to set SO_PEERCRED zero (v2)
Mark Geisert [Mon, 7 Dec 2020 10:29:36 +0000 (02:29 -0800)]
Cygwin: Allow to set SO_PEERCRED zero (v2)

The existing code errors as EINVAL any attempt to set a value for
SO_PEERCRED via setsockopt() on an AF_UNIX/AF_LOCAL socket.  But to
enable the workaround set_no_getpeereid behavior for Python one has
to be able to set SO_PEERCRED to zero.  Ergo, this patch.  Python has
no way to specify a NULL pointer for 'optval'.

This v2 of patch allows the original working (i.e., allow NULL,0 for
optval,optlen to mean turn off SO_PEERCRED) in addition to the new
working described above.  The sense of the 'if' stmt is reversed for
readability.

3 years agoCygwin: Launch cygmagic with bash, not sh
Mark Geisert [Mon, 7 Dec 2020 06:17:15 +0000 (22:17 -0800)]
Cygwin: Launch cygmagic with bash, not sh

On some systems /bin/sh is not /bin/bash and cygmagic has bash-isms in
it.  So even though cygmagic has a /bin/bash shebang, it also needs to be
launched with bash from within Makefile.in.

3 years agoFix trace output for getdomainname()
Anton Lavrentiev via Cygwin-patches [Fri, 4 Dec 2020 22:58:01 +0000 (17:58 -0500)]
Fix trace output for getdomainname()

3 years agowinsup/doc/Makefile.in: create man5 dir and install proc.5
Brian Inglis [Wed, 25 Nov 2020 06:49:31 +0000 (23:49 -0700)]
winsup/doc/Makefile.in: create man5 dir and install proc.5

3 years agospecialnames.xml: add proc(5) Cygwin man page
Brian Inglis [Wed, 25 Nov 2020 06:49:30 +0000 (23:49 -0700)]
specialnames.xml: add proc(5) Cygwin man page

3 years agoCygwin: Fix remaining warnings building path testsuite
Corinna Vinschen [Tue, 1 Dec 2020 09:10:40 +0000 (10:10 +0100)]
Cygwin: Fix remaining warnings building path testsuite

3 years agoCygwin: Fix building of utils testsuite
Jon Turney [Mon, 30 Nov 2020 16:58:02 +0000 (16:58 +0000)]
Cygwin: Fix building of utils testsuite

Avoid referencing undefined max_mount_entry.

3 years agoCygwin: add flag to indicate reparse points unknown to WinAPI
Corinna Vinschen [Wed, 2 Dec 2020 15:12:58 +0000 (16:12 +0100)]
Cygwin: add flag to indicate reparse points unknown to WinAPI

https://cygwin.com/pipermail/cygwin/2020-December/246938.html
reports a problem where, when adding a Cygwin default symlink
to $PATH since Cygwin 3.1.5, $PATH handling appears to be broken.

3.1.5 switched to WSL symlinks as Cygwin default symlinks.

A piece of code in path handling skips resolving reparse points
if they are the last component in the path.  Thus a reparse point
in $PATH is not resolved but converted to Windows path syntax
verbatim.

If you do this with a WSL symlink, certain WinAPI functions fail.
The underlying $PATH handling fails to recognize the reparse
point in $PATH and returns with STATUS_IO_REPARSE_TAG_NOT_HANDLED.
As a result, the calling WinAPI function fails, most prominently
so CreateProcess.

Fix this problem by adding a PATH_REP_NOAPI bit to path_types
and a matching method path_conv::is_winapi_reparse_point().

Right now this flag is set for WSL symlinks and Cygwin AF_UNIX
sockets (new type implemented as reparse points).

The aforementioned code skipping repare point path resolution calls
is_winapi_reparse_point() rather than is_known_reparse_point(),
so now path resolution is only skipped for reparse points known
to WinAPI.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: path.h: add comments to briefly explain path_types
Corinna Vinschen [Wed, 2 Dec 2020 14:57:39 +0000 (15:57 +0100)]
Cygwin: path.h: add comments to briefly explain path_types

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: testsuite: libltp: fix warnings showing up with -Wall
Corinna Vinschen [Wed, 2 Dec 2020 13:12:24 +0000 (14:12 +0100)]
Cygwin: testsuite: libltp: fix warnings showing up with -Wall

This libltp is old as old dirt and still using K&R style.
If it's really to be used again at all, it needs a serious
refresh.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: /proc/sys FS: don't export NFS and DFS as block devices
Corinna Vinschen [Tue, 1 Dec 2020 08:37:07 +0000 (09:37 +0100)]
Cygwin: /proc/sys FS: don't export NFS and DFS as block devices

Network filesystems are not block devices.  Apparently this code
hasn't been executed anyway, given how network filesystems are
hidden behind \Device\Mup.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoCygwin: Fix access to block devices below /proc/sys.
Christian Franke [Sat, 28 Nov 2020 21:09:23 +0000 (22:09 +0100)]
Cygwin: Fix access to block devices below /proc/sys.

Use fhandler_dev_floppy instead of fhandler_procsys for such devices.
The read()/write() functions from fhandler_procsys do not ensure
sector aligned transfers and lseek() fails always.

Signed-off-by: Christian Franke <franke@computer.org>
3 years agoCygwin: Have cygmagic not create output if an error occurs
Jon Turney [Thu, 12 Nov 2020 17:58:58 +0000 (17:58 +0000)]
Cygwin: Have cygmagic not create output if an error occurs

Improve the 'cygmagic' script, so it doesn't create the output file if
an error occurs, even in one of the backtick-enclosed pipelines it runs.

3 years agoCygwin: Use standard CXXFLAGS when compiling localtime_wrapper.c
Jon Turney [Thu, 19 Nov 2020 21:38:47 +0000 (21:38 +0000)]
Cygwin: Use standard CXXFLAGS when compiling localtime_wrapper.c

This has an separate, explicit compilation rule which omits CXXFLAGS, so
expected flags like '-g -O2' aren't being used.

3 years agoCygwin: Drop libgmon.a build dependency on gcrt0.o
Jon Turney [Thu, 19 Nov 2020 21:34:44 +0000 (21:34 +0000)]
Cygwin: Drop libgmon.a build dependency on gcrt0.o

libgmon.a depends on gcrt0.o, but doesn't include it.

3 years agoCygwin: pty: Fix minor style issue.
Takashi Yano via Cygwin-patches [Mon, 23 Nov 2020 11:03:04 +0000 (20:03 +0900)]
Cygwin: pty: Fix minor style issue.

3 years agoCygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.
Takashi Yano via Cygwin-patches [Mon, 23 Nov 2020 11:03:03 +0000 (20:03 +0900)]
Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.

- If vim is executed in WSL in mintty, some garbage string caused
  by "OSC Ps;? BEL/ST" will be shown in some situations. This patch
  fixes the issue by removing "OSC Ps;? BEL/ST" from pseudo console
  output.

3 years agoCygwin: pty: Fix a bug in the code removing "CSI > Pm m".
Takashi Yano via Cygwin-patches [Mon, 23 Nov 2020 11:03:02 +0000 (20:03 +0900)]
Cygwin: pty: Fix a bug in the code removing "CSI > Pm m".

- The code added by 8121b606e843c001d5ca5213d24099e04ebc62ca has a
  bug which fails to remove multiple "CSI > Pm m" sequences. This
  patch fixes the bug.

3 years agoCygwin: Remove surplus autoconf auxiliary files
Jon Turney [Wed, 21 Oct 2020 19:41:58 +0000 (20:41 +0100)]
Cygwin: Remove surplus autoconf auxiliary files

Since we are now only configuring once, in winsup, with
AC_CONFIG_AUX_DIR(..), the auxiliary files are taken from the top-level.

(Previously we had a random assorment of AC_CONFIG_AUX_DIR(..) and
AC_CONFIG_AUX_DIR(../..) in winsup subdirectories, so auxiliary files
would be taken from winsup or the top-level.)

3 years agoCygwin: Remove recursive configure
Jon Turney [Tue, 6 Oct 2020 15:22:02 +0000 (16:22 +0100)]
Cygwin: Remove recursive configure

There's doesn't seem to be much use in independently distributing these
subdirectories, so allowing them to be independently configured seems
pointless and overcomplicated.

The order in which the subdirectories are built is still a little odd,
as cygwin is linked with libcygserver, and cygserver is then linked with
cygwin. So, we build the cygwin directory first, which invokes a build
of libcygserver in the cygserver directory, and then build in the
cygserver directory to build the cygserver executable.

Drop AC_CONFIGURE_ARGS, since we don't need to recursively call
configure with the same arguments anymore.

Slightly refine when we build utils: Previously we didn't build any
utils if MinGW compiler use was avoided, now we just avoid building
those utils which require that compiler.

Greatly simplify how winsup_srcdir and target_builddir are set, since
we're only configuring from one directory.  (These are still kept
absolute, since we don't adjust them where used for being used in a
subdirectory).

Remove configure.cygwin and put it's (greatly reduced) contents inline
in the one place it's used now.

Remove generated configure and aclocal.m4 in subdirectories.

3 years agoCygwin: fhandler_fifo::cleanup_handlers: improve efficiency
Ken Brown [Thu, 19 Nov 2020 20:22:56 +0000 (15:22 -0500)]
Cygwin: fhandler_fifo::cleanup_handlers: improve efficiency

Traverse the fifo_client_handler list from the top down to try to
avoid copying.

3 years agoCygwin: Testsuite Makefile cleanup
Jon Turney [Thu, 12 Nov 2020 15:40:44 +0000 (15:40 +0000)]
Cygwin: Testsuite Makefile cleanup

Drop unused variables CC_FOR_TARGET, GCC_INCLUDE, ALL_CFLAGS
Stop exporting CC, CFLAGS
Drop unused, empty targets force, dll_ofiles, all_target

3 years agoCygwin: Fix 'make check' in utils
Jon Turney [Thu, 12 Nov 2020 14:56:09 +0000 (14:56 +0000)]
Cygwin: Fix 'make check' in utils

This has a test of the path translation code used in various utilities
(mount, cygpath, strace).

MOUNT_BINARY is replaced with the absence of MOUNT_TEXT since 26e0b37e.
The issys member of mnt_t struct was removed in b677a99b.

> $ make check
[...]
> total tests: 63
> pass       : 63 (100.0%)
> fail       : 0 (0.0%)

3 years agoCygwin: Drop duplicate C++ flags used to build utils
Jon Turney [Wed, 11 Nov 2020 14:03:58 +0000 (14:03 +0000)]
Cygwin: Drop duplicate C++ flags used to build utils

'-fno-exceptions -fno-rtti' are already present in the compile command
COMPILE.cc set by Makefile.common, so we don't need to add them to
CXXFLAGS as well.

3 years agoCygwin: Use grep in text mode to look for version strings
Jon Turney [Wed, 28 Oct 2020 20:59:53 +0000 (20:59 +0000)]
Cygwin: Use grep in text mode to look for version strings

Invoke grep in text mode when looking for version strings inside the
cygwin DLL, so it outputs something more informative than:

  Binary file ../cygwin/cygwin0.dll matches

3 years agoRISC-V: Add machine-specific implementation for lrint[f], lround[f], llrint[f] and...
Kito Cheng [Wed, 18 Nov 2020 03:35:43 +0000 (11:35 +0800)]
RISC-V: Add machine-specific implementation for lrint[f], lround[f], llrint[f] and llround[f].

3 years agoRISC-V: Add machine-specific implementation for isnan[f] and copysign[f]
Kito Cheng [Wed, 18 Nov 2020 03:35:42 +0000 (11:35 +0800)]
RISC-V: Add machine-specific implementation for isnan[f] and copysign[f]

3 years agoRISC-V: Add missing compile rule for s_finite.c, sf_finite.c, s_isinf.c and sf_isinf.c
Kito Cheng [Wed, 18 Nov 2020 03:35:41 +0000 (11:35 +0800)]
RISC-V: Add missing compile rule for s_finite.c, sf_finite.c, s_isinf.c and sf_isinf.c

3 years agomalloc/nano-malloc: correctly check for out-of-bounds allocation reqs
Corinna Vinschen [Tue, 17 Nov 2020 09:50:57 +0000 (10:50 +0100)]
malloc/nano-malloc: correctly check for out-of-bounds allocation reqs

The overflow check in mEMALIGn erroneously checks for INT_MAX,
albeit the input parameter is size_t.  Fix this to check for
__SIZE_MAX__ instead.  Also, it misses to check the req against
adding the alignment before calling mALLOc.

While at it, add out-of-bounds checks to pvALLOc, nano_memalign,
nano_valloc, and Cygwin's (unused) dlpvalloc.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agoFix return type of __locale_ctype_ptr_l()
Sebastian Huber [Mon, 16 Nov 2020 13:38:22 +0000 (14:38 +0100)]
Fix return type of __locale_ctype_ptr_l()

This prevents warnings like this:

ctype.h:118:9: warning: return discards 'const' qualifier from pointer
  target type

3 years agoCygwin: testsuite: fix insecure usage of printf in libltp
Corinna Vinschen [Mon, 16 Nov 2020 14:55:15 +0000 (15:55 +0100)]
Cygwin: testsuite: fix insecure usage of printf in libltp

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
3 years agolibc/include/newlib.h: Fix C++ compilation issue
Joel Sherrill [Mon, 9 Nov 2020 21:33:02 +0000 (15:33 -0600)]
libc/include/newlib.h: Fix C++ compilation issue

3 years agoCygwin: path_conv::eq_worker: add NULL pointer checks
Ken Brown [Sat, 14 Nov 2020 14:02:43 +0000 (09:02 -0500)]
Cygwin: path_conv::eq_worker: add NULL pointer checks

Don't call cstrdup on NULL pointers.

This fixes a crash that was observed when cloning an fhandler whose
path_conv member had freed its strings.

3 years agoCygwin: Fix testsuite tmpdir creation with non-default cygdrive prefix
Jon Turney [Mon, 9 Nov 2020 13:48:38 +0000 (13:48 +0000)]
Cygwin: Fix testsuite tmpdir creation with non-default cygdrive prefix

3 years agoCygwin: fhandler_fifo: reduce size
Ken Brown [Sun, 8 Nov 2020 17:02:39 +0000 (12:02 -0500)]
Cygwin: fhandler_fifo: reduce size

Replace the 'WCHAR pipe_name_buf[48]' class member by 'PWCHAR
pipe_name_buf', and allocate space for the latter as needed.

Change the default constructor to accommodate this change, and add a
destructor that frees the allocated space.

Also change get_pipe_name and clone to accommodate this change.

3 years agoCygwin: Ensure temporary directory used by tests exists
Jon Turney [Thu, 29 Oct 2020 14:43:32 +0000 (14:43 +0000)]
Cygwin: Ensure temporary directory used by tests exists

By default, libltp tests will create temporary files in a subdirectory
of /tmp, which will (nowadays) be located relative to the test DLL (by
assuming that it is in /bin).  This will evaluate to the directory
$target_builddir/winsup/tmp, which doesn't exist.

The location used for these temporary files can be explicitly controlled
by setting the TDIRECTORY env var.  Arrange to set that env var to the
/cygdrive path of a tmp subdirectory of the build directory.

Unfortunately, libltp doesn't clean the temporary directory if
TDIRECTORY is set, and some tests assume they are started in a clean
directory, so we need to do that in tcl.

3 years agoCygwin: Set PATH for tests to pick up cygwin0.dll
Jon Turney [Wed, 28 Oct 2020 16:14:55 +0000 (16:14 +0000)]
Cygwin: Set PATH for tests to pick up cygwin0.dll

Set the PATH so that tests can pick up cygwin0.dll.  Looks like this was
dropped by accident in 2e488e95 ("Don't rely on in-build tools"), so
restore it as it was prior to 9d89f634.

3 years agoCygwin: Check exit code of a test, rather than stdout
Jon Turney [Fri, 16 Oct 2020 23:36:26 +0000 (00:36 +0100)]
Cygwin: Check exit code of a test, rather than stdout

In winsup.exp, don't consider a command failed if it produced any output
(e.g. if the compiler produced warnings).  Instead check the exit code.

3 years agoCygwin: Use absolute path to libltp includes
Jon Turney [Wed, 28 Oct 2020 20:20:27 +0000 (20:20 +0000)]
Cygwin: Use absolute path to libltp includes

Use an absolute path to libltp includes, to allow for the fact that
we'll be compiling tests in a subdirectory.

3 years agoCygiwn: Detect and use MinGW compilers for testsuite wrappers
Jon Turney [Wed, 28 Oct 2020 19:22:56 +0000 (19:22 +0000)]
Cygiwn: Detect and use MinGW compilers for testsuite wrappers

Drop MINGW_FE, which I can't find any trace of, and instead detect and
use MinGW compilers.

This requires adding AC_CANONICAL_TARGET, to set $target_cpu.

3 years agoCygwin: Define target_builddir autoconf and Makefile variables
Jon Turney [Wed, 28 Oct 2020 19:11:02 +0000 (19:11 +0000)]
Cygwin: Define target_builddir autoconf and Makefile variables

This is now required as cygwin_build is defined in terms of
target_builddir.

(Note that in other subdirectories, the autoconf variable
target_builddir is AC_SUBST-ed as a side-effect of using a macro from
winsup/acinclude.m4, which is perhaps less than ideal)

3 years agoCygwin: Move adding libltp to VPATH after Makefile.common
Jon Turney [Wed, 28 Oct 2020 16:42:09 +0000 (16:42 +0000)]
Cygwin: Move adding libltp to VPATH after Makefile.common

Move adding libltp to the VPATH after Makefile.common, which sets VPATH.

3 years agoCygwin: Avoid 'Makefile.in seems to ignore the --datarootdir setting' warning
Jon Turney [Tue, 3 Nov 2020 14:50:40 +0000 (14:50 +0000)]
Cygwin: Avoid 'Makefile.in seems to ignore the --datarootdir setting' warning

Avoid a 'Makefile.in seems to ignore the --datarootdir setting' warning
when configuring in testsuite directory.

3 years agoCygwin: Add rule to testsuite Makefile to regenerate it when needed
Jon Turney [Mon, 2 Nov 2020 21:53:37 +0000 (21:53 +0000)]
Cygwin: Add rule to testsuite Makefile to regenerate it when needed

3 years agoCygwin: Always configure in testsuite subdirectory
Jon Turney [Wed, 28 Oct 2020 17:02:40 +0000 (17:02 +0000)]
Cygwin: Always configure in testsuite subdirectory

Doing this properly using AC_CONFIG_SUBDIRS is necessary to get the
correct paths in flags given to the compiler specified in CC/CXX.

3 years agoCygwin: Add testsuite directory to autogen.sh
Jon Turney [Mon, 2 Nov 2020 21:45:07 +0000 (21:45 +0000)]
Cygwin: Add testsuite directory to autogen.sh

Also remove unneeded aclocal.m4 for an old aclocal version.

3 years agoCygwin: FIFO: update_my_handlers: fix handle leak
Ken Brown [Fri, 6 Nov 2020 13:16:45 +0000 (08:16 -0500)]
Cygwin: FIFO: update_my_handlers: fix handle leak

This page took 0.078391 seconds and 5 git commands to generate.