Commit Graph

818 Commits

Author SHA1 Message Date
Takashi Yano cac5f8781a Cygwin: pty: Prevent the helper process from exiting by Ctrl-C. 2019-09-14 09:17:27 -04:00
Takashi Yano 169d65a577 Cygwin: pty: add pseudo console support.
- Support pseudo console in PTY. Pseudo console is a new feature
  in Windows 10 1809, which provides console APIs on virtual
  terminal. With this patch, native console applications can work
  in PTYs such as mintty, ssh, gnu screen or tmux.
2019-08-29 13:47:40 +02:00
Mark Geisert e3ca53d9db Cygwin: ldd: Try harder to get dll names
Borrow a trick from strace to lessen occurrences of "??? => ???" in ldd
output.  Specifically, if the module name isn't found in the usual place
in the mapped image, use the file handle we have to look up the name.
2019-08-15 09:56:11 +02:00
Corinna Vinschen 3b4685bf97 Cygwin: ps: fix a compiler warning
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-08-12 17:30:20 +02:00
Ken Brown d730fa7b9c Cygwin: suppress GCC 8.3 errors with -Warray-bounds 2019-07-16 13:19:33 -04:00
Mark Geisert f96f7bec6b Cygwin: Build cygwin-console-helper with correct compiler 2019-06-27 09:16:05 +02:00
Mark Geisert 40b947e7d5 Cygwin: Use correct string conversion
Correct the string conversion calls so both argv elements get converted
at full precision.
2019-06-27 09:13:47 +02:00
Yaakov Selkowitz 5c2a3661c1 cygcheck: expand common_apps list
An increasing number of tools are being included in Windows which have the
same names as those included in Cygwin packages.  Indicating which one is
first in PATH can be helpful in diagnosing behavioural discrepencies
between them.

Also, fix the alphabetization of ssh.
2019-06-04 11:31:54 -04:00
Brian Inglis 23bb2f6608 get and convert boot time once and use as needed 2019-03-25 11:26:17 +01:00
Brian Inglis ee1ad64234 default ps -W process start time to system boot time when inaccessible, 0, -1 2019-03-25 11:26:17 +01:00
Corinna Vinschen ae3370bb9d Cygwin: strace: print windows and cygwin pid in event output
strace only printed the Windows PID in event output so far.

Especially now that Windows and Cygwin PID are decoupled, the
strace user might like to see the Cygwin pid in event output as
well.  However, at process startup, the process might not have
a Cygwin PID yet.

To mitigate this, always print the Windows PID and only add the
Cygwin pid if it exists.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-23 17:50:00 +01:00
Corinna Vinschen 1def2148d2 Cygwin: ps: simplify code
Always use NtQuerySystemInformation(SystemProcessIdInformation).
This drops two code paths calling NtQueryInformationProcess or
GetModuleFileNameExW and only requires to open the process
to fetch system time info.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-12 21:21:13 +01:00
Corinna Vinschen 37a046181e Cygwin: ps: show *all* processes in ps -W output
There's a long-standing bug in ps -W.  It only shows processes which ps
can open with PROCESS_QUERY_LIMITED_INFORMATION permissions.  However,
that fails for a lot of system processes. Due to that, output is
basically restricted to processes in the same session, as well as Cygwin
processes... which isn't *quite* what ps -W was supposed to do.

Basically we only need to open the process to fetch the image name.  If
that fails, utilize the undocumented SystemProcessIdInformation info
class introduced with Windows Vista, which allows to fetch the image
name by specifying the PID.  Restructure the code a bit.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-03-12 20:55:29 +01:00
Corinna Vinschen 26e0b37ed0 Cygwin: utils: MOUNT_BINARY -> MOUNT_TEXT
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-18 11:02:03 +01:00
Corinna Vinschen 5e6ce1cfb2 Cygwin: utils: kill: revert erroneously removed optind correction
When recognizing a negative pid, optind is off by one.  The
code correcting this has been erroneously removed by commit
8de660271f.  Revert that.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-18 10:22:37 +01:00
Corinna Vinschen 49ea15ef17 Cygwin: fix typo
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-02 21:15:50 +01:00
Corinna Vinschen 658f939003 Cygwin: kill(1): introduce a -W option
Allow to kill processes using Windows PIDs on the command line.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-02 21:02:00 +01:00
Corinna Vinschen f5c2d4db5b Cygwin: kill(1): revert casts required for 32 bit to avoid spurious warnings
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-02 15:32:28 +01:00
Corinna Vinschen 8de660271f Cygwin: kill(1): disallow killing process using raw Windows PID
This may end up killing the wrong process.  Only allow Cygwin PID.

