]> sourceware.org Git - newlib-cygwin.git/log
newlib-cygwin.git
16 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>
16 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

16 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

16 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.

16 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

16 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>
16 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>
16 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.

16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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>
17 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.

17 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")
17 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

17 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>
17 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>
17 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>
17 months agoCygwin: ctty: Add missing fixup_after_{exec,fork}() call.
Takashi Yano [Mon, 6 Mar 2023 15:13:55 +0000 (00:13 +0900)]
Cygwin: ctty: Add missing fixup_after_{exec,fork}() call.

Previously, fixup_after_{exec,fork}() calls for CTTY were missing.
This patch fixes that.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
17 months agoCygwin: is_unicode_equiv: fix comment
Corinna Vinschen [Fri, 3 Mar 2023 17:15:52 +0000 (18:15 +0100)]
Cygwin: is_unicode_equiv: fix comment

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: glob: fix conversion from UTF-32 to multibyte
Corinna Vinschen [Fri, 3 Mar 2023 10:32:31 +0000 (11:32 +0100)]
Cygwin: glob: fix conversion from UTF-32 to multibyte

The conversion function g_Ctoc missed to drop the flag
values from the wint_t value.  That wasn't noticable with
the original version because it used a 64 bit Char type
and the flags were in the upper 32 bit region.  So the
flag values were silently dropped when wcrtomb was called.
After converting Char to wint_t, we have to do drop the
flags explicitely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoarm: Restrict processor mode change when in hypervisor mode
Srinath Parvathaneni [Fri, 3 Mar 2023 13:12:18 +0000 (13:12 +0000)]
arm: Restrict processor mode change when in hypervisor mode

If a CPU implements EL2 as its highest exception level then programs
using newlib may start in hypervisor mode.  In that state it is not
trivial to switch into the various EL1 modes to configure the
individual exception stacks, so do not try.

17 months agoarm: Fix the SP used in setting stack limit for standalone application.
Srinath Parvathaneni [Fri, 3 Mar 2023 12:45:40 +0000 (12:45 +0000)]
arm: Fix the SP used in setting stack limit for standalone application.

Move the instruction that saves SP before the mode check so that
applications that start in USER mode correctly set the stack limit.

17 months agoCygwin: define CHARCLASS_NAME_MAX
Corinna Vinschen [Wed, 1 Mar 2023 20:20:26 +0000 (21:20 +0100)]
Cygwin: define CHARCLASS_NAME_MAX

CHARCLASS_NAME_MAX isn't defined yet, accidentally.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: add collating symbols support to release message
Corinna Vinschen [Wed, 1 Mar 2023 10:49:52 +0000 (11:49 +0100)]
Cygwin: add collating symbols support to release message

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: fnmatch: support collating symbols in [. .] brackets
Corinna Vinschen [Wed, 1 Mar 2023 09:54:00 +0000 (10:54 +0100)]
Cygwin: fnmatch: support collating symbols in [. .] brackets

This requires quite a few changes in how fnmatch operates.
It always operates on wint_t strings now, just like regex and glob,
and it always keeps a pointer on the character inside the string,
rather than operating on a single character.

As a result, just drop the ifdef's for Cygwin.  The code is
non-portable now anyway...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: mbsnrtowci: like mbsnrtowcs, just for wint_t
Corinna Vinschen [Wed, 1 Mar 2023 09:44:52 +0000 (10:44 +0100)]
Cygwin: mbsnrtowci: like mbsnrtowcs, just for wint_t

Deviation from standard: If the input is broken, the output will be
broken.  I. e., we just copy the current byte over into the wint_t
destination and try to pick up on the next byte.  This is in line
with the way fnmatch works.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: wcichr: add wint_t replacement for wcschr
Corinna Vinschen [Wed, 1 Mar 2023 09:36:55 +0000 (10:36 +0100)]
Cygwin: wcichr: add wint_t replacement for wcschr

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: add wcipcpy and wcipncpy helper functions
Corinna Vinschen [Wed, 1 Mar 2023 09:36:09 +0000 (10:36 +0100)]
Cygwin: add wcipcpy and wcipncpy helper functions

