Commit Graph

19623 Commits

Author SHA1 Message Date
Jon Turney 0d0f06416a
Cygwin: Fix building of utils testsuite
Avoid referencing undefined max_mount_entry.
2020-12-02 15:31:57 +00:00
Corinna Vinschen aec6479820 Cygwin: add flag to indicate reparse points unknown to WinAPI
https://cygwin.com/pipermail/cygwin/2020-December/246938.html
reports a problem where, when adding a Cygwin default symlink
to $PATH since Cygwin 3.1.5, $PATH handling appears to be broken.

3.1.5 switched to WSL symlinks as Cygwin default symlinks.

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

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

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

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

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

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-12-02 16:14:41 +01:00
Corinna Vinschen e9bc4cccef Cygwin: path.h: add comments to briefly explain path_types
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-12-02 16:14:41 +01:00
Corinna Vinschen 702bec7bc9 Cygwin: testsuite: libltp: fix warnings showing up with -Wall
This libltp is old as old dirt and still using K&R style.
If it's really to be used again at all, it needs a serious
refresh.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-12-02 14:12:56 +01:00
Corinna Vinschen 80e35a211f Cygwin: /proc/sys FS: don't export NFS and DFS as block devices
Network filesystems are not block devices.  Apparently this code
hasn't been executed anyway, given how network filesystems are
hidden behind \Device\Mup.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-12-01 09:37:10 +01:00
Christian Franke 3434d35a64 Cygwin: Fix access to block devices below /proc/sys.
Use fhandler_dev_floppy instead of fhandler_procsys for such devices.
The read()/write() functions from fhandler_procsys do not ensure
sector aligned transfers and lseek() fails always.

Signed-off-by: Christian Franke <franke@computer.org>
2020-11-30 11:53:00 +01:00
Jon Turney 7fa8405d3f
Cygwin: Have cygmagic not create output if an error occurs
Improve the 'cygmagic' script, so it doesn't create the output file if
an error occurs, even in one of the backtick-enclosed pipelines it runs.
2020-11-25 13:34:18 +00:00
Jon Turney 47e698cc04
Cygwin: Use standard CXXFLAGS when compiling localtime_wrapper.c
This has an separate, explicit compilation rule which omits CXXFLAGS, so
expected flags like '-g -O2' aren't being used.
2020-11-25 13:34:07 +00:00
Jon Turney 6fbe3254a7
Cygwin: Drop libgmon.a build dependency on gcrt0.o
libgmon.a depends on gcrt0.o, but doesn't include it.
2020-11-25 13:34:00 +00:00
Takashi Yano via Cygwin-patches 796044ddcf Cygwin: pty: Fix minor style issue. 2020-11-23 16:23:27 +01:00
Takashi Yano via Cygwin-patches 2eee095928 Cygwin: pty: Discard "OSC Ps; ? BEL/ST" in pseudo console output.
- If vim is executed in WSL in mintty, some garbage string caused
  by "OSC Ps;? BEL/ST" will be shown in some situations. This patch
  fixes the issue by removing "OSC Ps;? BEL/ST" from pseudo console
  output.
2020-11-23 16:23:27 +01:00
Takashi Yano via Cygwin-patches 65ee05d326 Cygwin: pty: Fix a bug in the code removing "CSI > Pm m".
- The code added by 8121b606e8 has a
  bug which fails to remove multiple "CSI > Pm m" sequences. This
  patch fixes the bug.
2020-11-23 16:23:27 +01:00
Jon Turney fccb9d7239
Cygwin: Remove surplus autoconf auxiliary files
Since we are now only configuring once, in winsup, with
AC_CONFIG_AUX_DIR(..), the auxiliary files are taken from the top-level.

(Previously we had a random assorment of AC_CONFIG_AUX_DIR(..) and
AC_CONFIG_AUX_DIR(../..) in winsup subdirectories, so auxiliary files
would be taken from winsup or the top-level.)
2020-11-20 15:56:21 +00:00
Jon Turney dc93f7ef2d
Cygwin: Remove recursive configure
There's doesn't seem to be much use in independently distributing these
subdirectories, so allowing them to be independently configured seems
pointless and overcomplicated.

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

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

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

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

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