Slightly clean up code: Remove outdated W95 considerations.  Fix
a bug in commandline argument processing.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-02 15:00:39 +01:00
Corinna Vinschen c1023ee353 Cygwin: path_conv: decouple path_types from mount types
- Remove another unfortunate amalgamation: Mount flags (MOUNT_xxx)
  are converted to path_types (PATH_xxx) and mixed with non-mount
  path_types flags in the same storage, leading to a tangled,
  pell-mell usage of mount flags and path flags in path_conv and
  symlink_info.

- There's also the case of PC_NONULLEMPTY.  It's used in exactly
  one place with a path_conv constructor only used in this single
  place, just to override the automatic PC_NULLEMPTY addition
  when calling the other path_conv constructors.  Crazily,
  PC_NONULLEMPTY is a define, no path_types flag, despite its
  name.

- It doesn't help that the binary flag exists as mount and path
  flag, while the text flag only exists as path flag.  This leads
  to mount code using path flags to set text/binary.  Very confusing
  is the fact that a text mount/path flag is not actually required;
  the mount code sets the text flag on non binary mounts anyway, so
  there are only two states.  However, to puzzle people a bit more,
  path_conv::binary wrongly implies there's a third, non-binary/non-text
  state.

Clean up this mess:

- Store path flags separately from mount flags in path_conv and
  symlink_info classes and change all checks and testing inline
  methods accordingly.

- Make PC_NONULLEMPTY a simple path_types flag and drop the
  redundant path_check constructor.

- Clean up the definition of pathconv_arg, path_types, and mount flags.
  Use _BIT expression, newly define in cygwin/bits.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06 20:30:14 +01:00
Corinna Vinschen 0d4b39d37b Cygwin: Add lsattr and chattr tools
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-12-26 09:24:33 +01:00
Ken Brown ed4d919c24 setfacl: Rename the option --file to --set-file, as on Linux
Retain --file as an undocumented option for backwards compatibility.
2018-08-17 11:35:24 +02:00
Corinna Vinschen 423fc83dfd Cygwin: utils: ps: use fputs to print fixed strings
Avoid gcc warning "format not a string literal and no format arguments"

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-09 08:41:18 +02:00
Corinna Vinschen 8bfb1afd6b Cygwin: utils: strace: fix format string
%ll is long valid for mingw builds.  Use this rather than %I64
to avoid a gcc warning

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-08 10:50:19 +02:00
Corinna Vinschen 37f4fea07c Cygwin: utils: change 3rd readlink param to size_t
Avoid gcc warnings

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-08 10:50:19 +02:00
Corinna Vinschen 13909bc262 Cygwin: utils: cygcheck: fix filesystem output format
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-08 10:50:13 +02:00
Mark Geisert 7f32efbf73 POSIX Asynchronous I/O support: other files
Updates to misc files to integrate AIO into the Cygwin source tree.
Much of it has to be done when adding any new syscalls.  There are
some updates to limits.h for AIO-specific limits.  And some doc mods.
2018-07-25 09:36:24 +02:00
Ken Brown 982dd20ed9 getfacl: Simplify by using acl_to_any_text 2018-07-25 09:32:36 +02:00
Ken Brown b610a9cf29 getfacl and setfacl: Align with Linux
Make getfacl print two colons instead of one after "other" and "mask".
Change the help text for setfacl to indicate that there can be either
one colon or two.
2018-07-23 17:31:09 +02:00
Corinna Vinschen 6497fdfaf4 Cygwin: fix bumptious GCC 7 warnings
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26 17:20:48 +02:00
Corinna Vinschen 26bcedda20 Cygwin: fix utils path handling in case cygdrive path is just '/'
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-16 17:21:48 +01:00
Yaakov Selkowitz e5d52a2db9 cygwin: add gencat tool
This is needed for compiling catalog files used in catgets(3) calls.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-19 13:19:21 -06:00
Yaakov Selkowitz 2cb24159fb cygwin: add LFS_CFLAGS etc. to confstr/getconf
These are used, for instance, when cross-compiling the Linux kernel.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-16 12:12:45 -06:00
Yaakov Selkowitz c37171b528 cygwin: fix getconf after commit 032aa2dba5
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-28 11:36:14 -06:00
Ken Brown 3e8323dc06 winsup/utils/dump_setup.cc: Remove the function 'base'
This was called only on filenames in /etc/setup/installed.db, which
are all basenames anyway.  Moreover, base wasn't correctly handling
filenames containing colons.
2017-10-25 17:02:26 +02:00
Fujii Hironori 4d336756fa cygwin: regtool: encode error messages correctly
Error messages of regtool can't be read, which are encoded in,
for instance, SHIFT_JIS in Japanese Windows.  Fix by using
wide chars instead of multibyte.
2017-06-20 13:17:49 +02:00
Daniel Santos b43e28aef0 strace: Fix "over-optimization" flaw in strace.
Recent versions of gcc are optimizing away the TLS buffer allocated in
main, so we need to tell gcc that it's really used.  RtlSecureZeroMemory
accomplishes this while also inlining the memset.

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
2017-04-19 20:17:04 +02:00
Jon Turney a9da3e4e67 Make ldd stop after any non-continuable exception
Ensure that ldd always stops when the exception is flagged as
non-continuable.