wint_t replacements for wcpcpy and wcpncpy

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: wcitoascii: move to wchar.h as inline function
Corinna Vinschen [Wed, 1 Mar 2023 09:34:41 +0000 (10:34 +0100)]
Cygwin: wcitoascii: move to wchar.h as inline function

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: fnmatch: drop static variable
Corinna Vinschen [Tue, 28 Feb 2023 15:45:52 +0000 (16:45 +0100)]
Cygwin: fnmatch: drop static variable

fnmatch calls fnmatch1 with a static mbstate_t.  This breaks
calling fnmatch from multiple threads.  Fix it by folding
fnmatch1 into fnmatch and moving all mbstates to local variables.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: __wscollate_range_cmp: fix incorrect comment
Corinna Vinschen [Tue, 28 Feb 2023 11:10:40 +0000 (12:10 +0100)]
Cygwin: __wscollate_range_cmp: fix incorrect comment

The comment that the first arg must be the pattern was added
during development, before it turned out that __wscollate_range_cmp
can be implemented in an order independent way.

Better explain why this function uses pointers to strings.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agonano-mallocr: Prevent NULL pointer de-reference in free_list
Henrik Nilsson via Newlib [Fri, 17 Feb 2023 05:56:49 +0000 (06:56 +0100)]
nano-mallocr: Prevent NULL pointer de-reference in free_list

The existing code checked if there was a chunk in free_list and
that the tail was not the next chunk.

The check if there is a chunk is not needed since it's already
known but the case of a single chunk in free_list needs to be
handled differently.

17 months agoCygwin: fetch-lc-def-codesets-from-linux: fix locale name handling
Corinna Vinschen [Sun, 26 Feb 2023 19:14:54 +0000 (20:14 +0100)]
Cygwin: fetch-lc-def-codesets-from-linux: fix locale name handling

As the former call to `locale -av' has the unwanted side effect
to shorten the locale name to <= 15 chars, don't use it.  Use
`locale -a' instead and fetch the codeset from another call to
`locale' for each locale.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: locale: fix devanagari modifier
Corinna Vinschen [Sun, 26 Feb 2023 16:17:33 +0000 (17:17 +0100)]
Cygwin: locale: fix devanagari modifier

Effectively revert commit 57bac33359db.  The fact that the
devanagari modifier was called devanagar (missing the trailing 'i')
is a result of `locale -av' shortening the locale name to a maximum
of 15 characters.

D'oh.  I guess we need a better way to do this...

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: introduce /proc/codesets and /proc/locales
Corinna Vinschen [Sun, 26 Feb 2023 16:04:03 +0000 (17:04 +0100)]
Cygwin: introduce /proc/codesets and /proc/locales

So far locale(1) had to have knowledge how to construct, thus
duplicating the effort how Cygwin handles locale strings.

Move locale list and codeset list generation into Cygwin by
providing /proc/codesets and /proc/locales files.  /proc/locales
does not list aliases, those are still handled in locale(1).

locale(1) opens the files and ueses that info for printing,
like any other application can do now.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: fetch-lc-def-codesets-from-linux: speed up
Corinna Vinschen [Sat, 25 Feb 2023 19:15:53 +0000 (20:15 +0100)]
Cygwin: fetch-lc-def-codesets-from-linux: speed up

Drop shell read loop in favor of performing the locale output
evaluation inside a single awk invocation.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: locale(1): redefine rule for adding a @euro locale
Corinna Vinschen [Sat, 25 Feb 2023 18:43:08 +0000 (19:43 +0100)]
Cygwin: locale(1): redefine rule for adding a @euro locale