Remove generated configure and aclocal.m4 in subdirectories.
2020-11-20 15:56:11 +00:00
Ken Brown 11c5fd6abd Cygwin: fhandler_fifo::cleanup_handlers: improve efficiency
Traverse the fifo_client_handler list from the top down to try to
avoid copying.
2020-11-19 15:22:56 -05:00
Jon Turney 9ea6f38dea
Cygwin: Testsuite Makefile cleanup
Drop unused variables CC_FOR_TARGET, GCC_INCLUDE, ALL_CFLAGS
Stop exporting CC, CFLAGS
Drop unused, empty targets force, dll_ofiles, all_target
2020-11-18 16:26:37 +00:00
Jon Turney cbf8fe6dca
Cygwin: Fix 'make check' in utils
This has a test of the path translation code used in various utilities
(mount, cygpath, strace).

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

> $ make check
[...]
> total tests: 63
> pass       : 63 (100.0%)
> fail       : 0 (0.0%)
2020-11-18 16:26:36 +00:00
Jon Turney 7d5efba796
Cygwin: Drop duplicate C++ flags used to build utils
'-fno-exceptions -fno-rtti' are already present in the compile command
COMPILE.cc set by Makefile.common, so we don't need to add them to
CXXFLAGS as well.
2020-11-18 16:26:35 +00:00
Jon Turney ff315bd18f
Cygwin: Use grep in text mode to look for version strings
Invoke grep in text mode when looking for version strings inside the
cygwin DLL, so it outputs something more informative than:

  Binary file ../cygwin/cygwin0.dll matches
2020-11-18 16:26:23 +00:00
Kito Cheng 57635f8581 RISC-V: Add machine-specific implementation for lrint[f], lround[f], llrint[f] and llround[f]. 2020-11-18 09:35:28 +01:00
Kito Cheng 5cf5a2e4c0 RISC-V: Add machine-specific implementation for isnan[f] and copysign[f] 2020-11-18 09:35:28 +01:00
Kito Cheng a7f82939d8 RISC-V: Add missing compile rule for s_finite.c, sf_finite.c, s_isinf.c and sf_isinf.c 2020-11-18 09:35:28 +01:00
Corinna Vinschen aa106b29a6 malloc/nano-malloc: correctly check for out-of-bounds allocation reqs
The overflow check in mEMALIGn erroneously checks for INT_MAX,
albeit the input parameter is size_t.  Fix this to check for
__SIZE_MAX__ instead.  Also, it misses to check the req against
adding the alignment before calling mALLOc.

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

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-11-17 10:52:34 +01:00
Sebastian Huber 14a1e7ce42 Fix return type of __locale_ctype_ptr_l()
This prevents warnings like this:

ctype.h:118:9: warning: return discards 'const' qualifier from pointer
  target type
2020-11-16 19:34:30 +01:00
Corinna Vinschen 3b80191f33 Cygwin: testsuite: fix insecure usage of printf in libltp
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-11-16 15:57:31 +01:00
Joel Sherrill 302b82afee libc/include/newlib.h: Fix C++ compilation issue 2020-11-16 08:15:18 -06:00
Ken Brown 22d1ebacfc Cygwin: path_conv::eq_worker: add NULL pointer checks
Don't call cstrdup on NULL pointers.

This fixes a crash that was observed when cloning an fhandler whose
path_conv member had freed its strings.
2020-11-16 08:15:31 -05:00
Jon Turney 140b0a6484
Cygwin: Fix testsuite tmpdir creation with non-default cygdrive prefix 2020-11-12 15:30:35 +00:00
Ken Brown f505e7a032 Cygwin: fhandler_fifo: reduce size
Replace the 'WCHAR pipe_name_buf[48]' class member by 'PWCHAR
pipe_name_buf', and allocate space for the latter as needed.

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

Also change get_pipe_name and clone to accommodate this change.
2020-11-09 08:47:29 -05:00
Jon Turney f3ed5f2fe0
Cygwin: Ensure temporary directory used by tests exists
By default, libltp tests will create temporary files in a subdirectory
of /tmp, which will (nowadays) be located relative to the test DLL (by
assuming that it is in /bin).  This will evaluate to the directory
$target_builddir/winsup/tmp, which doesn't exist.

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

