Commit Graph

8689 Commits

Author SHA1 Message Date
Ken Brown 5fb3790422 Cygwin: re-implement fhandler_fifo::open with O_PATH
If the O_PATH flag is set, fhandler_fifo::open now simply calls
fhandler_base::open_fs.

The previous attempt to handle O_PATH in commit aa55d22c, "Cygwin:
honor the O_PATH flag when opening a FIFO", fixed a hang but otherwise
didn't do anything useful.
2020-01-24 11:24:18 +01:00
Ken Brown d880e97ec9 Cygwin: device_access_denied: return false if O_PATH is set
If O_PATH is set in the flags argument of
fhandler_base::device_access_denied, return false.  No
read/write/execute access should be required in this case.

Previously, the call to device_access_denied in open(2) would lead to
an attempt to open the file with read access even if the O_PATH flag
was set.
2020-01-24 11:24:18 +01:00
Corinna Vinschen 71091d165f Cygwin: Bump DLL version to 3.1.3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-01-24 10:17:31 +01:00
Brian Inglis 8f502bd331 fhandler_proc.cc:format_proc_cpuinfo add rdpru flag
rdpru flag is cpuid xfn 80000008 ebx bit 4 added in linux 5.5;
see AMD64 Architecture Programmer's Manual Volume 3:
General-Purpose and System Instructions
https://www.amd.com/system/files/TechDocs/24594.pdf#page=329
and elsewhere in that document
2020-01-23 13:41:23 +01:00
Takashi Yano 5fdcb8fc13 Cygwin: pty: Remove close() call just before reopening slave.
- After commit da4ee7d60b, the issue
  reported in https://www.cygwin.com/ml/cygwin/2020-01/msg00209.html
  occurs. This patch fixes the issue.
2020-01-23 13:32:26 +01:00
Corinna Vinschen 6d79e0a588 add pseudo console fixes to release text
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-01-22 11:05:51 +01:00
Takashi Yano cdf5db22f1 Cygwin: pty: Introduce disable_pcon in environment CYGWIN.
- For programs which does not work properly with pseudo console,
  disable_pcon in environment CYGWIN is introduced. If disable_pcon
  is set, pseudo console support is disabled.
2020-01-22 10:56:10 +01:00
Takashi Yano da4ee7d60b Cygwin: pty: Fix reopening slave in push_to_pcon_screenbuffer().
- For programs compiled with -mwindows option, reopening slave is
  needed in push_to_pcon_screenbuffer(), however, it was not at
  appropriate place. This causes the problem reported in
  https://www.cygwin.com/ml/cygwin/2020-01/msg00161.html. This
  patch fixes the issue.
2020-01-22 09:57:03 +01:00
Takashi Yano 6cc299f0e2 Cygwin: pty: Revise code waiting for forwarding by master_fwd_thread.
- Though this rarely happens, sometimes the first printing of non-
  cygwin process does not displayed correctly. To fix this issue,
  the code for waiting for forwarding by master_fwd_thread is revised.
