]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
15 months agoCygwin: testsuite: Skip devdsp test when no audio devices present
Jon Turney [Sat, 8 Jul 2023 11:50:58 +0000 (12:50 +0100)]
Cygwin: testsuite: Skip devdsp test when no audio devices present

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
15 months agoCygwin: testsuite: Remove const from writable string in fcntl07b
Jon Turney [Sat, 8 Jul 2023 14:28:47 +0000 (15:28 +0100)]
Cygwin: testsuite: Remove const from writable string in fcntl07b

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
15 months agoCygwin: testsuite: Add a simple timeout mechanism
Jon Turney [Tue, 11 Jul 2023 10:17:56 +0000 (11:17 +0100)]
Cygwin: testsuite: Add a simple timeout mechanism

Astonishingly, we don't have this already, so tests which hang just stop
the testsuite dead in it's tracks...

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
15 months agoCygwin: testsuite: Setup test prereqs in 'installation' the tests run in
Jon Turney [Tue, 4 Jul 2023 12:59:14 +0000 (13:59 +0100)]
Cygwin: testsuite: Setup test prereqs in 'installation' the tests run in

Do some setup in the Cygwin 'installation' at testsuite/testinst/:

* Ensure /tmp exists

* Use BusyBox to provide executables needed by tests which use system()
(sh, sleep, ls)

This enables tests which use system(), or require /tmp to exist to pass.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
15 months agonewlib: posix: add HAVE_OPENDIR build condition for [n]ftw.c
Alexey Lapshin [Thu, 13 Jul 2023 09:52:26 +0000 (09:52 +0000)]
newlib: posix: add HAVE_OPENDIR build condition for [n]ftw.c

15 months agoCygwin: Update release/3.4.8 for latest <sys/cpuset.h> commit
Mark Geisert [Thu, 13 Jul 2023 05:36:59 +0000 (22:36 -0700)]
Cygwin: Update release/3.4.8 for latest <sys/cpuset.h> commit

15 months agoCygwin: Make gcc-specific code in <sys/cpuset.h> compiler-agnostic
Mark Geisert [Sun, 9 Jul 2023 07:59:22 +0000 (00:59 -0700)]
Cygwin: Make gcc-specific code in <sys/cpuset.h> compiler-agnostic

The current version of <sys/cpuset.h> cannot be compiled by Clang due to
the use of builtin versions of malloc, free, and memset.  Their presence
here was a dubious optimization anyway, so their usage has been
converted to standard library functions.

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

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

Addresses: https://cygwin.com/pipermail/cygwin/2023-July/253927.html
Fixes: 9cc910dd33a5 (Cygwin: Make <sys/cpuset.h> safe for c89 compilations)
Signed-off-by: Mark Geisert <mark@maxrnd.com>
15 months agoCygwin: fstat(): Fix st_rdev returned by fstat() for /dev/tty.
Takashi Yano [Thu, 6 Jul 2023 21:39:13 +0000 (06:39 +0900)]
Cygwin: fstat(): Fix st_rdev returned by fstat() for /dev/tty.

While st_rdev returned by fstat() for /dev/tty should be FH_TTY,
the current cygwin1.dll returns FH_PTYS+minor or FH_CONS+minor.
Similarly, fstat() does not return correct value for /dev/console,
/dev/conout, /dev/conin or /dev/ptmx.

This patch fixes the issue by:
1) Introduce dev_referred_via in fhandler_termios.
2) Add new argument, which has dev_t value referred by open(),
  for constructors of fhandler_pty_slave and fhandler_pty_master to
  set the value of dev_referred_via.
3) Set st_rdev using dev_referred_via in fhandler_termios::fstat()
  if it is available.

Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
15 months agoCygwin: stat(): Fix "Bad address" error on stat() for /dev/tty.
Takashi Yano [Thu, 6 Jul 2023 21:11:52 +0000 (06:11 +0900)]
Cygwin: stat(): Fix "Bad address" error on stat() for /dev/tty.

As reported in
https://cygwin.com/pipermail/cygwin/2023-June/253888.html,
"Bad address" error occurs when stat() is called after the commit
3721a756b0d8 ("Cygwin: console: Make the console accessible from
other terminals.").

There are two problems in the current code. One is fhandler_console::
fstat() calls get_ttyp()->getsid(). However, fh_alloc() in dtable.cc
omits to initialize the fhandler_console instance when stat() is
called. Due to this, get_ttyp() returns NULL and access violation
occurs. The other problem is fh_alloc() assigns fhandler_console
even if the CTTY is not a console. So the first problem above occurs
even if the CTTY is a pty.

This patch fixes the issue by:
1) Call set_unit() to initialize _tc if the get_ttyp() returns NULL.
2) Assign fhandler_pty_slave for /dev/tty if CTTY is a pty in fh_alloc().

Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible
  from other terminals.").
