A process which is exiting due to a core dumping signal doesn't
propagate the correct exist status after dumping core, because 'dumper'
itself forcibly terminates the process.
Use 'dumper -n' to avoid killing the dumped process, so we continue to
the end of signal_exit(), to exit with the 128+signal exit status.
Busy-wait in exec_prepared_command() in an attempt to reliably notice
the dumper attaching, so we don't get stuck there.
Also: document these important facts for custom uses of error_start.
Unfortunately fgrep is now deprecated in a very pushy way.
Make sure to use grep -F instead all around, even in docs
and comments/
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Pre-format a command to be executed on a fatal error to run 'dumper'
(using an absolute path).
Factor out executing a pre-formatted command, so we can use that for
invoking the JIT debugger in try_to_debug() (if error_start is present
in the CYGWIN env var) and to invoke dumper when a fatal error occurs.
On a fatal error, if the core file size limit is greater than 1MB,
invoke dumper to write a core dump. Otherwise, if that limit is greater
than 0, write a .stackdump file, as previously.
Adjust and clarify the associated documentation.
Also: Fix so that the error_start JIT debugger is now invoked, even when
ulimit -c is zero.
Also: Fix uses of console_printf() inside exec_prepared_command(). It's
output is written via the Windows console device, so needs to use
Windows-style line endings.
Also: consistently return non-zero from try_to_debug() if we debugged.
Future work: Truncate or remove the file written, if it exceeds the
maximum size set by the ulimit.
Future work: Using the words "fatal error" could probably be improved
on. This means exiting on one of the "certain signals whose default
action is to cause the process to terminate and produce a core dump
file".
This function closes or sets the close-on-exec flag for a specified
range of file descriptors. It is available on FreeBSD and Linux.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
Given that SSDs don't have a seek penalty, we can enable
automatic sparsifying of files on SSDs, even if the "sparse"
mount option is not set.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
First cut of the new, Linux-specific fallocate(2) function.
Do not add any functionality yet, except of basic handling
of FALLOC_FL_KEEP_SIZE.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
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>
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>
Test access05 and symlink03 expect operations to fail which succeed when
we have Adminstrator privileges.
There's perhaps a bit of incoherency here: some XFAILed tests expect to
run as root (so maybe we need the ability to selectively cygdrop?).
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Do some setup in the Cygwin 'installation' at testsuite/testinst/:
* Ensure /tmp exists
* Use BusyBox to provide executables needed by tests which use system()
(sh, sleep, ls)
This enables tests which use system(), or require /tmp to exist to pass.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Preconditions of WSL or empty directories dependent on Windows
versions was totally screwed up. Drop the description from
--help, describe the preconditions for case-sensitive dirs in the
man page instead.
Fixes: fc6e89c937 ("Cygwin: chattr: clarify requirements for casesensitive directories")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This patch hails from Git for Windows (where the Cygwin runtime is used
in the form of a slightly modified MSYS2 runtime), where it is a
well-established technique to let the `$HOME` variable define where the
current user's home directory is, falling back to `$HOMEDRIVE$HOMEPATH`
and `$USERPROFILE`.
The idea is that we want to share user-specific settings between
programs, whether they be Cygwin, MSYS2 or not. Unfortunately, we
cannot blindly activate the "db_home: windows" setting because in some
setups, the user's home directory is set to a hidden directory via an
UNC path (\\share\some\hidden\folder$) -- something many programs
cannot handle correctly, e.g. `cmd.exe` and other native Windows
applications that users want to employ as Git helpers.
The established technique is to allow setting the user's home directory
via the environment variables mentioned above: `$HOMEDRIVE$HOMEPATH` or
`$USERPROFILE`. This has the additional advantage that it is much
faster than querying the Windows user database.
Of course this scheme needs to be opt-in. For that reason, it needs
to be activated explicitly via `db_home: env` in `/etc/nsswitch.conf`.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
- Windows 10 requires WSL
- Windows 11 only allows enabling casesensitivity if dir is empty
Fixes: 0d4b39d37b ("Cygwin: Add lsattr and chattr tools")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
setup >=2.925 indicates to postinstall and preremove scripts the Start
Menu suffix to use via the CYGWIN_START_MENU_SUFFIX env var.
It also indicates, via the CYGWIN_SETUP_OPTIONS env var, if the option
to disable Start Menu shortcut creation is supplied.
Update the Cygwin documentation postinstall and preremove scripts to
take these env vars into consideration.
So far locale(1) had to have knowledge how to construct, thus
duplicating the effort how Cygwin handles locale strings.
Move locale list and codeset list generation into Cygwin by
providing /proc/codesets and /proc/locales files. /proc/locales
does not list aliases, those are still handled in locale(1).
locale(1) opens the files and ueses that info for printing,
like any other application can do now.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- add '-' option
- make group argument optional
- drop ability to take a numerical group argument
- simplify usage output to bare minimum
- Add manpage and documentation
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Rather than guessing, based on just the presence of libbfd, add an
explicit configuration option, to build dumper or not, defaulting to
building it.
This might have some use when bootstrapping Cygwin for a new
architecture, or when building your own Cygwin-targetted cross-compiler,
rather than installing one from the copr, along with the dependencies of
libbfd.
Using ulinks here makes the result work on cygwin.com only, while
xrefs to FAQs are creating realtive links. Add xreflabel where
appropriate.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Originally the code was written to allow three ways of prefixing
accounts and to freely define a domain/account separator. This code
has been disabled even before being officially released, and it was
never re-enabled. Given there has been no complaints for eight years
now, drop this code eventually. Just add a macro to define the
domain/account separator statically.
Fixes: cc332c9e27 ("(cygheap_pwdgrp::nss_init_line): Disable db_prefix
and db_separator settings. Add comment")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>