The @euro locale is only useful, if the locale uses the EUR currency
and the codeset of the base locale is ISO-8859-1, or the locale is
el_GR.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: locale: Set default charset from Linux locale -> codeset mapping
Corinna Vinschen [Sat, 25 Feb 2023 15:11:54 +0000 (16:11 +0100)]
Cygwin: locale: Set default charset from Linux locale -> codeset mapping

Generate lc_def_codeset.h header containing the default mapping from
locale to codeset on Linux.  Use this mapping in __set_charset_from_locale
in the first place.

For every locale not covered by this table, just map Windows codepages
to equivalent codesets used on Linux/Unix, getting rid of LCIDs entirely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: locale: new script creating linux default codeset mapping
Corinna Vinschen [Sat, 25 Feb 2023 15:06:34 +0000 (16:06 +0100)]
Cygwin: locale: new script creating linux default codeset mapping

New script creating a mapping table from locale to default codeset
for this locale.  We use that in Cygwin now to generate the own
default codeset mapping based on Linux locale names.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: locale: fix devanagar modifier
Corinna Vinschen [Sat, 25 Feb 2023 14:09:12 +0000 (15:09 +0100)]
Cygwin: locale: fix devanagar modifier

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoctype_cp.h/ctype_iso.h: clean whitespace
Corinna Vinschen [Sat, 25 Feb 2023 12:23:20 +0000 (13:23 +0100)]
ctype_cp.h/ctype_iso.h: clean whitespace

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: fully support KOI8-T codeset
Corinna Vinschen [Sat, 25 Feb 2023 12:19:27 +0000 (13:19 +0100)]
Cygwin: fully support KOI8-T codeset

Commit 89eb4bce152f was pretty half-hearted, missing
the codepage character type tables and wctomb/mbtowc
mappings.

Fixes: 89eb4bce152f ("Cygwin: support KOI8-T codeset")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: locale(1): fix typo
Corinna Vinschen [Sat, 25 Feb 2023 12:20:05 +0000 (13:20 +0100)]
Cygwin: locale(1): fix typo

Windows locales need a dash instead of an underscore.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: dsp: Fix SNDCTL_DSP_{POST,SYNC} ioctl() behaviour.
Takashi Yano [Sat, 25 Feb 2023 01:28:34 +0000 (10:28 +0900)]
Cygwin: dsp: Fix SNDCTL_DSP_{POST,SYNC} ioctl() behaviour.

Previously, SNDCTL_DSP_POST and SNDCTL_DSP_SYNC were implemented
wrongly. Due to this issue, module-oss of pulseaudio generates
choppy sound when SNDCTL_DSP_POST is called. This patch fixes that.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
17 months agoCygwin: convert Windows locale handling from LCID to ISO5646 strings
Corinna Vinschen [Fri, 24 Feb 2023 15:37:44 +0000 (16:37 +0100)]
Cygwin: convert Windows locale handling from LCID to ISO5646 strings

Since Windows Vista, locale handling is converted from using numeric
locale identifiers (LCID) to using ISO5646 locale strings.  In the
meantime Windows introduced new locales which don't even have a LCID
attached.  Those were unusable in Cygwin because locale information
for these locales required to call the new locale functions taking
a locale string.

Convert Cygwin to drop LCIDs and use Windows ISO5646 locales instead.

The last place using LCIDs is the __set_charset_from_locale function.
Checking numerically is easier and uslay faster than checking strings.
However, this function is clearly a TODO

17 months agoCygwin: support KOI8-T codeset
Corinna Vinschen [Fri, 24 Feb 2023 15:07:26 +0000 (16:07 +0100)]
Cygwin: support KOI8-T codeset

Used on Linux as default codeset for Tajik. There's no matching
Windows codepage, so fake it as CP103.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
17 months agoCygwin: locale(1): drop using LCID, use Windows locale names
Corinna Vinschen [Wed, 22 Feb 2023 23:22:56 +0000 (00:22 +0100)]
Cygwin: locale(1): drop using LCID, use Windows locale names

LCIDs are deprecated since Windows Vista.  Worse, lots of new locales
have been added in the meantime which have no LCID attached.  They
are only available by locale name.