Fixes: 23771fa1f7028 ("dtable.cc (fh_alloc): Make different decisions
  when generating fhandler for not-opened devices. Add kludge to deal
  with opening /dev/tty.")
Reported-by: Bruce Jerrick <bmj001@gmail.com>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
16 months agoCygwin: Fix latest release message being in the wrong release file.
Corinna Vinschen [Tue, 4 Jul 2023 14:50:00 +0000 (16:50 +0200)]
Cygwin: Fix latest release message being in the wrong release file.

Fixes: 6422e76637d3 ("Cygwin: Make <sys/cpuset.h> safe for c89 compilations")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
16 months agoCygwin: Make <sys/cpuset.h> safe for c89 compilations
Mark Geisert [Tue, 4 Jul 2023 00:51:41 +0000 (17:51 -0700)]
Cygwin: Make <sys/cpuset.h> safe for c89 compilations

Four modifications to include/sys/cpuset.h:
* Change C++-style comments to C-style also supported by C++
* Change "inline" to "__inline" on code lines
* Add "#include <sys/cdefs.h>" to make sure __inline is defined
* Don't declare loop variables on for-loop init clauses

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

Addresses: https://cygwin.com/pipermail/cygwin-patches/2023q3/012308.html
Fixes: 315e5fbd99ec ("Cygwin: Fix type mismatch on sys/cpuset.h")
Signed-off-by: Mark Geisert <mark@maxrnd.com>
16 months agoCygwin: thread: Reset _my_tls.tid if it's pthread_null in init_mainthread().
Takashi Yano [Thu, 22 Jun 2023 15:07:26 +0000 (00:07 +0900)]
Cygwin: thread: Reset _my_tls.tid if it's pthread_null in init_mainthread().

Currently, _my_tls.tid is set to pthread_null if pthread::self()
is called before pthread::init_mainthread(). As a result, pthread::
init_mainthread() does not set _my_tls.tid appropriately. Due to
this, pthread_join() fails in LDAP environment if the program is
the first program which loads cygwin1.dll.

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

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

Reported-by: Mümin A. <muminaydin06@gmail.com>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
16 months agoFor GCC, newlib combined tree, newlib build-tree testing, use standard search paths
Thomas Schwinge [Fri, 14 Apr 2023 19:26:32 +0000 (21:26 +0200)]
For GCC, newlib combined tree, newlib build-tree testing, use standard search paths

For example, for GCC/GCN target (AMD GPUs), target libraries are built
individually per supported hardware ISA ('-march=[...]').  Testing such a
toolchain via, for example:

    $ make RUNTESTFLAGS='--target_board=[...]/-march=gfx90a' check[...]

... does work fine for all 'check-gcc-[...]' as well as GCC-provided target
libraries, 'check-target-[...]'.  Just for 'check-target-newlib', for the
example above, not the '-march=gfx90a' newlib libraries are linked in, but
instead always the default ones, which results in link FAILure.  This is cured
simply by skipping use of 'newlib/testsuite/lib/flags.exp', so that the
standard search paths as determined by GCC, DejaGnu are used for newlib, too.

16 months agoMake SIG2STR_MAX usable in #if
Mingye Wang [Wed, 21 Jun 2023 12:11:57 +0000 (20:11 +0800)]
Make SIG2STR_MAX usable in #if

The text accepted for POSIX issue 8 requires that SIG2STR_MAX be usable
in #if, which we currently break with sizeof. Use static values instead.

16 months agofhandler/proc.cc: use wincap.has_user_shstk
Brian Inglis [Mon, 19 Jun 2023 18:15:19 +0000 (12:15 -0600)]
fhandler/proc.cc: use wincap.has_user_shstk

In test for AMD/Intel Control flow Enforcement Technology user mode
shadow stack support replace Windows version tests with test of wincap
member addition has_user_shstk with Windows version dependent value

Fixes: 41fdb869f998 ("fhandler/proc.cc(format_proc_cpuinfo): Add Linux 6.3 cpuinfo")
Signed-off-by: Brian Inglis <Brian.Inglis@Shaw.ca>
16 months agowincap.cc: set wincap member has_user_shstk true for 2004+
Brian Inglis [Mon, 19 Jun 2023 18:15:18 +0000 (12:15 -0600)]
wincap.cc: set wincap member has_user_shstk true for 2004+

Signed-off-by: Brian Inglis <Brian.Inglis@Shaw.ca>
16 months agowincap.h: add wincap member has_user_shstk
Brian Inglis [Mon, 19 Jun 2023 18:15:17 +0000 (12:15 -0600)]
wincap.h: add wincap member has_user_shstk

Indicate support of user mode hardware-enforced shadow stack

Signed-off-by: Brian Inglis <Brian.Inglis@Shaw.ca>
16 months agoCygwin: use new XATTR_{NAME,SIZE}_MAX instead of MAX_EA_{NAME,VALUE}_LEN
Philippe Cerfon [Tue, 6 Jun 2023 00:52:49 +0000 (02:52 +0200)]
Cygwin: use new XATTR_{NAME,SIZE}_MAX instead of MAX_EA_{NAME,VALUE}_LEN

Signed-off-by: Philippe Cerfon <philcerf@gmail.com>
16 months agoCygwin: export XATTR_{NAME,SIZE,LIST}_MAX
Philippe Cerfon [Tue, 30 May 2023 11:16:18 +0000 (13:16 +0200)]
Cygwin: export XATTR_{NAME,SIZE,LIST}_MAX

These are used for example by CPython.

Signed-off-by: Philippe Cerfon <philcerf@gmail.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
16 months agoDo not rely on `getenv ("HOME")`'s path conversion
Johannes Schindelin [Mon, 22 May 2023 11:13:02 +0000 (13:13 +0200)]
Do not rely on `getenv ("HOME")`'s path conversion

In the very early code path where `dll_crt0_1 ()` calls
`user_shared->initialize ()`, the Cygwin runtime calls `internal_pwsid ()`
to initialize the user name in preparation for reading the `fstab` file.

In case `db_home: env` is defined in `/etc/nsswitch.conf`, we need to
look at the environment variable `HOME` and use it, if set.

When all of this happens, though, the `pinfo_init ()` function has had no
chance to run yet (and therefore, `environ_init ()`). At this stage,
therefore, `getenv ()`'s `findenv_func ()` call still finds `getearly ()`
and we get the _verbatim_ value of `HOME`. That is, the Windows form.
But we need the "POSIX" form.

To add insult to injury, later calls to `getpwuid (getuid ())` will
receive a cached version of the home directory via
`cygheap->pg.pwd_cache.win.find_user ()` thanks to the first
`internal_pwsid ()` call caching the result via
`add_user_from_cygserver ()`, read: we will never receive the converted
`HOME` but always the Windows variant.

So, contrary to the assumptions made in 27376c60a9 (Allow deriving the
current user's home directory via the HOME variable, 2023-03-28), we
cannot assume that `getenv ("HOME")` returned a "POSIX" path.

This is a real problem. Even setting aside that common callers of
`getpwuid ()` (such as OpenSSH) are unable to handle Windows paths in the
`pw_dir` attribute, the Windows path never makes it back to the caller
unscathed. The value returned from `fetch_home_env ()` is not actually
used as-is. Instead, the `fetch_account_from_windows ()` method uses it
to write a pseudo `/etc/passwd`-formatted line that is _then_ parsed via
the `pwdgrp::parse_passwd ()` method which sees no problem with
misinterpreting the colon after the drive letter as a field separator of
that `/etc/passwd`-formatted line, and instead of a Windows path, we now
have a mere drive letter.

Let's detect when the `HOME` value is still in Windows format in
`fetch_home_env ()`, and convert it in that case.

For good measure, interpret this "Windows format" not only to include
absolute paths with drive prefixes, but also UNC paths.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 months agouinfo: special-case IIS APPPOOL accounts
Johannes Schindelin [Mon, 22 May 2023 11:12:56 +0000 (13:12 +0200)]
uinfo: special-case IIS APPPOOL accounts

The account under which Azure Web Apps run is an IIS APPOOL account that
is generated on the fly.

These are special because the virtual machines on which thes Apps run
are not domain-joined, yet the accounts are domain accounts.

To support the use case where such a Web App needs to call `ssh` (e.g.
to deploy from a Git repository that is accessible only via SSH), we do
need OpenSSH's `getpwuid (getuid ())` invocation to work.

But currently it does not. Concretely, `getuid ()` returns -1 for these
accounts, and OpenSSH fails to find the correct home directory
(_especially_ when that home directory was overridden via a `db_home:
env` line in `/etc/nsswitch.conf`).

This can be verified e.g. in a Kudu console (for details about Kudu
consoles, see https://github.com/projectkudu/kudu/wiki/Kudu-console):
the domain is `IIS APPPOOL`, the account name is the name of the Azure
Web App, the SID starts with 'S-1-5-82-`, and
`pwdgrp::fetch_account_from_windows()` runs into the code path where
"[...] the domain returned by LookupAccountSid is not our machine name,
and if our machine is no domain member, we lose.  We have nobody to ask
for the POSIX offset."

Since these IIS APPPOOL accounts are relatively similar to AzureAD
accounts in this scenario, let's imitate the latter to support also the
former.

Reported-by: David Ebbo <david.ebbo@gmail.com>
Helped-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
17 months agoCygwin: pty: Additional fix for transferring input at exit.
Takashi Yano [Fri, 2 Jun 2023 01:19:18 +0000 (10:19 +0900)]
Cygwin: pty: Additional fix for transferring input at exit.

The commit 9fc746d17dc3 does not fix transferring input at exit
appropriately. If the more than one non-cygwin apps are executed
simultaneously and one of them is terminated, the pty master failed
to send input to the other non-cygwin apps. This patch fixes that.

Fixes: 9fc746d17dc3 ("Cygwin: pty: Fix transferring type-ahead input between input pipes.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
17 months agoCygwin: pty: Fix transferring type-ahead input between input pipes.
Takashi Yano [Thu, 1 Jun 2023 10:44:41 +0000 (19:44 +0900)]
Cygwin: pty: Fix transferring type-ahead input between input pipes.

After the commit e5fcc5837c95, transferring type-ahead input between
the pipe for cygwin app and the pipe for non-cygwin app will not be
done appropriately when the stdin of the non-cygwin app is not pty.
Due to this issue, sometimes the keyboard input might be lost which
should be sent to cygwin app. This patch fixes the issue.

Fixes: e5fcc5837c95 ("Cygwin: pty: Fix reading CONIN$ when stdin is not a pty.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
17 months agoconfig/mt-d30v: Append flags
Chris Packham [Sun, 28 May 2023 03:05:45 +0000 (15:05 +1200)]
config/mt-d30v: Append flags

Append to CFLAGS_FOR_TARGET/CXXFLAGS_FOR_TARGET rather than replacing
them.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
17 months agom68k: disallow unaligned access for m68010 and m68020
Remy Bohmer [Sun, 28 May 2023 03:05:44 +0000 (15:05 +1200)]
m68k: disallow unaligned access for m68010 and m68020

Disable at least  m68010 and m68020. These processors certainly do not
like unaligned accesses.

Signed-off-by: Remy Bohmer <linux@bohmer.net>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Signed-off-by: Austin Morton <austinpmorton@gmail.com>
Signed-off-by: Chris Packham <judge.packham@gmail.com>
17 months agoCygwin: Adjust CWD magic to accommodate for the latest Windows previews
Johannes Schindelin [Mon, 22 May 2023 11:36:27 +0000 (13:36 +0200)]
Cygwin: Adjust CWD magic to accommodate for the latest Windows previews

Reportedly Windows 11 build 25*** from Insider changed the current
working directory logic a bit, and Cygwin's "magic" (or:
"technologically sufficiently advanced") code needs to be adjusted
accordingly.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
17 months agofix __time_load_locale return code
Alexey Lapshin [Wed, 17 May 2023 21:44:57 +0000 (17:44 -0400)]
fix __time_load_locale return code

- add explicit __HAVE_LOCALE_INFO__ check

17 months agoRegenerated source for adding non LDBL_EQ_DBL
Jennifer Averett [Fri, 5 May 2023 18:39:18 +0000 (13:39 -0500)]
Regenerated source for adding non LDBL_EQ_DBL

17 months agonewlib: Add non LDBL_EQ_DBL math support for aarch64, i386, and x86_64
Jennifer Averett [Fri, 5 May 2023 18:39:17 +0000 (13:39 -0500)]
newlib: Add non LDBL_EQ_DBL math support for aarch64, i386, and x86_64

    Rename s_nearbyint.c, s_fdim.c and s_scalbln.c to remove conflicts
    Remove functions that are not needed from above files
    Modify include paths
    Add includes missing in cygwin build
    Add missing types
    Create Makefiles
    Create header files to resolve dependencies between directories
    Modify some instances of unsigned long to uint64_t for 32 bit platforms
    Add HAVE_FPMATH_H

17 months agonewlib: Add FreeBSD files for non LDBL_EQ_DBL support
Jennifer Averett [Fri, 5 May 2023 18:39:16 +0000 (13:39 -0500)]
newlib: Add FreeBSD files for non LDBL_EQ_DBL support

FreeBSD files to add long double support for i386,
aarch64 and x86_64.

17 months agofhandler/proc.cc(format_proc_cpuinfo): Add Linux 6.3 cpuinfo
Brian Inglis [Mon, 8 May 2023 03:12:10 +0000 (21:12 -0600)]
fhandler/proc.cc(format_proc_cpuinfo): Add Linux 6.3 cpuinfo

cpuid    0x00000007:0 ecx:7 shstk Shadow Stack support & Windows [20]20H1/[20]2004+
    => user_shstk User mode program Shadow Stack support
AMD SVM  0x8000000a:0 edx:25 vnmi virtual Non-Maskable Interrrupts
Sync AMD 0x80000008:0 ebx flags across two output locations

17 months agoRegenerated source for moving signgam.c
Jennifer Averett [Fri, 5 May 2023 18:17:42 +0000 (13:17 -0500)]
Regenerated source for moving signgam.c

17 months agoMove signgm.c from libc/reent to libm/math
Jennifer Averett [Fri, 5 May 2023 18:17:41 +0000 (13:17 -0500)]
Move signgm.c from libc/reent to libm/math

18 months agoCygwin: Fix compiling with w32api-headers v11.0.0
Biswapriyo Nath [Sat, 29 Apr 2023 18:33:21 +0000 (00:03 +0530)]
Cygwin: Fix compiling with w32api-headers v11.0.0

This solves redefinition of FILE_CS_FLAG_CASE_SENSITIVE_DIR in winnt.h
and fixes the following compiler errors

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

18 months agoCygwin: doc: Upate a link from gitweb to cgit
Jon Turney [Sat, 11 Mar 2023 21:52:52 +0000 (21:52 +0000)]
Cygwin: doc: Upate a link from gitweb to cgit

Also, reword 'considerable patch' to be more idomatic.

18 months agoFix _REENT_EMERGENCY() if TLS is enabled
Sebastian Huber [Wed, 26 Apr 2023 06:23:04 +0000 (08:23 +0200)]
Fix _REENT_EMERGENCY() if TLS is enabled

If the thread-local storage (TLS) support was enabled, the _REENT_EMERGENCY()
object had the wrong size.  It must be a buffer of length _REENT_EMERGENCY_SIZE
and not just a single character.

18 months agoCygwin: locales: drop unused has_modifier macro
Corinna Vinschen [Mon, 24 Apr 2023 20:40:54 +0000 (22:40 +0200)]
Cygwin: locales: drop unused has_modifier macro

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: locales: ignore @cjkwide and @cjksingle just like @cjknarrow
Corinna Vinschen [Mon, 24 Apr 2023 20:40:00 +0000 (22:40 +0200)]
Cygwin: locales: ignore @cjkwide and @cjksingle just like @cjknarrow

When the @cjkwide and @cjksingle modifiers have been added, the
patches missed to add checks for the new modifiers in the Cygwin
locale code.  Along the same lines, commit c3e7f7609e46 forgot to
add a test for @cjksingle.

Merge check for cjk* modifiers into a macro set andf use that
throughout. Fix comments.

Fixes: f92f048528e6f ("Locale modifier @cjkwide to adjust ambiguous-width in non-CJK locales")
Fixes: c8204b106988f ("Locale modifier "@cjksingle" to enforce single-width CJK width.")
Fixes: c3e7f7609e46 ("Cygwin: locales: fix behaviour for @cjk* and @euro locales")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoRTEMS: Add __m68k_read_tp() to crt0.c
Sebastian Huber [Mon, 24 Apr 2023 08:20:59 +0000 (10:20 +0200)]
RTEMS: Add __m68k_read_tp() to crt0.c

This is required to build libgomp.

18 months agoCygwin: posix_spawnp: don't fallback to sh
Corinna Vinschen [Wed, 19 Apr 2023 19:04:49 +0000 (21:04 +0200)]
Cygwin: posix_spawnp: don't fallback to sh

Per the discussion starting with
https://cygwin.com/pipermail/cygwin/2023-April/253495.html
stop falling back to sh if the file given to posix_spawnp
is no executable.

This is not necessarily the last word on it, given
https://www.austingroupbugs.net/view.php?id=1674, but for now,
opt for following the proposal in the Austin Group bug entry,
as well as PASSing the GNULIB test-posix_spawnp-script test.

Fixes: c7c1a1ca1b33 ("Add support for new posix_spawn function.")
Fixes: 3fbfcd11fb09 ("Cygwin: posix_spawn: add Cygwin-specific code fixing process synchronisation")
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoposix_spawn_file_actions_addfchdir_np: return EBADF on negative fd
Corinna Vinschen [Wed, 19 Apr 2023 18:48:14 +0000 (20:48 +0200)]
posix_spawn_file_actions_addfchdir_np: return EBADF on negative fd

FreeBSD and Musl implement posix_spawn_file_actions_addfchdir_np
so that it checks the incoming descriptor for being negative, and,
if so, return with EBADF.  The POSIX proposal defining
posix_spawn_file_actions_addfchdir follows this behaviour, see
https://www.austingroupbugs.net/view.php?id=1208

Fixes: 7e03fc35f528 ("Add posix_spawn_file_actions_add{f}chdir_np")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: mbrtowi: fix segfault when pwi is NULL
David McFarland [Tue, 18 Apr 2023 20:05:34 +0000 (17:05 -0300)]
Cygwin: mbrtowi: fix segfault when pwi is NULL

mbrtowi was missing null-checks on pwi, but NULL is passed from
regex/engine.c:173.

In a git repo with sendemail.smtpserver set, this results in a segfault when
using git-send-email, which calls:

git config --get-regexp '^sende?mail[.]'

Fixes: 60c25da90d01 ("Cygwin: mbrtowi: define replacement for mbrtowc, returning UTF-32 value")
Signed-off-by: David McFarland <corngood@gmail.com>
18 months agoCygwin: Export posix_spawn_file_actions_add{f}chdir_np
Corinna Vinschen [Tue, 18 Apr 2023 22:34:36 +0000 (00:34 +0200)]
Cygwin: Export posix_spawn_file_actions_add{f}chdir_np

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoAdd posix_spawn_file_actions_add{f}chdir_np
Corinna Vinschen [Tue, 18 Apr 2023 21:47:28 +0000 (23:47 +0200)]
Add posix_spawn_file_actions_add{f}chdir_np

These are defined as _np functions and available in glibc, musl, macOS,
FreeBSD, Solaris ≥ 11.3

They are likely to be standardized without the _np suffix as a result of
Austin Group issue 1208. if so, both names will be kept as aliases.

Introduce HAVE_CHDIR and HAVE_FCHDIR to allow building on systems not
providing these calls.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: align renameat2 to Linux behaviour
Corinna Vinschen [Tue, 18 Apr 2023 16:18:27 +0000 (18:18 +0200)]
Cygwin: align renameat2 to Linux behaviour

In contrast to rename default behaviour, Linux' renameat2 returns -1
with errno set to EEXIST, if oldfile and newfile refer to the same
file, and the RENAME_NOREPLACE flag is set.

Follow suit, given this is a Linux-only function anyway.

Fixes: f665b1cef30f ("cygwin: Implement renameat2")
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: fix errno values set by readlinkat
Corinna Vinschen [Tue, 18 Apr 2023 11:52:50 +0000 (13:52 +0200)]
Cygwin: fix errno values set by readlinkat

readlinkat(fd, "", ...) is supposed to return ENOENT per POSIX,
but Cygwin returns EBADF.

At the same time, we have to maintain the special feature of
glibc that readlinkat(fd, "", ...) operates on fd, if fd is pointing
at a symlink opened with O_PATH|O_NOFOLLOW.

And, while fixing that, readlinkat(fd, path, ...) *still* has to set errno
to EBADF, if fd is an invalid descriptor *and* path is a relative path.

This required to change the evaluation order in the helper function
gen_full_path_at.

Last but not least, in case of the aforementioned glibc-like special
handling for symlink descriptors, we have to make sure that errors from
gen_full_path_at are not spilled into that special handling.

Fixes: 6cc05784e16a ("Cygwin: readlinkat: allow pathname to be empty")
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: fix return value of ilogbl(NaN)
Corinna Vinschen [Tue, 18 Apr 2023 11:43:06 +0000 (13:43 +0200)]
Cygwin: fix return value of ilogbl(NaN)

Fixes: 792e51b72149 ("Add missing long double functions to Cygwin")
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: add release text for previous commit
Corinna Vinschen [Tue, 18 Apr 2023 08:12:03 +0000 (10:12 +0200)]
Cygwin: add release text for previous commit

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: cygheap: fix fork error after heap has grown
David McFarland [Tue, 18 Apr 2023 00:41:55 +0000 (21:41 -0300)]
Cygwin: cygheap: fix fork error after heap has grown

2f9b8ff0 introduced a problem where forks would sometimes fail with:

child_copy: cygheap read copy failed, 0x0..0x80044C750, done 0, windows pid 14032, Win32 error 299

When cygheap_max was > CYGHEAP_STORAGE_INITIAL, commit_size would be set to
allocsize(cygheap_max), which is an address, not a size.  VirtualAlloc would be
called to commit commit_size bytes, which would fail, and then child_copy would
be called with zero as the base address.

Fixes: 2f9b8ff00cce ("Cygwin: decouple cygheap from Cygwin DLL")
Signed-off-by: David McFarland <corngood@gmail.com>
18 months agoCygwin: pty: Fix reading CONIN$ when stdin is not a pty.
Takashi Yano [Fri, 14 Apr 2023 01:52:08 +0000 (10:52 +0900)]
Cygwin: pty: Fix reading CONIN$ when stdin is not a pty.

Previously, the pty master sends inputs to the pipe for cygwin app
even when pseudo console is activated if stdin is not the pty.
This causes the problem that key input is not sent to non cygwin
app even if the app opens CONIN$. This patch sets switch_to_nat_pipe
to true regardless whether stdin is the pty or not to allow that case.

https://cygwin.com/pipermail/cygwin/2023-April/253424.html

Reported-by: Wladislav Artsimovich <cygwin@frost.kiwi>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
18 months agoReplace always true if with else
Andoni Arregi [Wed, 12 Apr 2023 15:34:45 +0000 (17:34 +0200)]
Replace always true if with else

18 months agoCompare j as unsigned
Andoni Arregi [Wed, 12 Apr 2023 15:34:44 +0000 (17:34 +0200)]
Compare j as unsigned

j is int32_t and thus j<<31 is undefined if j==1.

Taken from FreeBSD commit bdd8abc6d6a93ce3ab8ad5db716222ee3110c4a3

18 months agoFix x close to 1, y between 2^31 and 2^64
Andoni Arregi [Wed, 12 Apr 2023 15:34:43 +0000 (17:34 +0200)]
Fix x close to 1, y between 2^31 and 2^64

E.g. known errors:
x = 0x1.000002c5e2e99p+0, y = 0x1.c9eee35374af6p+31 had an error of 639
ULP and is now correctly rounded.
x = 0x1.fffffd2e3e669p-1, y = 0x1.344c9823eb66cp+32 had an error of 428
ULP and is now correctly rounded.

18 months agoFix missing sign for overflow/underflow where x is negative and y is large odd integer
Andoni Arregi [Wed, 12 Apr 2023 15:34:42 +0000 (17:34 +0200)]
Fix missing sign for overflow/underflow where x is negative and y is large odd integer

19 months agoCygwin: chattr: fix description of requirements for casesensitive directories
Corinna Vinschen [Mon, 3 Apr 2023 20:41:07 +0000 (22:41 +0200)]
Cygwin: chattr: fix description of requirements for casesensitive directories

Preconditions of WSL or empty directories dependent on Windows
versions was totally screwed up.  Drop the description from
--help, describe the preconditions for case-sensitive dirs in the
man page instead.

Fixes: fc6e89c937c1 ("Cygwin: chattr: clarify requirements for casesensitive directories")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoRespect `db_home` setting even for SYSTEM/Microsoft accounts
Johannes Schindelin [Mon, 3 Apr 2023 14:45:03 +0000 (16:45 +0200)]
Respect `db_home` setting even for SYSTEM/Microsoft accounts

We should not blindly set the home directory of the SYSTEM account (or
of Microsoft accounts) to `/home/<name>`, especially
`/etc/nsswitch.conf` defines `db_home: env`, in which case we want to
respect the `HOME` variable.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
19 months agoBump newlib version in the manual to 4.3.0
Tobias Burnus [Thu, 30 Mar 2023 09:09:33 +0000 (11:09 +0200)]
Bump newlib version in the manual to 4.3.0

While commit 9e09d6ed8 (tag: newlib-4.3.0) bumped the newlib version to 4.3.0,
this commit updates the version/date in the libc/libm manuals to match.

19 months agoCygwin: doc: fix description of new "env" schema for /etc/nsswitch.conf
Corinna Vinschen [Wed, 29 Mar 2023 08:34:30 +0000 (10:34 +0200)]
Cygwin: doc: fix description of new "env" schema for /etc/nsswitch.conf

Fixes: 27376c60a9b8 ("Allow deriving the current user's home directory via the HOME variable")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: dirname: fix handling of leading slashes
Corinna Vinschen [Wed, 29 Mar 2023 08:18:23 +0000 (10:18 +0200)]
Cygwin: dirname: fix handling of leading slashes

Per https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/xbd_chap04.html:

  "A pathname that begins with two successive slashes may be interpreted
   in an implementation-defined manner, although more than two leading
   slashes shall be treated as a single slash."

So more than 2 leading slashes are supposed to be folded into one,
which our dirname neglected.  Fix that.

Fixes: 24e8fc6872a3b ("* cygwin.din (basename): Export.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoAllow deriving the current user's home directory via the HOME variable
Johannes Schindelin [Tue, 28 Mar 2023 08:17:14 +0000 (10:17 +0200)]
Allow deriving the current user's home directory via the HOME variable

This patch hails from Git for Windows (where the Cygwin runtime is used
in the form of a slightly modified MSYS2 runtime), where it is a
well-established technique to let the `$HOME` variable define where the
current user's home directory is, falling back to `$HOMEDRIVE$HOMEPATH`
and `$USERPROFILE`.

The idea is that we want to share user-specific settings between
programs, whether they be Cygwin, MSYS2 or not.  Unfortunately, we
cannot blindly activate the "db_home: windows" setting because in some
setups, the user's home directory is set to a hidden directory via an
UNC path (\\share\some\hidden\folder$) -- something many programs
cannot handle correctly, e.g. `cmd.exe` and other native Windows
applications that users want to employ as Git helpers.

The established technique is to allow setting the user's home directory
via the environment variables mentioned above: `$HOMEDRIVE$HOMEPATH` or
`$USERPROFILE`.  This has the additional advantage that it is much
faster than querying the Windows user database.

Of course this scheme needs to be opt-in.  For that reason, it needs
to be activated explicitly via `db_home: env` in `/etc/nsswitch.conf`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
19 months agoCygwin: chattr: clarify requirements for casesensitive directories
Corinna Vinschen [Mon, 27 Mar 2023 18:39:26 +0000 (20:39 +0200)]
Cygwin: chattr: clarify requirements for casesensitive directories

- Windows 10 requires WSL
- Windows 11 only allows enabling casesensitivity if dir is empty

Fixes: 0d4b39d37b966 ("Cygwin: Add lsattr and chattr tools")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: /proc/locales: filter out useless explicit utf8 locales
Corinna Vinschen [Sun, 26 Mar 2023 12:12:13 +0000 (14:12 +0200)]
Cygwin: /proc/locales: filter out useless explicit utf8 locales

Fixes: c42b98bdc665f ("Cygwin: introduce /proc/codesets and /proc/locales")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: locales: fix behaviour for @euro locales
Corinna Vinschen [Sun, 26 Mar 2023 11:06:38 +0000 (13:06 +0200)]
Cygwin: locales: fix behaviour for @euro locales

Latest Windows supports more EU locales than GLibc, so some of the
@euro locales are not covered by checking the GLibc locale defaults.
Those locales have no long history, they are all UTF-8.  So just
check for @euro in the UTF-8 case and set them to ISO-8859-15.

Fixes: 2483e54be852e ("Cygwin: locale: Set default charset from Linux locale -> codeset mapping")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: locales: fix behaviour for @cjk* and @euro locales
Corinna Vinschen [Sun, 26 Mar 2023 11:01:52 +0000 (13:01 +0200)]
Cygwin: locales: fix behaviour for @cjk* and @euro locales

@cjknarrow and @cjkwide modifiers are newlib only, so they need
some tweaking in __set_charset_from_locale.

Fixes: 2483e54be852e ("Cygwin: locale: Set default charset from Linux locale -> codeset mapping")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: /proc/locales: use ENCODING_LEN to define array sizes
Corinna Vinschen [Sun, 26 Mar 2023 10:52:32 +0000 (12:52 +0200)]
Cygwin: /proc/locales: use ENCODING_LEN to define array sizes

Fixes: c42b98bdc665f ("Cygwin: introduce /proc/codesets and /proc/locales")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: /proc/locales: use modifier when checking default codeset
Corinna Vinschen [Sun, 26 Mar 2023 10:50:57 +0000 (12:50 +0200)]
Cygwin: /proc/locales: use modifier when checking default codeset

Drop usage of newlocale/nl_langinfo_l/freelocale.
Call __set_charset_from_locale instead, and make sure to call it
with modifier, if any, otherwise suffer wrong results.

Fixes: c42b98bdc665f ("Cygwin: introduce /proc/codesets and /proc/locales")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: locales: fix return value check of ResolveLocaleName
Corinna Vinschen [Sat, 25 Mar 2023 21:48:00 +0000 (22:48 +0100)]
Cygwin: locales: fix return value check of ResolveLocaleName

ResolveLocaleName does not simply return an error value if it
can't resolve a locale.  Rather, it returns an empty string and
the length of this string: 1.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoRevert "Cygwin: locales: drop supporting iso639 strings as valid locales"
Corinna Vinschen [Sat, 25 Mar 2023 21:28:25 +0000 (22:28 +0100)]
Revert "Cygwin: locales: drop supporting iso639 strings as valid locales"

This reverts commit 15898b95881b1fa504e671e0bcfd653b242effa8.

The idea behind this patch was wrong.  Systems are supposed to
support iso639-only strings as settings for the locale environment
variables, and they are not necessarily available in the
/usr/share/locale/locale.alias file.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: locales: implement own method to check locale validity
Corinna Vinschen [Fri, 24 Mar 2023 11:43:47 +0000 (12:43 +0100)]
Cygwin: locales: implement own method to check locale validity

The Windows function ResolveLocaleName is next to useless to
convert a partial locale identifier into a full, supported
locale identifier.  It converts anything which vaguely resembles
a locale into some other locale it supports.

Bad examples are:
  "en-XY" gets converted to "en-US", and worse,
  "ff-BF" gets converted to "ff-Latn-SN", even though "ff-Adlm-BF"
  exists!

To check if a locale is supported, we have to enumerate all valid
Windows locales, and return the match, even if the locale in Windows
requires a script.  Implement resolve_locale_name() as replacement
function for ResolveLocaleName.

Fixes: e95a7a795522 ("Cygwin: convert Windows locale handling from LCID to ISO5646 strings")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: locales: drop supporting iso639 strings as valid locales
Corinna Vinschen [Fri, 24 Mar 2023 11:43:30 +0000 (12:43 +0100)]
Cygwin: locales: drop supporting iso639 strings as valid locales

This was incorrect behaviour.  The only valid way to support those
is by adding them to /usr/share/locale/locale.alias.

Fixes: e95a7a795522 ("Cygwin: convert Windows locale handling from LCID to ISO5646 strings")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: locales: set errno to ENOENT if locale is invalid
Corinna Vinschen [Fri, 24 Mar 2023 11:42:34 +0000 (12:42 +0100)]
Cygwin: locales: set errno to ENOENT if locale is invalid

This allows newlocale to return with a valid errno if the
locale is invalid.

Fixes: e95a7a795522 ("Cygwin: convert Windows locale handling from LCID to ISO5646 strings")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: /proc/locales: fix "sr" locales
Corinna Vinschen [Fri, 24 Mar 2023 10:50:42 +0000 (11:50 +0100)]
Cygwin: /proc/locales: fix "sr" locales

The sr_XY locales are supposed to default to cyrillic, but the code
always attached a @cyrillic, same reason as in the previous commit.

Special case "sr" further to workaround that issue.

Fixes: c42b98bdc665 ("Cygwin: introduce /proc/codesets and /proc/locales")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: /proc/locales: fix sd_IN locale
Corinna Vinschen [Fri, 24 Mar 2023 10:47:23 +0000 (11:47 +0100)]
Cygwin: /proc/locales: fix sd_IN locale

Due to the way locales are evaluated in Windows, we can't ask for
the script of the "sd-IN" locale, because Windows only knows the
"sd-Deva-IN" locale.  So asking for the script of the "sd" locale
returns "Arab;", because "sd" is converted to "sd-Arab-PK".

Special case "sd-IN" to workaround that issue.

Fixes: c42b98bdc665 ("Cygwin: introduce /proc/codesets and /proc/locales")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agonewlocale: set errno to ENOENT if __loadlocale fails
Corinna Vinschen [Fri, 24 Mar 2023 09:51:31 +0000 (10:51 +0100)]
newlocale: set errno to ENOENT if __loadlocale fails

__loadlocale never sets errno, but newlocale is supposed to
return ENOENT if the locale isn't valid.

Fixes: aefd8b5b518b ("Implement newlocale, freelocale, duplocale, uselocale")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: log disabling posix semantics
Yoshinao Muramatsu [Mon, 20 Mar 2023 11:51:02 +0000 (20:51 +0900)]
Cygwin: log disabling posix semantics

Add log when workaround occurs

Signed-off-by: Yoshinao Muramatsu <ysno@ac.auone-net.jp>
19 months agoCygwin: fix rename in container
Yoshinao Muramatsu [Mon, 20 Mar 2023 11:51:01 +0000 (20:51 +0900)]
Cygwin: fix rename in container

Renaming files returns STATUS_INVALID_PARAMETE on a bind mounted file system
in hyper-v container with FILE_RENAME_POSIX_SEMANTICS.

Disable the use_posix_semantics flag and retry.

Signed-off-by: Yoshinao Muramatsu <ysno@ac.auone-net.jp>
19 months agoCygwin: fix unlink in container
Yoshinao Muramatsu [Mon, 20 Mar 2023 11:51:00 +0000 (20:51 +0900)]
Cygwin: fix unlink in container

Deleting files returns STATUS_INVALID_PARAMETE on a bind mounted file system
in hyper-v container with FILE_DISPOSITION_POSIX_SEMANTICS.
Therefore fall back to default method.

This code is suggested by Johannes Schindelin on github
and I change it more simple.

Signed-off-by: Yoshinao Muramatsu <ysno@ac.auone-net.jp>
19 months agoCygwin: don't use unlink/rename POSIX semantics on certain NTFS
Corinna Vinschen [Tue, 21 Mar 2023 17:29:59 +0000 (18:29 +0100)]
Cygwin: don't use unlink/rename POSIX semantics on certain NTFS

If a host NTFS is mapped into a Hyper-V isolated container, the
OPEN_BY_FILE_ID filesystem flag is missing, just as if that NTFS
is a remote drive.  However, NtQueryVolumeInformationFile claims
the drive is a local drive.

We can use this fact to learn that the process is running under
Hyper-V, and that the Hyper-V isolated process can't use rename/unlink
with POSIX semantics.  Strange enough, the POSIX_UNLINK_RENAME filesystem
flag is still set...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: fs_info::update: fix NTFS filesystem flags
Corinna Vinschen [Tue, 21 Mar 2023 17:01:00 +0000 (18:01 +0100)]
Cygwin: fs_info::update: fix NTFS filesystem flags

These flags are used to check a remote filesystem.  Not all
flags supported by a local NTFS are available when checking
a remote NTFS.  Fix the flag set accordingly, otherwise
the remote NTFS will ba handled as CIFS.

Fixes: fcccdc4021ff ("Cygwin: fs_info: update filesystem flags and check Windows 7 flags")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: regex: fix faulty check for valid range expression
Corinna Vinschen [Thu, 16 Mar 2023 20:09:53 +0000 (21:09 +0100)]
Cygwin: regex: fix faulty check for valid range expression

Except for the "C" or "POSIX" locale, checking for start <= finish
is always wrong.  Range start must be <= range finish in terms of the
locale's collating order.  So make sure to call always wcscoll(), even
in the "C"/"POSIX" locale, which makes wcscoll equivalent to wcscmp
anyway.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: regex: fix freeing g->charjump in low memory condition
Corinna Vinschen [Thu, 16 Mar 2023 20:52:48 +0000 (21:52 +0100)]
Cygwin: regex: fix freeing g->charjump in low memory condition

computejumps() moves g->charjump to a position relativ to the value of
CHAR_MIN.  As such, g->charjump doesn't necessarily point to the address
actually allocated.  While regfree() takes that into account, the low
memory handling in regcomp_internal() doesn't.  Fix that by free'ing
the actually allocated address, as in regfree().

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: unlink: drop unlink_nt/unlink_nt_shareable wrappers
Corinna Vinschen [Mon, 20 Mar 2023 11:23:36 +0000 (12:23 +0100)]
Cygwin: unlink: drop unlink_nt/unlink_nt_shareable wrappers

Useless indirection.  Rename _unlink_nt back to unlink_nt
and call the function directly with `sharable' flag as needed.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: fs_info: update filesystem flags and check Windows 7 flags
Corinna Vinschen [Mon, 20 Mar 2023 11:22:07 +0000 (12:22 +0100)]
Cygwin: fs_info: update filesystem flags and check Windows 7 flags

Update the list of filesystem flags to the flags supported since
Windows 7.  Make sure to use the new flags only with Windows
filesystems, not with 3rd party filesystems.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: add support for GB18030 codeset
Corinna Vinschen [Thu, 16 Mar 2023 17:25:09 +0000 (18:25 +0100)]
Cygwin: add support for GB18030 codeset

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: regex: NONCHAR: re-add cast to int
Corinna Vinschen [Thu, 16 Mar 2023 12:47:07 +0000 (13:47 +0100)]
Cygwin: regex: NONCHAR: re-add cast to int

wint_t is unsigned int and the test checks for a negative value.  Thus,
it's optimized out by gcc.  Add the cast from commit 44caccfca2433 to
avoid this.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: regex: wgetnext: Re-add kludge to be more glibc compatible
Corinna Vinschen [Thu, 16 Mar 2023 11:44:32 +0000 (12:44 +0100)]
Cygwin: regex: wgetnext: Re-add kludge to be more glibc compatible

Add comment to explain.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: regex: convert wchar_t to wint_t throughout
Corinna Vinschen [Thu, 16 Mar 2023 10:52:21 +0000 (11:52 +0100)]
Cygwin: regex: convert wchar_t to wint_t throughout

...and use __wcollate_range_cmp.  This will have to be tweaked further
when supporting collation symbols...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: regex: fix build errors
Corinna Vinschen [Thu, 16 Mar 2023 10:20:11 +0000 (11:20 +0100)]
Cygwin: regex: fix build errors

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: replace regex with latest verbatim FreeBSD version
Corinna Vinschen [Thu, 16 Mar 2023 10:12:08 +0000 (11:12 +0100)]
Cygwin: replace regex with latest verbatim FreeBSD version

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: kill(1): Add -L to documentation
Corinna Vinschen [Wed, 15 Mar 2023 21:05:44 +0000 (22:05 +0100)]
Cygwin: kill(1): Add -L to documentation

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: kill(1): Align list options to latest Linux kill(1)
Corinna Vinschen [Wed, 15 Mar 2023 20:59:04 +0000 (21:59 +0100)]
Cygwin: kill(1): Align list options to latest Linux kill(1)

- Don't print all RT signals, just the allowed patterns
- Add -L/--table option to print a table of signals with signal
  numbers

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: kill(1): align real-time signal naming to Linux kill(1)
Corinna Vinschen [Wed, 15 Mar 2023 20:54:13 +0000 (21:54 +0100)]
Cygwin: kill(1): align real-time signal naming to Linux kill(1)

Allow RT<N>, RTMIN+<N> and RTMAX-<N> for RT signals.
Translate RT signal numbers to an "RT<N>" string.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: kill(1): don't print spurious error message
Corinna Vinschen [Wed, 15 Mar 2023 20:50:32 +0000 (21:50 +0100)]
Cygwin: kill(1): don't print spurious error message

Make kill -V and kill -l exit immediately, thus stopping to
print "not enough arguments" accidentally.

Fixes: ef48a2cad3704 ("* kill.cc (prog_name) New global variable.")
Fixes: c49fa762631f9 ("* Makefile.in (kill.exe): Add as a specific target.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: signals: drop accidental spaces from real-time signal names
Corinna Vinschen [Wed, 15 Mar 2023 20:44:52 +0000 (21:44 +0100)]
Cygwin: signals: drop accidental spaces from real-time signal names

The signal names for the real-time signals contain spaces from
the beginning of their availability.  Fix that.

Fixes: 61522196c715 ("* Merge in cygwin-64bit-branch.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
19 months agoCygwin: doc: Update postinstall/preremove scripts
Jon Turney [Thu, 2 Mar 2023 21:33:32 +0000 (21:33 +0000)]
Cygwin: doc: Update postinstall/preremove scripts

setup >=2.925 indicates to postinstall and preremove scripts the Start
Menu suffix to use via the CYGWIN_START_MENU_SUFFIX env var.

It also indicates, via the CYGWIN_SETUP_OPTIONS env var, if the option
to disable Start Menu shortcut creation is supplied.

Update the Cygwin documentation postinstall and preremove scripts to
take these env vars into consideration.

19 months agoCygwin: Fix type mismatch on sys/cpuset.h
Mark Geisert [Tue, 14 Mar 2023 08:56:01 +0000 (01:56 -0700)]
Cygwin: Fix type mismatch on sys/cpuset.h

Addresses https://cygwin.com/pipermail/cygwin/2023-March/253220.html

Take the opportunity to follow FreeBSD's and Linux's lead in recasting
macro inline code as calls to static inline functions.  This allows the
macros to be type-safe.  In addition, added a lower bound check to the
functions that use a cpu number to avoid a potential buffer underrun on
a bad argument.  h/t to Corinna for the advice on recasting.

Fixes: 362b98b49af5 ("Cygwin: Implement CPU_SET(3) macros")
19 months agolibgloss/epiphany: Fix move instruction in crt0.S
Sebastian Huber [Wed, 8 Mar 2023 13:07:07 +0000 (14:07 +0100)]
libgloss/epiphany: Fix move instruction in crt0.S

This patch relates to bug report:

https://sourceware.org/bugzilla/show_bug.cgi?id=30212

19 months agoCygwin: ctty: Remove old 'kludge' code.
Takashi Yano [Sun, 5 Mar 2023 09:17:39 +0000 (18:17 +0900)]
Cygwin: ctty: Remove old 'kludge' code.

Remove old 'kludge' code which does not seem necessary anymore. The
comment of the 'kludge' is as follows.

  * syscalls.cc (setsid): On second thought, in the spirit of keeping
    things kludgy, set ctty to -2 here as a special flag, and...
    (open): ...only eschew setting O_NOCTTY when that case is detected.

Fixes: c38a2d837303
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
19 months agoCygwin: ctty: Replace ctty constant with more descriptive macros.
Takashi Yano [Sun, 5 Mar 2023 10:02:13 +0000 (19:02 +0900)]
Cygwin: ctty: Replace ctty constant with more descriptive macros.

This patch replaces ctty constants with more descriptive macros
(CTTY_UNINITIALIZED and CTTY_RELEASED) rather than -1 and -2 as
well as checking sign with CTTY_IS_VALID().

Fixes: 3b7df69aaa57 (Cygwin: ctty: Add comments for the special values: -1 and -2.)
Suggested-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
19 months agoCygwin: console: Suppress unnecessary open_shared_console() calls.
Takashi Yano [Mon, 6 Mar 2023 15:18:04 +0000 (00:18 +0900)]
Cygwin: console: Suppress unnecessary open_shared_console() calls.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This page took 0.069032 seconds and 5 git commands to generate.