aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-08-11Cygwin: testsuite: Tweak lseek03 after addition of SEEK_HOLEJon Turney1-1/+1
After addition of SEEK_HOLE, the whence of *4* is not an invalid argument, causing the test to FAIL. See ltp commit 423e636a4c8f ("lseek03: change to fix with the lseek syscall")
2023-08-11Cygwin: testsuite: Add a small delay in kill01Jon Turney3-0/+3
Avoid transient failures by adding a small delay after fork()-ing to allow the child to get into a state where it can recieve signals. Also add same small delay to kill03 and kill04. kill02 has a more elaborate setup where child processes write to a pipe to indicate they have started.
2023-08-10Add wildcard support to recurse into sys include directoriesAlexey Lapshin2-46/+32
2023-08-09Cygwin: fhandler_base::lseek: fix formattingCorinna Vinschen1-1/+1
Fixes: edfa581d3c5a ("Cygwin: lseek: implement SEEK_DATA and SEEK_HOLE for files") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-09Cygwin: add SEEK_DATA/SEEK_HOLE addition to release messageCorinna Vinschen2-0/+6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-09Cygwin: lseek: implement SEEK_DATA and SEEK_HOLE for filesCorinna Vinschen1-1/+84
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-09Cygwin: lseek: propagate new SEEK_DATA and SEEK_HOLE to fhandlerCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-09Cygwin: clipboard: Only SEEK_SET and SEEK_CUR are supportedCorinna Vinschen1-0/+7
Make sure of that, especially given the addition of SEEK_DATA and SEEK_HOLE. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-09sys/unistd.h: define GNU extensions SEEK_DATA and SEEK_HOLECorinna Vinschen1-0/+4
SEEK_DATA and SEEK_HOLE are GNU nonstandard extensions also present in Solaris, FreeBSD, and DragonFly BSD; they are proposed for inclusion in the next POSIX revision (Issue 8). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-09Add stub for getentropyTorbjörn SVENSSON10-54/+191
Example test case that fails with undefined reference to getentropy: Testing g++.robertl/eb77.C, -std=c++20 doing compile Executing on host: /build/gcc-13-2709-g9ac9fde961f/bin/arm-none-eabi-g++ /build/src/gcc/gcc/testsuite/g++.old-deja/g++.robertl/eb77.C -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -fdiagnostics-plain-output -fmessage-length=0 -std=c++20 -pedantic-errors -Wno-long-long -Wl,--start-group -lc -lm -Wl,--end-group --specs=nosys.specs -Wl,--allow-multiple-definition -Wl,-u,_isatty,-u,_fstat -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,g++_tg.o -lm -o ./eb77.exe (timeout = 800) spawn -ignore SIGHUP /build/gcc-13-2709-g9ac9fde961f/bin/arm-none-eabi-g++ /build/src/gcc/gcc/testsuite/g++.old-deja/g++.robertl/eb77.C -mthumb -march=armv6s-m -mcpu=cortex-m0 -mfloat-abi=soft -fdiagnostics-plain-output -fmessage-length=0 -std=c++20 -pedantic-errors -Wno-long-long -Wl,--start-group -lc -lm -Wl,--end-group --specs=nosys.specs -Wl,--allow-multiple-definition -Wl,-u,_isatty,-u,_fstat -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,g++_tg.o -lm -o ./eb77.exe pid is 28414 -28414 /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libstdc++.a(random.o): in function `std::(anonymous namespace)::__libc_getentropy(void*)': (.text._ZNSt12_GLOBAL__N_117__libc_getentropyEPv+0x8): undefined reference to `getentropy' /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libstdc++.a(random.o): in function `std::random_device::_M_init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': (.text._ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x58): undefined reference to `getentropy' /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(libc_a-arc4random.o): in function `_rs_stir': (.text._rs_stir+0x8): undefined reference to `getentropy' collect2: error: ld returned 1 exit status pid is -1 close result is 28414 exp6 0 1 output is /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libstdc++.a(random.o): in function `std::(anonymous namespace)::__libc_getentropy(void*)': (.text._ZNSt12_GLOBAL__N_117__libc_getentropyEPv+0x8): undefined reference to `getentropy' /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libstdc++.a(random.o): in function `std::random_device::_M_init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': (.text._ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x58): undefined reference to `getentropy' /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/bin/ld: /build/gcc-13-2709-g9ac9fde961f/bin/../lib/gcc/arm-none-eabi/13.0.0/../../../../arm-none-eabi/lib/thumb/v6-m/nofp/libc.a(libc_a-arc4random.o): in function `_rs_stir': (.text._rs_stir+0x8): undefined reference to `getentropy' collect2: error: ld returned 1 exit status status 1 compiler exited with status 1 FAIL: g++.old-deja/g++.robertl/eb77.C -std=c++20 (test for excess errors) Excess errors: (.text._ZNSt12_GLOBAL__N_117__libc_getentropyEPv+0x8): undefined reference to `getentropy' (.text._ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x58): undefined reference to `getentropy' (.text._rs_stir+0x8): undefined reference to `getentropy' UNRESOLVED: g++.old-deja/g++.robertl/eb77.C -std=c++20 compilation failed to produce executable Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2023-08-08Cygwin: CI: XFAIL umask03Jon Turney1-1/+5
umask03 fails in CI due to some not understood weirdness.
2023-08-08Cygwin: testsuite: Fix cygload testJon Turney1-1/+1
Use cygrun to isolate the cygload test from the current DLL, which allows it to pass.
2023-08-08Cygwin: testsuite: Update READMEJon Turney1-24/+58
v2: Polish instructions on adding a test Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2023-08-08Cygwin: testsuite: Add '-notimeout' option to cygrunJon Turney1-4/+22
Add '-notimeout' option for cygrun. This is very useful when using it to run a test standalone and under a debugger. Also: warn about excess arguments
2023-08-07Cygwin: fix build failure due to redefinition of __restrict in sys/cdefs.hCorinna Vinschen2-2/+2
Commit 3c75fac130b5 fixed the __restrict definition in sys/cdefs.h, but uncovered a problem in the definition of lio_listio in Cygwin's aio.h. It uses the C99 extension of using the restrict keyword to define non-overlapping arrays. However, this is not allowed in C++. Use the newly defined __restrict_arr from commit e66c63be6b80 ("sys/cdefs.h: introduce __restrict_arr, as in glibc") Fixes: 3c75fac130b5 ("sys/cdefs.h: fix for use __restrict in C++" Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-07sys/cdefs.h: introduce __restrict_arr, as in glibcCorinna Vinschen1-0/+13
C99 allows to define arrays as non-overlappiung using the restrict keyword. This is supported by GCC 3.1 and later, but it's not allowed in C++. This is in preparation of fixing a Cygwin build problem introduce by commit 3c75fac130b5. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-07sys/cdefs.h: fix for use __restrict in C++Sebastian Huber1-9/+7
Newlib shares large parts of <sys/cdefs.h> with FreeBSD and received this bug report: https://sourceware.org/pipermail/newlib/2023/020400.html As an extension, GCC and clang offer C99-style restricted pointers in C++ mode: https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html We notice that this extension is broken when including newlib headers: restricted pointers are treated as ordinary pointers. We traced this to the following section of newlib/libc/include/sys/cdefs.h: /* * GCC 2.95 provides `__restrict' as an extension to C90 to support the * C99-specific `restrict' type qualifier. We happen to use `__restrict' as * a way to define the `restrict' type qualifier without disturbing older * software that is unaware of C99 keywords. */ #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 #define __restrict #else #define __restrict restrict #endif #endif While the GCC __restrict extension was indeed introduced in GCC 2.95, it is not limited to this version; the extension is also not limited to C90: https://gcc.gnu.org/gcc-2.95/c++features.html Rewrite the logic in the header so that __restrict is kept alone when available. PR: 272723 MFC after: 1 week
2023-08-07<sys/cdefs.h>: Decay expression passed to fallbackJohn Baldwin1-1/+4
version of __generic() This ensures that __generic() more closely matches _Generic() when using the fallback version when _Generic() is not available (such as GCC). Co-authored by: jrtc27 Reviewed by: jrtc27 Differential Revision: https://reviews.freebsd.org/D38215
2023-08-04Cygwin: pty: Fix thread safety of readahead buffer handling in pty master.Takashi Yano2-5/+13
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 Yano1-1/+1
Fixes: 5ac83ea47a7a ("newlib: Fix memory leak regarding gdtoa-based _ldtoa_r().") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-08-02Cygwin: CI: don't run on both main and master refsJon Turney1-1/+5
2023-08-02Cygwin: Add ISO C2X functions c8rtomb, mbrtoc8Corinna Vinschen5-7/+184
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-02sys/features.h: Define _ISOC2X_SOURCE and __ISO_C_VISIBLECorinna Vinschen1-1/+14
Add feature test for C2X code. Add matching definitions _ISOC2X_SOURCE for requesting sources and __ISO_C_VISIBLE to be used in headers. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-02Cygwin: uchar.h: fix definition of uchar16_t and uchar32_tCorinna Vinschen1-0/+5
Per C++11, uchar16_t and uchar32_t are defined the same as uint_least16_t and uint_least32_t. Also, check for the C++ version to make sure that the types are not colliding with predefined c++ types. Fixes: 4f258c55e87f ("Cygwin: Add ISO C11 functions c16rtomb, c32rtomb, mbrtoc16, mbrtoc32.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-02newlib: Fix memory leak regarding gdtoa-based _ldtoa_r().Takashi Yano3-13/+17
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-08-01Cygwin: select: workaround FD_WRITE network event handlingCorinna Vinschen2-3/+28
The FD_WRITE event is a false friend. It indicates ready to write even if the next send fails with WSAEWOULDBLOCK. *After* the fact, FD_WRITE will be cleared until sending is again possible, but that is too late for a select/write loop. Workaround that by using the WinSock select function when peeking at a socket and FD_WRITE gets indicated. WinSock select fortunately indicates writability correctly. Fixes: 70e476d27be8 ("(peek_socket): Use event handling for peeking socket.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-08-01Cygwin: autoload: introduce LoadDLLfunc_pfx_onlyCorinna Vinschen1-0/+27
This macro loads and defines a function just as usual, except that the Windows function is exposed only with the prefix _win32_. So Windows select (the immediate victim) is only exposed as _win32_select. That allows to autoload the windows function without collision with a Cygwin function of the same name. For a start, only define the most simple macro, setting all extensions to 0. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-31Cygwin: Add ISO C11 functions c16rtomb, c32rtomb, mbrtoc16, mbrtoc32.Corinna Vinschen7-22/+127
Add uchar.h accordingly. For the c32 functions, use the internal functions wirtomb and mbrtowi as base, and convert wirtomb and mbrtowi to inline functions calling the c32 functions. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-31Cygwin: fix GB18030 supportCorinna Vinschen1-2/+148
The changes to support GB18030 were insufficient and the underlying Windows conversion functions just failed. Fix how the Windows functions are called for GB18030. Fixes: 5da71b605995 ("Cygwin: add support for GB18030 codeset") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-31Revert "* libc/stdlib/mbtowc_r.c (__ascii_mbtowc): Disallow conversion of"Corinna Vinschen2-12/+0
This reverts commit 2b77087a48ea56e77fca5aeab478c922f6473d7c. For some reason lost in time, commit 2b77087a48ea5 introduced Cygwin-specific code treating single byte characters outside the portable character set as illegal chars. However, Cygwin was always alone with this over-correct behaviour and it leads to stuff like gnulib replacing functions defined in Cygwin with their own implementation just due to that. Revert this change, sans the changes to ChangeLog. Fixes: 2b77087a48ea ("* libc/stdlib/mbtowc_r.c (__ascii_mbtowc): Disallow conversion of") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-31Cygwin: belatedly bump CYGWIN_VERSION_API_MINOR for new posix_spawn funcsCorinna Vinschen1-1/+3
Commit c743751aafa84 ("Cygwin: Export posix_spawn_file_actions_add{f}chdir_np") added two new functions but we forgot to bump the API version. Catch up. Fixes: c743751aafa84 ("Cygwin: Export posix_spawn_file_actions_add{f}chdir_np") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-27Cygwin: fnmatch: fix range comparison in C localeCorinna Vinschen1-1/+1
Commit c36064bbd0c5 introduced operating on character pointers instead of operating on characters, to allow collating symbols. This patch neglected to change the expression for range comparison in case we're in the C locale. Thus it suddenly compared pointers instead of characters. Fix that. Fixes: c36064bbd0c5 ("Cygwin: fnmatch: support collating symbols in [. .] brackets") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-27Fix rounding results in lrint() & llrint() when close to 0Jesse Huang via Newlib4-48/+26
soft-fp should round floating pointer numbers according to the current rounding mode. However, in the current code of lrint() and llrint(), there are if statements before the actual rounding computation if(j0 < -1) return 0; Where j0 is the exponent of the floating point number. It means any number having a exponent less than -1 (i.e. interval (-0.5, 0.5)) will be rounded to 0 regardeless of the rounding mode. The bug already fixed in glibc in 2006 by moving the check afterwards the rounding computation, but still persists in newlib. This patch fixed it in a similar way to glibc Ref Commit in glibc: 6624dbc07b5a9fb316ed188ef01f65b8eea8b47c
2023-07-26Rename _NL_CTYPE_OUTDIGITSx_MB/WC to _NL_CTYPE_OUTDIGITx_MB/WCCorinna Vinschen3-40/+44
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") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-26RISC-V: Support Zfinx/Zdinx extension.Kito Cheng via Newlib42-56/+93
Zfinx/Zdinx are new extensions ratified in 2022, it similar to F/D extensions, support hard float operation for single/double precision, but the difference between Zfinx/Zdinx and F/D is Zfinx/Zdinx is operating under general purpose registers rather than dedicated floating-point registers. This patch improve the hard float support detection for RISC-V port, so that Zfinx/Zdinx can have better/right performance. Co-authored-by: Jesse Huang <jesse.huang@sifive.com>
2023-07-26Cygwin: add AT_EMPTY_PATH fix to release messageCorinna Vinschen1-0/+4
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 Vinschen1-36/+11
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 Vinschen1-5/+4
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 Vinschen1-5/+6
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 Vinschen1-5/+0
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-22Cygwin: CI: Upgrade checkout actions to avoid deprecation warningJon Turney1-2/+6
Also: workaround a problem with actions/checkout's post-run step using Cygwin git but being incompatible with it. (This would be better solved by cygwin-install-action having a post-run step to unwind it's PATH changes, but that's not currently possible) Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2023-07-22Cygwin: CI: Retain test logs as a build artifactJon Turney1-0/+10
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2023-07-22Cygwin: testsuite: Drop using DejaGnu to run testsJon Turney10-149/+47
A more sophisticated (and modern) test harness would probably be useful, but switching to Automake's built-in test harness gets us parallel test execution, colourization of failures, simplifies matters, seems adequate for the current testuite, and means we don't need to write any icky Tcl. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2023-07-21Cygwin: get_posix_access: do not merge permissions for just created filesCorinna Vinschen1-1/+1
When creating the POSIX ACL rewrite, the code merging permissions from everyone/group to group/user ACEs was accidentally called for newly generated files as well. This could result in broken permissions, if umask used unusual values like "0100", granted permissions to everyone/group not granted to group/user. Make sure to skip permission merging if the file got just created and we only want to set correct permissions for the first time. Fixes: bc444e5aa4ca ("Reapply POSIX ACL changes.") Reported-by: Jon Turney <jon.turney@dronecode.org.uk> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-21Cygwin: Fix uninitialized use of fh in strace output in stat_worker()Jon Turney1-2/+3
Move strace output to fix uninitalized use of fh introduced in previous commit. ../../../../src/winsup/cygwin/syscalls.cc: In function ‘int stat_worker(path_conv&, stat*)’: ../../../../src/winsup/cygwin/syscalls.cc:1971:69: error: ‘fh’ may be used uninitialized [-Werror=maybe-uninitialized] Fixes: 42b44044b34d ("Cygwin: Fix Windows file handle leak in stat("file", -1)") Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2023-07-21Cygwin: Fix Windows file handle leak in stat("file", -1)Jon Turney1-3/+4
Don't leak a Windows file handle if stat() is called with a valid filename, but invalid stat buffer pointer. We do not destroy fh (which closes a Windows handle it has opened) if an exception happens in the __try block. Avoid this by re-ordering things so that we don't construct the fhandler object until after we've attempted to use the struct stat buffer. Fixes: 73151c54d581 ("syscalls.cc (stat_worker): Don't call build_fh_pc with invalid pc.") Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2023-07-21Cygwin: testsuite: Drop setting TDIRECTORYJon Turney3-15/+2
Drop setting TDIRECTORY, just use /tmp in the 'test installation' now that we have it. This effectively reverts f3ed5f2fe029d74372aca68b18936e164ff47cf7 Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2023-07-18Cygwin: don't wait infinitely on a pthread cancel eventCorinna Vinschen1-6/+3
Starting with commit 42faed412857 ("* thread.h (class pthread): Add bool member canceled."), pthread::testcancel waits infinitely on cancel_event after it checked if the canceled variable is set. However, this might introduce a deadlock, if the thread calling pthread_cancel is terminated after setting canceled to true, but before calling SetEvent on cancel_event. In fact, it's not at all necessary to wait infinitely. By definition, the thread is only canceled if cancel_event is set. The canceled variable is just a helper to speed up code. We can safely assume that the thread hasn't been canceled yet, if canceled is set, but cancel_event isn't. Fixes: 42faed412857 ("* thread.h (class pthread): Add bool member canceled.") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-07-18Fix typo.Jeff Johnston1-1/+1
2023-07-18Cygwin: testsuite: Make cancel3 and cancel5 more robustJon Turney2-4/+32
Despite our efforts, sometimes the async cancellation gets deferred. Notice this by calling pthread_testcancel(), and then try to work out if async cancellation was ever successful by checking if all threads ran for the full expected time, or if some were stopped early. Also, increase the time we allow for the async cancellation to get delivered to 30 seconds. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>