2020-01-21 10:31:15 +01:00
Ken Brown 4261a8f5ca Cygwin: document recent changes 2020-01-20 09:47:41 -05:00
Ken Brown 352dbd304b Cygwin: fstatat, fchownat: support the AT_EMPTY_PATH flag
Following Linux, allow the pathname argument to be an empty string if
the AT_EMPTY_PATH flag is specified.  In this case the dirfd argument
can refer to any type of file, not just a directory, and the call
operates on that file.  In particular, dirfd can refer to a symlink
that was opened with O_PATH | O_NOFOLLOW.
2020-01-20 09:47:15 -05:00
Ken Brown 6cc05784e1 Cygwin: readlinkat: allow pathname to be empty
Following Linux, allow the pathname argument to be an empty string,
provided the dirfd argument refers to a symlink opened with
O_PATH | O_NOFOLLOW.  The readlinkat call then operates on that
symlink.
2020-01-17 10:27:48 -05:00
Ken Brown 35a1a6dbdf Cygwin: allow opening a symlink with O_PATH | O_NOFOLLOW
Up to now, opening a symlink with O_NOFOLLOW fails with ELOOP.
Following Linux, allow this to succeed if O_PATH is also specified.
2020-01-17 07:43:02 -05:00
Ken Brown 85aff2830a Cygwin: normalize_win32_path: allow drive without trailing backslash
Commit 283cb372, "Cygwin: normalize_win32_path: improve error
checking", required a prefix '\\?\' or '\??\' in the source path to be
followed by 'UNC\' or 'X:\', where X is a drive letter.  That was too
restrictive, since it disallowed the paths '\\?\X: and '\??\X:'.  This
caused problems when a user tried to use the root of a drive as the
Cygwin installation root, as reported here:

  https://cygwin.com/ml/cygwin/2020-01/msg00111.html

Modify the requirement so that '\??\X:' and '\\?\X:' are now allowed
as source paths, without a trailing backslash.
2020-01-17 07:37:29 -05:00
Takashi Yano 7e6c96d6e1 Cygwin: pty: Fix state mismatch caused in octave gui.
- In octave gui, sometimes state mismatch between real pty state
  and state variable occurs. For example, this occurs when 'ls'
  command is executed in octave gui. This patch fixes the issue.
2020-01-17 10:20:43 +01:00
Takashi Yano 50e2a63b04 Cygwin: pty: Set console code page only if pseudo console is enabled.
- Input UTF-8 chars are garbled in ConEmu with cygwin connector if
  the environment does not support pseudo console. This patch fixes
  the issue.
2020-01-14 17:19:49 +01:00
Takashi Yano 2f415d5efa Cygwin: pty: Disable FreeConsole() on close for non cygwin process.
- After commit e1a0775dc0, the problem
  reported in https://www.cygwin.com/ml/cygwin/2020-01/msg00093.html
  occurs. For Gnu scren and tmux, calling FreeConsole() on pty close
  is necessary. However, if FreeConsole() is called, cygwin setup
  with '-h' option does not work. Therefore, the commit
  e1a0775dc0 delayed closing pty.
  This is the cause of the problem above. Now, instead of delaying
  pty close, FreeConsole() is not called if the process is non cygwin
  processes such as cygwin setup.
2020-01-14 17:19:19 +01:00
Takashi Yano 783eaa888f Cygwin: console: Add code to restore console mode on close.
- The console with 24bit color support has a problem that console
  mode is changed if cygwin process is executed in cmd.exe which
  started in cygwin shell. For example, cursor keys become not
  working if bash -> cmd -> true are executed in this order.
  This patch fixes the issue.