Unfortunately, libltp doesn't clean the temporary directory if
TDIRECTORY is set, and some tests assume they are started in a clean
directory, so we need to do that in tcl.
2020-11-08 14:42:02 +00:00
Jon Turney 9cdb799806
Cygwin: Set PATH for tests to pick up cygwin0.dll
Set the PATH so that tests can pick up cygwin0.dll.  Looks like this was
dropped by accident in 2e488e95 ("Don't rely on in-build tools"), so
restore it as it was prior to 9d89f634.
2020-11-08 14:41:55 +00:00
Jon Turney 0c448d53e1
Cygwin: Check exit code of a test, rather than stdout
In winsup.exp, don't consider a command failed if it produced any output
(e.g. if the compiler produced warnings).  Instead check the exit code.
2020-11-08 14:41:46 +00:00
Jon Turney fb967562b0
Cygwin: Use absolute path to libltp includes
Use an absolute path to libltp includes, to allow for the fact that
we'll be compiling tests in a subdirectory.
2020-11-08 14:41:38 +00:00
Jon Turney e6248c2fd0
Cygiwn: Detect and use MinGW compilers for testsuite wrappers
Drop MINGW_FE, which I can't find any trace of, and instead detect and
use MinGW compilers.

This requires adding AC_CANONICAL_TARGET, to set $target_cpu.
2020-11-08 14:41:28 +00:00
Jon Turney 20b5e6375c
Cygwin: Define target_builddir autoconf and Makefile variables
This is now required as cygwin_build is defined in terms of
target_builddir.

(Note that in other subdirectories, the autoconf variable
target_builddir is AC_SUBST-ed as a side-effect of using a macro from
winsup/acinclude.m4, which is perhaps less than ideal)
2020-11-08 14:41:08 +00:00
Jon Turney 551df57fa0
Cygwin: Move adding libltp to VPATH after Makefile.common
Move adding libltp to the VPATH after Makefile.common, which sets VPATH.
2020-11-08 14:40:59 +00:00
Jon Turney 187281b711
Cygwin: Avoid 'Makefile.in seems to ignore the --datarootdir setting' warning
Avoid a 'Makefile.in seems to ignore the --datarootdir setting' warning
when configuring in testsuite directory.
2020-11-08 14:40:47 +00:00
Jon Turney 7b65f83c22
Cygwin: Add rule to testsuite Makefile to regenerate it when needed 2020-11-08 14:40:41 +00:00
Jon Turney a7cb126b14
Cygwin: Always configure in testsuite subdirectory
Doing this properly using AC_CONFIG_SUBDIRS is necessary to get the
correct paths in flags given to the compiler specified in CC/CXX.
2020-11-08 14:40:34 +00:00
Jon Turney 58ca21cf78
Cygwin: Add testsuite directory to autogen.sh
Also remove unneeded aclocal.m4 for an old aclocal version.
2020-11-08 14:40:26 +00:00
Ken Brown 26a5aff2a9 Cygwin: FIFO: update_my_handlers: fix handle leak 2020-11-06 08:16:45 -05:00
Ivan Grokhotov b7a357e92e Fix 32-bit integer overflow when calculating TZ rules 2020-11-04 13:33:36 -05:00
Jon Turney 5f3a301fd5
Cygwin: Drop passing '-c' compiler flag into gentls_offsets
That script appends a '-E', since we only use $(CC) to preprocess, and
thus adding '-c' is having no effect.
2020-11-02 16:49:03 +00:00
Jon Turney 22d79c79b5
Cygwin: Remove rules for building libcygwin_s.a
Untouched since added in 66a83f3e, and described as 'non-working'.
2020-11-02 16:49:02 +00:00
Jon Turney a5398eaecb
Cygwin: Remove Makefile contents conditional on PREPROCESS, which is never defined 2020-11-02 16:49:01 +00:00
Jon Turney f4bfaddb3c
Cygwin: Drop autoconf variable all_host
The autoconf variable all_host is used to make building of the stub
library used by the testsuite conditional on not cross-compiling.

Make it unconditional, so we will notice if it's broken when
cross-compiling.
2020-11-02 16:49:00 +00:00
Jon Turney 29817cc41e
Cygwin: Remove autoconf variable DLL_NAME
Remove autoconf variable DLL_NAME, which has a constant value which is
only used in one place.
2020-11-02 16:48:59 +00:00
Jon Turney d555072c94
Cygwin: Drop AC_SUBST(build_exeext)
The autoconf variable build_exeext isn't defined, and (since the doc
subdirectory doesn't build any executables) it's value isn't used.
2020-11-02 16:48:58 +00:00
Jon Turney 174268f4bb
Cygwin: Remove intro2man.stamp on clean 2020-11-02 16:48:57 +00:00
Jon Turney 9517e5f503
Revert "Cygwin: gendef generates sigfe.s and cygwin.def"
This reverts commit 74a164f1c1.

Shame we can't use '&:' for a grouped target here, since that requires
GNU make 4.3
2020-10-30 16:31:08 +00:00