As first step, rearrange the locale(1) tool to use Windows locale
names, rather than LCIDs, so we can now enumerate *all* locales
available in more recent Windows versions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoFix libgloss/newlib build to conditionally use top include dir
Jeff Johnston [Thu, 9 Feb 2023 21:59:31 +0000 (16:59 -0500)]
Fix libgloss/newlib build to conditionally use top include dir

- conditionally use -idirafter option for arm

18 months agoRISC-V: Use the new libm code if possible
Hau Hsu [Wed, 22 Feb 2023 01:59:07 +0000 (09:59 +0800)]
RISC-V: Use the new libm code if possible

Set  __OBSOLETE_MATH_DEFAULT to 0 if 'd' extension is supported (i.e.
__riscv_flen == 64).

Base on the comment for  __OBSOLETE_MATH_DEFAULT:

> ... it assumes that the toolchain has ISO C99 support (hexfloat
> literals, standard fenv semantics), the target has IEEE-754 conforming
> binary32 float and binary64 double (not mixed endian) representation,
> standard SNaN representation, double and single precision arithmetics
> has similar latency and it has no legacy SVID matherr support, only
> POSIX errno and fenv exception based error handling.

Signed-off-by: Hau Hsu <hau.hsu@sifive.com>
18 months agoCygwin: __wscollate_range_cmp: workaround wcscoll's case-insensitivity
Corinna Vinschen [Wed, 22 Feb 2023 11:20:32 +0000 (12:20 +0100)]
Cygwin: __wscollate_range_cmp: workaround wcscoll's case-insensitivity

Most locales using latin characters ignore case while sorting.
This is what wcscoll does (correctly so).  However, there's an
internal order of collating sequences compared to the base
character, which is case-sensitive, at least in GLibc.

There's no way to express this in Windows, because CompareString
and LCMapString *always* use case-insensitivity in those locales,
even if none of the *IGNORECASE sorting flags are used.

We want to follow glibc's behaviour more closely, so we add an
extra check for the case and make sure upper and lower cased
letters don't comapre as identical.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: glob: perform ignore_case_with_glob on input
Corinna Vinschen [Wed, 22 Feb 2023 09:47:54 +0000 (10:47 +0100)]
Cygwin: glob: perform ignore_case_with_glob on input

Rather than converting single chars on the fly to lowercase
in case ignore_case_with_glob is set, perform the conversion
on the entire input (pattern and filenames).

18 months agoCygwin: glob: perform correct utf-32 -> multibyte conversion
Corinna Vinschen [Wed, 22 Feb 2023 09:03:03 +0000 (10:03 +0100)]
Cygwin: glob: perform correct utf-32 -> multibyte conversion

g_Ctoc, converting the UTF-32 filenames to multibyte, still
used UTF-16 to  multibyte conversion.  Introduce a wirtomb
helper and fix that.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: glob: fix includes
Corinna Vinschen [Wed, 22 Feb 2023 09:00:10 +0000 (10:00 +0100)]
Cygwin: glob: fix includes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: linux-locale-helpers: helper tools to generate locale data from Linux
Corinna Vinschen [Mon, 20 Feb 2023 22:00:04 +0000 (23:00 +0100)]
Cygwin: linux-locale-helpers: helper tools to generate locale data from Linux

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: glob: implement collating symbol support
Corinna Vinschen [Mon, 20 Feb 2023 21:50:17 +0000 (22:50 +0100)]
Cygwin: glob: implement collating symbol support

Allow the [.<sym>.] expression

This requires a string comparision rather than a character
comparison.  Introduce and use __wscollate_range_cmp.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: glob: convert internal character datatype to wint_t
Corinna Vinschen [Mon, 20 Feb 2023 21:47:17 +0000 (22:47 +0100)]
Cygwin: glob: convert internal character datatype to wint_t

