Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-11-29Cygwin: Add '--names-only' flag to cygcheckcygwin-3_4-branchJon Turney
Add '--names-only' flag to cygcheck, to output just the bare package names. (cherry picked from commit 127166f7070f67a3b322e72119df8a547fd1f85d)
2023-11-29Cygwin: bump DLL version to 3.4.11Corinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28Cygwin: open(2): reset sparseness on O_TRUNCated filescygwin-3.4.10Corinna Vinschen
open(2) implements O_TRUNC by just reducing the size of the file to 0, to make sure EAs stay available. Turns out, file sparseness is not removed this way either, so add code to do just that. Fixes: 603ef545bdbd ("* fhandler.cc (fhandler_base::open): Never open files with FILE_OVERWITE/FILE_OVERWRITE_IF.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-28Cygwin: posix_fallocate: return ENODEVCorinna Vinschen
The fhandler method ftruncate returns either EISDIR if it has been called on directories, or EINVAL if called on files other than regular files. This matches what ftruncate(2) is supposed to return, but it doesn't match posix_fallocate(3), which is supposed to return ENODEV in both cases. To accomplish that, return ENODEV from fhandler_base::ftruncate() and convert it to EINVAL in ftruncate(2). In posix_fallocate(3), convert EISDIR to ENODEV. Fixes: 7636b58590621 ("* autoload.cc (NtSetInformationFile): Define.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-24newlib: nl_langinfo: Fix a bug of time stuff.Takashi Yano
Previously, e.g. nl_langinfo(_NL_TIME_WMONTH_1) returns "February" due to the bug. Similarly, nl_langinfo(_NL_TIME_WWDAY_1) returns "Mon". This occurs because wide char month and weekday arrays are pointed off-by-one (e.g. the array wmon[12] is reffered as wmon[1-12] rather than wmon[0-11]). This patch fixes that. Fixes: d47d5b850bed ("Extend locale support to maintain wide char values of native strings") Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-11-14Cygwin: rand(3): implement in terms of random(3)Corinna Vinschen
This makes rand(3) ISO C compliant and adds locking to avoid race conditions. Reported-by: Bruno Haible <bruno@clisp.org> Fixes: 8a0efa53e4491 ("import newlib-2000-02-17 snapshot") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-14Fix profiler error() definition and usageMark Geisert
Minor updates to profiler and gmondump, which share some code: - fix operation of error() so it actually works as intended - resize 4K-size auto buffer reservations to BUFSIZ (==1K) - remove trailing '\n' from 2nd arg on error() calls everywhere - provide consistent annotation of Windows error number displays Fixes: 9887fb27f6126 ("Cygwin: New tool: profiler") Fixes: 087a3d76d7335 ("Cygwin: New tool: gmondump") Signed-off-by: Mark Geisert <mark@maxrnd.com>
2023-11-13Add release text for random(3) fixCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-13Cygwin: random: drop unused function srandomdev()Corinna Vinschen
Also drop includes only required for srandomdev(). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-13Cygwin: random: make random(3) functions thread-safeCorinna Vinschen
Add locking to the random(3) family of functions to gain thread-safety per POSIX. Use NetBSD version of the file as role-model. Reported-by: Bruno Haible <bruno@clisp.org> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-10-31Cygwin: let feraiseexcept actually raise an exceptionCorinna Vinschen
The exception handling inside of Cygwin functions marked as SIGFE covers exceptions and lets the library code handle them gracefully. If these functions want to raise an exception, they have to send a signal explicitely via raise(3). That's not what we want in feraiseexcept(). It triggers a floating point exception explicitely by calling the i387 op "fwait". Being marked as SIGFE, this exception will be suppressed and the normal exception handling won't kick in. Fix this by moving feraiseexcept into the NOSIGFE realm. Fixes: 0f81b5d4bcaa ("* Makefile.in (DLL_OFILES): Add new fenv.o module.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-10-31Cygwin: cwd: avoid releasing the cwdstuff SRW Lock twiceCorinna Vinschen
cwdstuff::set has a code snippet handling the case where a process can't create a handle to a directory, e. g., due to permissions. Commit 88443b0a22589 ("cwdstuff: Don't leave from setting the CWD prematurely on init") introduced a special case to handle this situation at process initialization. It also introduces an early mutex release, which is not required, but ok, because we're in the init phase. Releasing the mutex twice is no problem since the mutexes are recursive. Fast forward to commit 0819679a7a210 ("Cygwin: cwd: use SRWLOCK instead of muto"). The mechanical change from a recursive mutex to a non-recursive SRWLOCK failed to notice that this very specific situation will release the SRWLOCK twice. Remove the superfluous release action. While at it, don't set dir to NULL, but h, since dir will get the value of h anyway later on. Setting h to NULL may not be necessary, but better safe than sorry. Reported-by: tryandbuy >tryandbuy@proton.me> Fixes: 88443b0a22589 ("cwdstuff: Don't leave from setting the CWD prematurely on init") Fixes: 0819679a7a210 ("Cygwin: cwd: use SRWLOCK instead of muto") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-17Cygwin: dsp: Fix a bug that app hangs if it killed during write().Takashi Yano
If app is killed during blocking write(), it sometimes hangs. This patch fixes the issue. Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-09-10Cygwin: Add relnote to 3.4.10 release fileMark Geisert
Document the most recent update to include/sys/cpuset.h. (cherry picked from commit 27e8815535fc7e6a9ed204323682f22be02946a5)
2023-09-10Cygwin: Fix __cpuset_zero_s prototypeMark Geisert
Add a missing "void" to the prototype for __cpuset_zero_s(). Reported-by: Marco Mason <marco.mason@gmail.com> Addresses: https://cygwin.com/pipermail/cygwin/2023-September/254423.html Signed-off-by: Mark Geisert <mark@maxrnd.com> Fixes: c6cfc99648d6 (Cygwin: sys/cpuset.h: add cpuset-specific external functions) (cherry picked from commit 003fc339425b28283f86a05cdb9cbfb194167222)
2023-09-06Cygwin: bump DLL version to 3.4.10Corinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-05Cygwin: dps: Fix a bug that read() could not return -1 on error.cygwin-3.4.9Takashi Yano
2023-09-02Cygwin: CI: Stop running testsuite on 3.4 branchJon Turney
It often (always?) gets stuck and takes a long time
2023-09-01Cygwin: document latest sys/cpuset.h fixCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-01Cygwin: sys/cpuset.h: use internal base typesCorinna Vinschen
Use __size_t and __pid_t instead of size_t and pid_t to avoid further dependencies to external headers. Reported-by: Brian Inglis <Brian.Inglis@Shaw.ca> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-01Cygwin: sys/cpuset.h: add cpuset-specific external functionsCorinna Vinschen
The latest incarnation of sys/cpuset.h broke building coreutils. The reason is the inclusion of stdlib.h and string.h and hence premature requests for datatypes not yet defined in the include chain. Avoid this by defining __cpuset_alloc and __cpuset_free as external functions, now defined in sched.cc. Linux is doing this too, just using different names for the functions. Redefine __cpuset_zero_s to use __builtin_memset only on compilers supporting it, otherwise using a simple loop. Drop the stdlib.h and string.h includes. Fixes: 3f2790e04439 ("Cygwin: Make gcc-specific code in <sys/cpuset.h> compiler-agnostic") Reported-by: Denis Excoffier <cygwin@Denis-Excoffier.org> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-09-01Cygwin: dsp: Fix a few trivial bugs.Takashi Yano
Signed-off-by: Takashi Yano <takashi.yanao@nifty.ne.jp>
2023-08-29Cygwin: execve: drop argument size limitCorinna Vinschen
Before commit 44f73c5a6206 ("Cygwin: Fix segfalt when too many command line args are specified.") we had no actual argument size limit, except for the fact that the child process created another copy of the argv array on the stack, which could result in a stack overflow and a subsequent SEGV. Commit 44f73c5a6206 changed that by allocating the additional argv array via malloc, and it introduced a new SC_ARG_MAX limit along the lines of the typical Linux limit. However, this new limit is artificial. Cygwin allocates all argument and environment data on the cygheap. We only run out of ARG_MAX space if we're out of memory resources. Change argument size handling accordingly: - Drop the args size check from child_info_spawn::worker. - Return -1 from sysconf (SC_ARG_MAX), i. e., the argument size limit is undefined. - Change argv handling in class av, so that a failing cmalloc is not fatal. This allows the parent process to return E2BIG if it's out of cygheap resources. - In the child, add a check around the new malloc call, so that it doesn't result in a SEGV if the child process gets unexpectedly into an ENOMEM situation at this point. In this (unlikely) case, proceed with the original __argv array instead. Add comment to explain why. Fixes: 44f73c5a6206 ("Cygwin: Fix segfalt when too many command line args are specified.") Tested-by: Takashi Yano <takashi.yano@nifty.ne.jp> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-28Cygwin: Fix segfalt when too many command line args are specified.Takashi Yano
Previously, the number of command line args was not checked for cygwin process. Due to this, segmentation fault was caused if too many command line args are specified. https://cygwin.com/pipermail/cygwin/2023-August/254333.html Since char *argv[argc + 1] is placed on the stack in dll_crt0_1(), STATUS_STACK_OVERFLOW occurs if the stack does not have enough space. With this patch, char *argv[] is placed in heap instead of stack and ARG_MAX is increased from 32000 to 2097152 which is default value of Linux. The argument length is also compared with ARG_MAX and spawnve() returns E2BIG if it is too long. Reported-by: Ed Morton Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-25Cygwin: document disabling mknod/mkfifo on NFSCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-25Cygwin: mknod: disable creating special files on NFSCorinna Vinschen
This simply doesn't work (yet?) but leaves unusable files behind. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-19Cygwin: configure: Add option to disable building 'dumper'Jon Turney
Rather than guessing, based on just the presence of libbfd, add an explicit configuration option, to build dumper or not, defaulting to building it. This might have some use when bootstrapping Cygwin for a new architecture, or when building your own Cygwin-targetted cross-compiler, rather than installing one from the copr, along with the dependencies of libbfd. (cherry picked from commit 1b5fc91a1daa90fb955f57937f4590c5079dd161)
2023-08-19Cygwin: pty: Fix failure to clear switch_to_nat_pipe flag.Takashi Yano
After the commit fbfea31dd9b9, switch_to_nat_pipe is not cleared properly when non-cygwin app is terminated in the case where the pseudo console is disabled. This is because get_winpid_to_hand_over() sometimes returns PID of cygwin process even though it should return only PID of non-cygwin process. This patch fixes the issue by adding a new argument which requests only PID of non-cygwin process to get_console_process_id(). Fixes: fbfea31dd9b9 ("Cygwin: pty: Avoid cutting the branch the pty master is sitting on.") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-17Cygwin: bump DLL version to 3.4.9Corinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-16Cygwin: shared: Fix access permissions setting in open_shared().cygwin-3.4.8Takashi Yano
After the commit 62f11a5a5704, the access permissions argument passed to open_shared() is ignored and always replaced with (FILE_MAP_READ | FILE_MAP_WRITE). This causes the weird behaviour that sshd service process loses its cygwin PID. This triggers the failure in pty that transfer_input() does not work properly. This patch resumes the access permission settings to fix that. Fixes: 62f11a5a5704 ("Cygwin: open_shared: don't reuse shared_locations parameter as output") Fixes: fb16f490bf6e ("Cygwin: open_shared: try harder allocating a shared region") Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signedd-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-16Cygwin: pty: Add missing pinfo check in transfer_input().Takashi Yano
The commit 10d083c745dd has a bug that lacks a check for pinfo pointer value for master_pid. This causes segmentation fault if the process whose pid is master_pid no longer exists. This patch fixes the issue. Fixes: 10d083c745dd ("Cygwin: pty: Inherit typeahead data between two input pipes.") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-04Cygwin: pty: Fix thread safety of readahead buffer handling in pty master.Takashi Yano
Previously, though readahead buffer handling in pty master was not fully thread-safe, accept_input() was called from peek_pipe() thread in select.cc. This caused the problem reported in: https://cygwin.com/pipermail/cygwin/2023-July/253984.html The mechanism of the problem is: 1) accept_input() which is called from peek_pipe() thread calls eat_readahead(-1) before reading readahead buffer. This allows writing to the readahead buffer from another (main) thread. 2) The main thread calls fhandler_pty_master::write() just after eat_readahead(-1) was called and before reading the readahead buffer by accept_input() called from peek_pipe() thread. This overwrites the readahead buffer. 3) The read result from readahead buffer which was overwritten is sent to the slave. This patch makes readahead buffer handling fully thread-safe using input_mutex to resolve this issue. Fixes: 7b03b0d8cee0 ("select.cc (peek_pipe): Call flush_to_slave whenever we're checking for a pty master.") Reported-by: Thomas Wolff <towo@towo.net> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-04newlib: gdtoa: Suppress compiler warning.Takashi Yano
Fixes: 5ac83ea47a7a ("newlib: Fix memory leak regarding gdtoa-based _ldtoa_r().") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-02newlib: Fix memory leak regarding gdtoa-based _ldtoa_r().Takashi Yano
After the commit a4705d387f78, printf() for floating-point values causes a memory leak. The legacy _ldtoa_r() assumed the char pointer returned will be free'ed by Bfree(). However, gdtoa-based _ldtoa_r() returns the pointer returned by gdtoa() which should be free'ed by freedtoa(). Due to this issue, the caller of _ldtoa_r() fails to free the allocated char buffer. This is the cause of the said memory leak. https://cygwin.com/pipermail/cygwin/2023-July/254054.html This patch makes rv_alloc()/freedtoa() allocate/free the buffer in a compatible way with legacy _ldtoa_r(). Fixes: a4705d387f78 ("ldtoa: Import gdtoa from OpenBSD.") Reported-by: natan_b <natan_b@libero.it> Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-07-26Rename _NL_CTYPE_OUTDIGITSx_MB/WC to _NL_CTYPE_OUTDIGITx_MB/WCCorinna Vinschen
The extended _NL_foo names were originally designed after their GLibc counterparts. However, the OUTDIGIT macros were accidentally defined as OUTDIGITS, plural. Fix them. Fixes: d47d5b850bed ("Extend locale support to maintain wide char values of native strings") Conflicts: Context formatting changes in winsup/utils/locale.cc not backported to 3.4 branch Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26Cygwin: add AT_EMPTY_PATH fix to release messageCorinna Vinschen
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26Cygwin: Fix and streamline AT_EMPTY_PATH handlingCorinna Vinschen
The GLIBC extension AT_EMPTY_PATH allows the functions fchownat and fstatat to operate on dirfd alone, if the given pathname is an empty string. This also allows to operate on any file type, not only directories. Commit fa84aa4dd2fb4 broke this. It only allows dirfd to be a directory in calls to these two functions. Fix that by handling AT_EMPTY_PATH right in gen_full_path_at. A valid dirfd and an empty pathname is now a valid combination and, noticably, this returns a valid path in path_ret. That in turn allows to remove the additional path generation code from the callers. Fixes: fa84aa4dd2fb ("Cygwin: fix errno values set by readlinkat") Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de> Tested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26Cygwin: use new _AT_NULL_PATHNAME_ALLOWED flagCorinna Vinschen
Convert gen_full_path_at to take flag values from the caller, rather than just a bool indicating that empty paths are allowed. This is in preparation of a better AT_EMPTY_PATH handling in a followup patch. Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26Define _AT_NULL_PATHNAME_ALLOWEDCorinna Vinschen
Cygwin needs an internal flag to allow specifying an empty pathname in utimesat (GLIBC extension). We define it in _default_fcntl.h to make sure we never introduce a value collision accidentally. While at it, define the values as 16 bit hex values. Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26Cygwin: gen_full_path_at: drop never reached codeCorinna Vinschen
The check if the local variable p is NULL is useless. The preceeding code always sets p to a valid pointer, or it crashes if path_ret is invalid (which would be a bug in Cygwin). Fixes: c57b57e5c43a ("* cygwin.din: Sort.") Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-13Cygwin: Update release/3.4.8 for latest <sys/cpuset.h> commitMark Geisert
(cherry picked from commit c836d26d768b9db1b948ba5dcef571cd356cfb6c)
2023-07-10Cygwin: Make gcc-specific code in <sys/cpuset.h> compiler-agnosticMark Geisert
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>
2023-07-04Cygwin: Fix latest release message being in the wrong release file.Corinna Vinschen
Fixes: 6422e76637d3 ("Cygwin: Make <sys/cpuset.h> safe for c89 compilations") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-04Cygwin: Make <sys/cpuset.h> safe for c89 compilationsMark Geisert
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>
2023-06-22Cygwin: thread: Reset _my_tls.tid if it's pthread_null in init_mainthread().Takashi Yano
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>
2023-06-16Cygwin: bump DLL version to 3.4.8Corinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-06-02Cygwin: pty: Additional fix for transferring input at exit.cygwin-3.4.7Takashi Yano
The commit 3456e8b7db5b 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: 3456e8b7db5b ("Cygwin: pty: Fix transferring type-ahead input between input pipes.") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-06-01Cygwin: pty: Fix transferring type-ahead input between input pipes.Takashi Yano
After the commit 595fcb21ffc0, 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: 595fcb21ffc0 ("Cygwin: pty: Fix reading CONIN$ when stdin is not a pty.") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-05-25Cygwin: Adjust CWD magic to accommodate for the latest Windows previewsJohannes Schindelin
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> (cherry picked from commit 4840a5632520c1a3c1598f73f9d1cdd37df371ba)
2023-05-01Cygwin: Fix compiling with w32api-headers v11.0.0Biswapriyo Nath
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 | { | ^ (cherry picked from commit 3bee68248fc8e164a8bb6bba3f105b10fdec8a71)