2020-01-14 17:18:25 +01:00
Takashi Yano f03806b68a Cygwin: console: Add workaround for broken CSI3J in Win10 1809.
- In Win10 1809, the cursor position sometimes goes out of screen
  by clear command in console. This seems to be caused by escape
  sequence CSI3J (ESC[3J). This happens only for 1809. This patch
  is a workaround for the issue.
2020-01-14 17:17:20 +01:00
Takashi Yano d7478090d6 Cygwin: console: Disable xterm mode for non cygwin process only.
- Special function keys such as arrow keys or function keys do not
  work in ConEmu with cygwin-connector after commit
  6a06c6bc8f. This patch fixes the
  issue.
2020-01-14 17:16:50 +01:00
Takashi Yano bb30582a99 Cygwin: pty: Add missing CloseHandle() calls.
- PTY code which support pseudo console has a problem that causes
  handle leaks. Four of these are bug in pty code, and the other
  one seems to be a bug of Windows10. ClosePseudoConsole() fails
  to close one internal handle. This patch fixes the issue.
2020-01-14 17:16:11 +01:00
Takashi Yano bb7741acf8 Cygwin: pty: Fix the issue regarding open and close multiple PTYs.
- If two PTYs are opened in the same process and the first one
  is closed, the helper process for the first PTY remains running.
  This patch fixes the issue.
2020-01-14 17:15:34 +01:00
Takashi Yano a1c7e92084 Cygwin: select: Speed up select() call for pty, pipe and fifo.
- The slowing down issue of X11 forwarding using ssh -Y, reported
  in https://www.cygwin.com/ml/cygwin/2019-12/msg00295.html,
  is due to the change of select() code for pty in the commit
  915fcd0ae8. cygthread::detach()
  takes at most about 10msec because Sleep() is used in the thread.
  For this issue, this patch uses cygwait() instead of Sleep() and
  introduces an event to abort the wait. For not only pty, but pipe
  and fifo also have the same problem potentially, so this patch
  applies same strategy to them as well.
2020-01-13 17:31:26 +01:00
Takashi Yano a6e87f589a Cygwin: console: Make suspending process work properly.
- After commit f4b47827cf, suspending
  process by Ctrl-Z does not work in console and results in hang up.
  This patch fixes the issue.
2020-01-13 17:26:32 +01:00
Takashi Yano b3e78186d1 Cygwin: pty: Revise the code for setting code page of pseudo console.
- Fix the problem which overrides the code page setting, reported
  in https://www.cygwin.com/ml/cygwin/2019-12/msg00292.html.
2020-01-13 17:00:14 +01:00
Takashi Yano fd03749b9c Cygwin: pty: Remove destructor for fhandler_pty_master class.
- The destructor for fhandler_pty_master class does not seem to be
  necessary anymore. Therefore, it has been removed.
2020-01-13 16:51:17 +01:00
Arseniy Lartsev 4ddf5903fd Fixed crash on wine by adding NULL check after memchr
This is not a joke, there are vendors out there who build software for cygwin
only. Besides, this NULL check is good to have anyway.
2020-01-13 16:34:36 +01:00
Mark Geisert 7b6414d459 Cygwin: Add missing Linux #define of CPU_SETSIZE
Though our implementation of cpu sets doesn't need it, software from
Linux environments expects this definition to be present.  It's
documented on the Linux CPU_SET(3) man page but was left out due to
oversight.

Addresses https://cygwin.com/ml/cygwin/2019-12/msg00248.html
2020-01-13 16:32:51 +01:00
Ken Brown 3bc79b275e Cygwin: FIFO: use FILE_PIPE_REJECT_REMOTE_CLIENTS flag
Add that flag to the pipe type argument when creating the Windows
named pipe.  And add a definition of that flag to ntdll.h (copied from
/usr/include/w32api/ddk/ntifs.h).
2019-12-21 17:53:52 -05:00
Corinna Vinschen b42d565150 Cygwin: add 3.1.2 release text
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-21 11:44:08 +01:00
Takashi Yano 27202a1b14 Cygwin: pty: Fix ESC[?3h and ESC[?3l handling again.
- Even with commit fe512b2b12, pty
  still has a problem in ESC[?3h and ESC[?3l handling if invalid
  sequence such as ESC[?$ is sent. This patch fixes the issue.
2019-12-19 12:28:20 +01:00
Takashi Yano fe512b2b12 Cygwin: pty: Fix a bug regarding ESC[?3h and ESC[?3l handling.
- Midnight commander (mc) does not work after the commit
  1626569222 as reported in
  https://www.cygwin.com/ml/cygwin/2019-12/msg00173.html.
  This patch fixes the issue.
2019-12-18 20:20:13 +01:00
Corinna Vinschen 7fc78f07ed Cygwin: Bump DLL version to 3.1.2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-18 10:48:10 +01:00
Corinna Vinschen 5317e3f4ec Cygwin: add 3.1.1 release text belatedly
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-18 10:47:43 +01:00
Corinna Vinschen 26cc7769b4 Cygwin: autoload: Add missing GetProcessGroupAffinity/GetThreadGroupAffinity
Both functions were introduce with Windows 7 only, so we need to
autoload them for the sake of Vista/2008.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-17 16:44:54 +01:00
Corinna Vinschen d3574fc148 Cygwin: Bump DLL version to 3.1.1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-16 21:09:50 +01:00
Corinna Vinschen f69b2421bb Cygwin: add strtold fix to release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-16 16:39:17 +01:00
Corinna Vinschen 29ba52da95 Cygwin: ilogbl: Make sure to return FP_ILGB0 on zero input
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-12-16 10:50:17 +01:00
Ken Brown 69772c4332 Cygwin: document the last bugfix 2019-12-10 08:45:17 -05:00
Ken Brown 48fbe173f4 Cygwin: symlink_info::check: avoid assertion failure
On certain error conditions there is a code snippet that checks
whether the last component of the path has a trailing dot or space or
a leading space.  Skip this check if the last component is empty,
i.e., if the path ends with a backslash.  This avoids an assertion
failure if the trailing backslash is the only backslash in the path,
as is the case for a DOS drive 'X:\'.

Addresses: https://cygwin.com/ml/cygwin/2019-12/msg00016.html
2019-12-09 07:43:44 -05:00
Anton Lavrentiev via cygwin-patches 8574f8a1e4 Cygwin: /proc/[PID]/stat to pull process priority correctly
Fix to prior commit 5fa9a0e7 to address https://cygwin.com/ml/cygwin/2019-08/msg00082.html
2019-12-02 09:57:04 +01:00
Takashi Yano edb1be4cce Cygwin: pty: Convert CamelCase names to snake_case names. 2019-11-18 11:12:08 +01:00
Takashi Yano 1626569222 Cygwin: pty: Trigger redraw screen if ESC[?3h or ESC[?3l is sent.
- Pseudo console clears console screen buffer if ESC[?3h or ESC[?3l
  is sent. However, xterm/vt100 does not clear screen. This cause
  mismatch between real screen and console screen buffer. Therefore,
  this patch triggers redraw screen in that situation so that the
  synchronization is done on the next execution of native app.
  This solves the problem reported in:
  https://www.cygwin.com/ml/cygwin-patches/2019-q4/msg00116.html
2019-11-15 13:07:40 +01:00
Takashi Yano 8f8522c82a Cygwin: console: Revise the code checking if the console is legacy.
- Accessing shared_console_info before initializing causes access
  violation in checking if the console is legacy mode. This patch
  fixes this issue. This solves the problem reported in:
  https://www.cygwin.com/ml/cygwin-patches/2019-q4/msg00099.html
2019-11-13 10:27:46 +01:00
Takashi Yano 7ef4290a98 Cygwin: pty: Use redraw screen instead of clear screen.
- Previously, pty cleared screen at startup for synchronization
  between the real screen and console screen buffer for pseudo
  console. With this patch, instead of clearing screen, the screen
  is redrawn when the first native program is executed after pty
  is created. In other words, synchronization is deferred until
  the native app is executed. Moreover, this realizes excluding
  $TERM dependent code.
2019-11-13 09:56:41 +01:00
Mark Geisert 04d85dea57 Cygwin: Doc change to note stackdump limit patch 2019-11-08 10:23:08 +01:00
Mark Geisert 7c9c94b9c8 Cygwin: Raise dumpstack frame limit to 32
Create a #define for the limit and raise it from 16 to 32.
2019-11-08 10:23:08 +01:00
Takashi Yano 3880efb283 Cygwin: console, pty: Prevent error in legacy console mode. 2019-11-08 10:08:45 +01:00
Takashi Yano e5db0d2fe0 Cygwin: pty: Change how to determine if running as service or not. 2019-11-06 15:06:05 +01:00
Corinna Vinschen 44432b93ad Cygwin: document console helper patch
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-11-05 11:57:32 +01:00