uint_fast64_t doesn't allow easy string handling, so convert
the internal "Char" type to wint_t.  Given that UTF-32 only
needs 21 bits, we're well off with 28 usable character bits.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: nlsfuncs.cc: introduce collating elements and helper functions
Corinna Vinschen [Mon, 20 Feb 2023 21:38:41 +0000 (22:38 +0100)]
Cygwin: nlsfuncs.cc: introduce collating elements and helper functions

lc_collelem.h: autogenerated table of collating element, taken
               from glibc

is_unicode_coll_elem: Check if a UTF-32 string is a collating element
next_unicode_char: return length of prefix from a string constituting
                   a complete character in the current locale, taking
                   collating elements into acocunt.

18 months agoCygwin: add more UTF-32 helper functions
Corinna Vinschen [Mon, 20 Feb 2023 21:29:37 +0000 (22:29 +0100)]
Cygwin: add more UTF-32 helper functions

wcintowcs: convert UTF-16 to UTF-32 string
wcilen: return number of characters in a UTF-32 string
wcincmp: compare two fixed-size UTF-32 strings

Used in followup patches introducing collating symbols

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: glob: sort in current locale's collating order
Corinna Vinschen [Mon, 20 Feb 2023 21:24:06 +0000 (22:24 +0100)]
Cygwin: glob: sort in current locale's collating order

Follow glibc here.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agonewlib/libc/{ctype, string}/*.t: Unicode 15 character width and property tables
Brian Inglis [Fri, 17 Feb 2023 20:56:24 +0000 (13:56 -0700)]
newlib/libc/{ctype, string}/*.t: Unicode 15 character width and property tables

18 months agonewlib/libc/ctype/mkcaseconv: fix POSIX shell invalid == comparison
Brian Inglis [Fri, 17 Feb 2023 20:56:23 +0000 (13:56 -0700)]
newlib/libc/ctype/mkcaseconv: fix POSIX shell invalid == comparison

18 months agoCygwin: convert __collate_range_cmp to __wcollate_range_cmp
Corinna Vinschen [Sun, 19 Feb 2023 13:23:53 +0000 (14:23 +0100)]
Cygwin: convert __collate_range_cmp to __wcollate_range_cmp

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=179721

After FreeBSD eventually picked up the bugreport from within
only 5 years, rename __collate_range_cmp to __wcollate_range_cmp
as suggested all along, and make it type safe (wint_t instead of
wchar_t for hopefully obvious reasons...)

While at it, drop __collate_load_error and fix the checks for
it in glob and fnmatch.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: is_unicode_equiv: fix normalization
Corinna Vinschen [Sat, 18 Feb 2023 22:14:11 +0000 (23:14 +0100)]
Cygwin: is_unicode_equiv: fix normalization

Change normalization to form KD and make room for longer
decomposed sequences.

18 months agoCygwin: is_unicode_equiv: fix comment
Corinna Vinschen [Thu, 16 Feb 2023 19:52:20 +0000 (20:52 +0100)]
Cygwin: is_unicode_equiv: fix comment

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
18 months agoCygwin: dsp: Fix SNDCTL_DSP_GET[IO]SPACE before read()/write().
Takashi Yano [Tue, 14 Feb 2023 13:55:10 +0000 (22:55 +0900)]
Cygwin: dsp: Fix SNDCTL_DSP_GET[IO]SPACE before read()/write().

Even with the commit 3a4c740f59c0, SNDCTL_DSP_GET[IO]SPACE ioctl()
does not return the fragment set by SNDCTL_DSP_SETFRAGMENT if it
is issued before read()/write(). This patch fixes the issue.

Fixes: 3a4c740f59c0 ("Cygwin: dsp: Implement SNDCTL_DSP_SETFRAGMENT ioctl().")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
18 months agoadd glob/fnmatch equivalence class support to release notes
Corinna Vinschen [Wed, 15 Feb 2023 21:37:32 +0000 (22:37 +0100)]
add glob/fnmatch equivalence class support to release notes

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This page took 0.112643 seconds and 5 git commands to generate.