Also arrange for ldd to exit with a non-zero exit code if something went
wrong which prevented us from listing all dynamic dependencies.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-04-04 18:47:44 +01:00
Corinna Vinschen f5ecacfc6c Generate output with Unix line endings even from Mingw64 utils
This affects cygcheck and strace.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-02-24 20:55:14 +01:00
Jon Turney a15297381d Fix handling of '+' by 'cygcheck -p'
The form data sent to the server should be application/x-www-form-urlencoded

This replaces spaces with '+' before being RFC 1738 encoded, so a literal
'+' must be %-encoded also.

See https://cygwin.com/ml/cygwin/2014-01/msg00287.html et seq.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-01-31 19:55:38 +00:00
Corinna Vinschen 584c6643fe cygutils: Fix resource leak in get_short_paths
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-11-24 16:04:42 +01:00
Corinna Vinschen 9b01c29c04 Fix typo in kill(1)
buf is just a local buffer, sig is ultimately pointing to the
signal string.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-11-24 16:00:28 +01:00
Corinna Vinschen bb7ad4ed64 pldd: Fix resource leak and missing check if fopen failed
Fixes Coverity CID 66903

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 17:22:34 +02:00
Corinna Vinschen 79edb254ac passwd: Fix potential buffer overflow
Fixes Coverity CID 66956

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 17:16:30 +02:00
Corinna Vinschen 526107a753 mkgroup/mkpasswd: Fix potential buffer overwrite in corner case
Fixes Coverity CIDs 60076, 60077 and 60081

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 17:04:55 +02:00
Corinna Vinschen 7d5af6f0ba getfacl: Don't trust length of incoming user/groupname
Fixes Coverity CIDs 60079 and 60080

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 16:52:28 +02:00
Corinna Vinschen cf01b8f029 tzset: Fix array length given to GetGeoInfoW
Fixes Coverity CID 66916

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 16:45:21 +02:00
Corinna Vinschen 5e087a8373 strace: Fix Coverity issues
CID 66964: Don't trust environment variable without length check
CID 66968: Add missing va_end

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 16:38:48 +02:00
Corinna Vinschen 9807a501b1 cygcheck: Use snprintf instead of multiple strcat
This not only simplifies the code but also fixes potential
memory corruption

Fixes Coverity CID 66952

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 16:16:22 +02:00
Corinna Vinschen f16f20ff95 cygcheck: Eenable output of Vista++ FS flags
Also, code cleanup

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 15:57:40 +02:00