Commit Graph

584 Commits

Author SHA1 Message Date
Takashi Yano 8b502d8635 Cygwin: path: Make some symlinks to /cygdrive/* work.
- Previously, some symbolic links to /cygdrive/* (e.g. /cygdrive/C,
  /cygdrive/./c, /cygdrive//c, etc.) did not work. This patch fixes
  the issue.
  Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251994.html
2022-08-03 13:36:09 +09:00
Takashi Yano d5229f8211 Cygwin: pty: Treat *.bat and *.cmd as a non-cygwin console app.
- If *.bat or *.cmd is executed directly from cygwin shell, pty
  failed to switch I/O pipe to that for native apps. This patch
  fixes the issue.
2022-07-31 17:55:42 +09:00
Ken Brown 5d4f405d3b Cygwin: redefine some macros for Linux compatibility
Define FD_SETSIZE (<sys/select.h>) to be 1024 by default, and define
NOFILE (<sys/param.h>) to be OPEN_MAX (== 3200) by default.

Remove the comment in <sys/select.h> that FD_SETSIZE should be >=
NOFILE.

Bump API minor.

Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251839.html
2022-07-07 08:22:40 -04:00
Takashi Yano fc74dbf22f Cygwin: spawn: Treat empty path as the current directory.
- With this patch, the empty path (empty element in PATH or PATH is
  absent) is treated as the current directory as Linux does. This
  feature is added for Linux compatibility, but it is deprecated.
  POSIX notes that a conforming application shall use an explicit
  pathname to specify the current working directory.
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251730.html
2022-07-05 13:44:56 +09:00
Ken Brown 72f855f32b Cygwin: implement getfacl(1) for socket files
Do this by defining the acl_get method for the fhandler_socket_local
and fhandler_socket_unix classes.  Also define acl_set for these
classes.

Partially addresses: https://cygwin.com/pipermail/cygwin/2022-July/251768.html
2022-07-04 18:55:19 -04:00
Ken Brown 1503d14af1 Cygwin: stdio: don't try again to read after EOF
This reverts commit 1f8f7e2d54, "* libc/stdio/refill.c (__srefill):
Try again after EOF on Cygwin."  If EOF is set on a file, the stdio
input functions will now immediately return EOF rather than trying
again to read.  This aligns Cygwin's behavior to that of Linux.

Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251672.html
2022-07-04 18:55:08 -04:00
Takashi Yano 746c8116dd Cygwin: console: Allow pasting very long text input.
- Currently, if the text longer than 1024 byte is pasted in console,
  some of the text is discarded. This patch fixes the issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251764.html
2022-07-02 11:24:11 +09:00
Takashi Yano 54930ae7d7 Cygwin: poll: Fix a bug on inquiring same fd with different events.
- poll() has a bug that it returns event which is not inquired if
  events are inquired in multiple pollfd entries on the same fd at
  the same time. This patch fixes the issue.
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251732.html
2022-06-27 10:54:24 +09:00
Takashi Yano fe10e8f03a Cygwin: console: Handle setting very long window title correctly.
- Previously, the console code could not handle escape sequence
  setting window title longer than 256 byte correctly. This patch
  fixes the issue.
  Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251662.html
2022-06-19 18:02:09 +09:00
Ken Brown 98180795de Cygwin: document last bug fix 2022-05-29 17:42:06 -04:00
Ken Brown 2f8ba40046 Cygwin: fix mknod (64-bit only)
The current definition of mknod in syscalls.cc has a third argument of
type __dev16_t instead of dev_t.  Fix this on 64-bit Cygwin by making
the existing mknod 32-bit only and then exporting mknod as an alias
for mknod32.  (No fix is needed on 32-bit because mknod is redirected
to mknod32 via NEW_FUNCTIONS in Makefile.am.)

Addresses: https://cygwin.com/pipermail/cygwin-developers/2022-May/012589.html
2022-05-23 08:16:40 -04:00
Corinna Vinschen 1b86dd7d8c Cygwin: make sure exec'ed process exists early in process list
killpg(pgid, 0) (or kill_pgrp(pgid, si_signo=0), in signal.cc)
fails (returns -1) even when there is a process in the process
group pgid, if the process is in the middle of spawnve(), see

  https://cygwin.com/pipermail/cygwin/2022-May/251479.html

When exec'ing a process the assumption is that the exec'ed process creates its
own symlink (in pinfo::thisproc() in pinfo.cc). If the exec'ing process
calls NtClose on it's own winpid symlink, but the exec'ed process didn't
progress enough into initialization, there's a slim chance that neither
the exec'ing process, nor the exec'ed process has a winpid symlink
attached.

Always create the winpid symlink in spawn.cc, even for exec'ed Cygwin
processes.  Make sure to dup the handle into the new process, and stop
creating the winpid symlink in exec'ed processes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-19 10:46:41 +02:00
Takashi Yano b79d60b7d2 Cygwin: add 3.3.6 release notes 2022-05-16 20:15:17 +09:00
Corinna Vinschen 7c804d160d Cygwin: Implement GSO/GRO support
- getsockopt (SOL_UDP, UDP_SEGMENT)
- setsockopt (SOL_UDP, UDP_SEGMENT)
- getsockopt (SOL_UDP, UDP_GRO)
- setsockopt (SOL_UDP, UDP_GRO)
- sendmsg with SOL_UDP/UDP_SEGMENT control message
- recvmsg, convert Winsock UDP_COALESCED_INFO (DWORD) control message to
  Linux compatible SOL_UDP/UDP_GRO (uint16_t)
2022-05-13 11:11:38 +02:00
Mark Geisert 23a3ec3392 Cygwin: Fix "0x0x" in gmondump and ssp man pages
A recent patch fixed gmondump to stop printing "0x0x" as an address
prefix.  It turns out the Cygwin User's Guide and the gmondump and
ssp man pages (all from utils.xml) have examples of the same error.
2022-04-27 11:40:09 +02:00
Takashi Yano e9c96f0a6d Cygwin: pipe: Avoid deadlock for non-cygwin writer.
- As mentioned in commit message of the commit b531d6b0, if multiple
  writers including non-cygwin app exist, the non-cygwin app cannot
  detect pipe closure on the read side when the pipe is created by
  system account or the the pipe creator is running as service.
  This is because query_hdl which is held in write side also is a
  read end of the pipe, so the pipe is still alive for the non-cygwin
  app even after the reader is closed.

  To avoid this problem, this patch lets all processes in the same
  process group close query_hdl using newly introduced internal signal
  __SIGNONCYGCHLD when non-cygwin app is started.

  Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251097.html
2022-04-02 01:03:15 +09:00
Takashi Yano 49a00a0673 Cygwin: pty: Fix crash on master close in Windows 7.
- The 4th parameter of WriteFile() cannot be NULL especially in
  Windows 7 as mentioned in Microsoft documentation. This patch
  fixes that.

Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251162.html
2022-03-30 12:46:08 +09:00
Mark Geisert 48c9ef6780 Cygwin: document recent gmondump formatting fix 2022-03-17 10:14:38 +01:00
Takashi Yano ed32020682 Cygwin: Add description of fsync() fix to 3.3.5 release notes. 2022-03-15 08:15:29 +09:00
Takashi Yano 9e1b329431 Cygwin: update 3.3.5 release notes 2022-03-05 18:21:09 +09:00
Takashi Yano 33dda55d14 Cygwin: add 3.3.5 release notes 2022-03-05 11:19:20 +09:00
Corinna Vinschen 3e4dd6cc48 Cygwin: update 3.4 release text
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-03-01 16:27:10 +01:00
Corinna Vinschen d079ab4d37 Revert "Cygwin: fix permission problem when writing DAC info on Samba shares"
This reverts commit 0390cc8572.

There's no indication what exact situation this patch was supposed to
solve, and local testing doesn't show any such problems.  However, this
patch itself introduced a new problem, as outlined by
https://cygwin.com/pipermail/cygwin/2022-January/250629.html

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-01-27 15:31:25 +01:00
Corinna Vinschen a74707e7ac Cygwin: add resolver fixes to release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-01-19 08:51:03 +01:00
Takashi Yano ff539cc0f9 Cygwin: fhandler_base: Fix double free caused when open() fails.
- When open fails, archetype stored in archetypes[] is not cleared.
  This causes double free when next open fail. This patch fixes the
  issue.

Addresses:
  https://cygwin.com/pipermail/cygwin/2022-January/250518.html
2022-01-18 22:17:37 +09:00
Corinna Vinschen 0cae2b802b Cygwin: add release text for last two patches
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-01-18 11:57:14 +01:00
Corinna Vinschen 935c33877d posix_spawn: fix get/set uid/gid calls for 32 bit Cygwin
32 bit Cygwin still exports function calls to support old applications.
E. g., when switching from 16 to 32 bit uid/gid values, new function
like getuid32 have been added and the old getuid function still only
provides 16 bit values.  Newly built applications using getuid are
actually calling getuid32.

However, this link magic isn't performed inside Cygwin itself, so if
newlib functions call getuid, they actually call the old getuid, not
the new getuid32.  This leads to truncated uid/gid values.

https://cygwin.com/pipermail/cygwin/2022-January/250453.html reports
how this leads to problems in posix_spawn.

Fix this temporarily. i686 support will go away soon in Cygwin and the
fix can be dropped.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-01-12 11:57:35 +01:00
Corinna Vinschen a2bfe7cae6 Cygwin: ACLs: ignore *_INHERIT flags in file ACLs
get_posix_access() creates DEF_*_OBJ aclent_t entries from Windows ACEs
with INHERIT flags set, independent of the file type.  These flags only
make sense on directory objects, but certain Windows functions don't
check the file type and allow INHERIT ACE flags even on non-directories.

As a fix, make sure to ignore the INHERIT flags on non-directory ACLs
and don't propagate the matching DEF_*_OBJ aclent_t entries to callers.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-01-11 22:22:03 +01:00
Ken Brown 0ce992c1e4 Cygwin: fhandler_pipe::get_query_hdl_per_process: avoid a crash
NtQueryInformationProcess(ProcessHandleInformation) can return
STATUS_SUCCESS with invalid handle data for certain processes
("minimal" processes on Windows 10).  This can cause a crash when
there's an attempt to access that data.  Fix that by setting
NumberOfHandles to zero before calling NtQueryInformationProcess.

Addresses: https://cygwin.com/pipermail/cygwin-patches/2021q4/011611.html
2021-12-26 18:29:23 -05:00
Ken Brown 451bbfb9f3 Cygwin: Document that the pipe_byte option is now set by default 2021-12-12 22:14:12 +09:00
Takashi Yano acc44e09d1 Cygwin: pty: Add missing input transfer when switch_to_pcon_in state.
- This patch fixes the bug that input is wrongly sent to io_handle_nat
  rather than io_handle when neither read() nor select() is called
  after the cygwin app is started from non-cygwin app. This happens
  only if psuedo console is disabled.

Addresses:
  https://cygwin.com/pipermail/cygwin-patches/2021q4/011587.html
2021-12-12 21:46:05 +09:00
Takashi Yano 30089b3fbd Cygwin: path: Convert UNC path prefix back to drive letter.
- When symlink_info::check() is called with the path having drive
  letter and UNC path is mounted to the drive, the path is replaced
  with UNC path. With this patch, UNC path prefix is converted back
  to drive letter.  This fixes the issue:
  https://cygwin.com/pipermail/cygwin/2021-November/250087.html
  https://cygwin.com/pipermail/cygwin/2021-December/250103.html
2021-12-08 20:20:30 +09:00
Takashi Yano 69ed8ca20c Cygwin: clipboard: Fix a bug in read().
- Fix a bug in fhandler_dev_clipboard::read() that the second read
  fails with 'Bad address'.

Addresses:
  https://cygwin.com/pipermail/cygwin/2021-December/250141.html
2021-12-07 23:38:50 +09:00
Corinna Vinschen 3502a6ff2e Cygwin: add 3.4 release messages
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-26 17:06:00 +01:00
Takashi Yano e84b43ea93 Cygwin: Fix release note 3.3.3.
- Removes the bug fix entry that was accidentally added to the
  release notes 3.3.3, even though it had been already fixed in
  3.3.2.
2021-11-23 01:19:56 +09:00
Corinna Vinschen 68faeef4be ldtoa: don't restrict outbuf size to ndigits
https://cygwin.com/pipermail/cygwin/2021-November/249930.html
reported a regression introduce by using a dynamically sized local
char array in favor of a statically sized array.

Fix this by reverting to a statically sized array, using a small
buffer on the stack for a reasonable number of requested digits, a
big mallocated buffer otherwise.  This should work for small targets
as well, given that malloc is used in printf anyway right now.

This is *still* hopefully just a temporary measure, unless somebody
actually provides a new ldtoa.

Fixes: 4d90e53359 ("ldtoa: fix dropping too many digits from output")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-22 13:57:16 +01:00
Corinna Vinschen 1fda4aebd6 Cygwin: add release message for raise fix
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-22 12:38:15 +01:00
Takashi Yano b959a54321 Cygwin: Correct the release notes 3.3.3.
- Fix incorrect description of the bug fixes part.
2021-11-18 02:46:02 +09:00
Takashi Yano 5badb8aa0a Cygwin: pipe: Handle STATUS_PENDING even for nonblocking mode.
- NtReadFile() and NtWriteFile() seems to return STATUS_PENDING
  occasionally even in nonblocking mode. This patch adds handling
  for STATUS_PENDING in nonblocking mode.

Addresses:
  https://cygwin.com/pipermail/cygwin/2021-November/249910.html
2021-11-17 08:14:23 +09:00
Corinna Vinschen 41de4b6fd7 Cygwin: fix up cached DOS file attributes after file creation
The file attributes after creating a file are not necessarily
identical to the attributes we passed as argument to NtCreateFile.
This results in subsequent operations like fchmod or facl to
set the DOS file attributes to unexpected values.

The fix is to request file attributes from the OS after file creation
and cache those.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-16 19:58:56 +01:00
Corinna Vinschen 9980177def Revert "Cygwin: set the FILE_ATTRIBUTE_ARCHIVE DOS attribute on file creation"
This reverts commit 2b28977149.

This patch fixes the symptoms, but not the actual problem.  Revert
and try again.
2021-11-16 19:58:56 +01:00
Johannes Schindelin 782aac590a Cygwin: console: Handle Unicode surrogate pairs.
When running Cygwin's Bash in the Windows Terminal (see
https://docs.microsoft.com/en-us/windows/terminal/ for details), Cygwin
is receiving keyboard input in the form of UTF-16 characters.

UTF-16 has that awkward challenge that it cannot map the full Unicode
range, and to make up for it, there are the ranges U+D800-U+DBFF and
U+DC00-U+DFFF which are illegal except when they come in a pair encoding
for Unicode characters beyond U+FFFF.

Cygwin does not handle such surrogate pairs correctly at the moment, as
can be seen e.g. when running Cygwin's Bash in the Windows Terminal and
then inserting an emoji (e.g. via Windows + <dot>, which opens an emoji
picker on recent Windows versions): Instead of showing an emoji, this
shows the infamous question mark in a black triangle, i.e. the invalid
Unicode character.

Let's special-case surrogate pairs in this scenario.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2021-11-16 23:20:43 +09:00
Corinna Vinschen 2b28977149 Cygwin: set the FILE_ATTRIBUTE_ARCHIVE DOS attribute on file creation
Do this for normal files and symlinks, not for temporary files,
device files or unix sockets.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-15 20:59:41 +01:00
Corinna Vinschen 98d10e5fd2 Cygwin: dllfixdbg: create .gnu_debuglink section in the right spot
A recent change in binutils marks the .gnu_debuglink_overlay section
as debug section.  When dllfixdbg calls objcopy -g, the section
is removed and the --add-gnu-debuglink option on the same command line
appends the section consequentially at the end of the sections.
This in turn breaks Windows Version info and, potentially, raising
the cygheap size at runtime.

Fix this by adding an explicit --keep-section=.gnu_debuglink_overlay
to the objcopy command line.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-15 13:44:57 +01:00
Corinna Vinschen 88c9008bb2 Cygwin: add 3.3.3 release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-11 11:01:23 +01:00
Takashi Yano 365199090c Cygwin: pipe: Avoid false EOF while reading output of C# programs.
- If output of C# program is redirected to pipe, pipe reader falsely
  detects EOF. This happens after overhaul of pipe implementation.
  This patch fixes the issue.

Addresses:
  https://cygwin.com/pipermail/cygwin/2021-November/249777.html
2021-11-08 11:06:58 +01:00
Corinna Vinschen 55dd0676ce Cygwin: fix permission problem when writing DAC info on Samba shares
Cygwin always requests FILE_WRITE_ATTRIBUTES permissions when trying to
change DAC information.  This can lead to permission problems when
trying to chmod/chown files on Samba shares.  Drop requesting
FILE_WRITE_ATTRIBUTES on Samba shares and go with WRITE_DAC/WRITE_OWNER
only.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-04 21:52:35 +01:00
Corinna Vinschen e37bfc8ba1 Cygwin: Add a new 3.4.0 rel notes file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-04 13:14:17 +01:00
Corinna Vinschen c41fd516e0 Cygwin: add release note for rounding issue
Also rename release 3.4.0 to 3.3.2.  It doesn't make sense to
duplicate the issues fixed in 3.3.x into the 3.4.0 relnotes.
Only patches not backported into 3.3.x belong into 3.4.0.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-04 13:14:17 +01:00
Corinna Vinschen eb628ca8ea Cygwin: add release note
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-11-02 15:10:58 +01:00