The complicated build routine was only required because we needed
the .cygheap section at the end of the file, and the debug sections
broke this. Now that the cygheap is out of the way, we really don't
have to do this anymore, and the build can just generate a DLL with
integrated debug info.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Make sure to create a new cygwin_version.c if it either doesn't
exist yet, or if it would be different from the former file.
This avoids unnecessary DLL rebuilding.
Fixes: 97eb64b909 ("Cygwin: uname: generate default release string from git as well")
Fixes: 4949a82cde ("Cygwin: uname: fix building in non-git source dir")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Move the drive substitution code after the call to
GetFinalPathNameByHandleW into a local function revert_virtual_drive
and add code to handle non-remote virtual drives, i. e., those
created with the subst command. (Try to) make sure that virtual
drives are never treated like symlinks.
Fixes: 19d59ce75d ("Cygwin: path_conv: Rework handling native symlinks as inner path components")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
https://cygwin.com/pipermail/cygwin/2022-December/252628.html
After the commit 9e4d308cd5, the performance of read from non-cygwin
pipe has been degraded. This is because select_sem mechanism does not
work for non-cygwin pipe. This patch fixes the issue.
Fixes: 9e4d308cd5 ("Cygwin: pipe: Adopt FILE_SYNCHRONOUS_IO_NONALERT
flag for read pipe.")
Reported-by: tryandbuy <tryandbuy@proton.me>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Until Cygwin 3.3.6, we define __LARGE64_FILES unconditionally, so we
were using the type __sFILE64 even for 64 bit. That was lazy and wrong.
so commit 2902b3a09e ("Cygwin: drop requirement to build newlib's
stdio64") tried to fix that.
Unfortunately this patch forgot to take the exposure of the typename
__sFILE64 in userspace into account. This leads to trouble in C++ due
to name mangling.
Commit 0f376ae220 tried to fix this by just renaming __sFILE to
__sFILE64 by using a macro. While __sFILE and __sFILE64 are the same
size, they are not exactly congruent.
To avoid backward compatibility problems, make sure to define FILE
as the real __sFILE64, and make sure that __sFILE is not defined at
all on Cygwin.
Fixes: 0f376ae220 ("Cygwin: rename __sFILE to __sFILE64 for backward
compatibility")
Fixes: 2902b3a09e ("Cygwin: drop requirement to build newlib's stdio64")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Until Cygwin 3.3.6, we define __LARGE64_FILES unconditionally, so we
were using the type __sFILE64 even for 64 bit. That was lazy and wrong.
so commit 2902b3a09e ("Cygwin: drop requirement to build newlib's
stdio64") tried to fix that.
Unfortunately this patch forgot to take the exposure of the typename
__sFILE64 in userspace into account. This leads to trouble in C++ due
to name mangling.
Fix this by redefining __sFILE to __sFILE64. The type name is very much
internal, so it doesn't really matter, except for the fact that it needs
to stay backward compatible so as not to break building against C++ libs
built under older versions of Cygwin.
Fixes: 2902b3a09e ("Cygwin: drop requirement to build newlib's stdio64")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
commit 97eb64b909 broke building outside of a git dir, because
the git describe command would fail. Fix this by checking if
we're in a git tree at all and just generate an empty string
as version string. Use this in uname_x to generate a fallback
version.
Fixes: 97eb64b909 ("Cygwin: uname: generate default release
string from git as well"
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
When building a release with cygport, we get uname version info
from cygport, which in turn gets version info from `git describe'.
During development, the release info for local builds was not
that helpful yet. Fix that, by creating version info from
`git describe' if CYGPORT_RELEASE_INFO isn't given. Make sure to
always force rebuild of the version info to pick up source file
changes as well as git actions.
Rearrange code slightly to generate machine info first, release info
after that. Use snprintf to generate release string safely.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Commit 188d5f6c9a erroneously moved the mcountFunc.S file to the
TARGET_FILES target, rather than keeping it in GMON_FILES. The
result is that the __fentry__ entry point is now entirely undefined,
so `gcc -pg' is broken.
Create new target-specific GMON_TARGET_FILES and move mcountFunc.S
into it. Add $(GMON_TARGET_FILES) to GMON_FILES.
Fixes: 188d5f6c9a ("Cygwin: x86_64: add wmemset assembler entry point")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
DiscardVirtualMemory, PrefetchVirtualMemory and
GetSystemTimePreciseAsFileTime are available since
Windows 8.1. Merge PseudoConsole functions into
kernel32 function block.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Only required for Windows 7.
This in turn allows to drop the helper_pid and related
methods from fhandler_pty_common.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Only required for Windows 7.
This allows to remove fhandler_pipe::get_query_hdl_per_system(),
too.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
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>
fetch_account_from_windows shortcuts the current user in that
it takes the user's domain SID and just adds the matching RID
from the token's primary group to create a group SID.
How wrong this is can be very simply reproduced:
Assuming you run a native process, like cmd, with primary group
set to the Administrators builtin group. Run Cygwin's id(1) as
child process. id(1) will print a non-existent group as primary
group and also add it to the group list.
This can only be avoided by not special casing the current user
and thus not creating a group SID from partial information.
Fixes: 6cc7c925ce ("(pwdgrp::fetch_account_from_windows): Default primary group for the
current user to primary group from user token.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
internal_getlogin overwrites the process token primary group if it
differs from the primary group as stored in the passwd DB.
However, this also overwrites the primary group of the process if
it has been deliberately changed by a former process (e. g., newgrp),
and the current process has a non-Cygwin process as parent.
Our docs claim we restrict overwriting the primary group to local,
non-domain user accounts anyway, and it was actually meant this way.
So check for exactly that before overwriting the primary group
in the token: It's only allowed if the user is a local account
and the primary group in the token is still the default group
"None".
Fixes: 6cc7c925ce ("(internal_getlogin): Give primary group
from user token more weight.")
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>
This is a long-standing thinko.
When you exec a process, dll_crt0_0 in the child process calls
child_info_spawn::handle_spawn(). handle_spawn() initialises the
cygheap.
Now consider calling strace. Strace is a non-Cygwin process dynamically
loading cygwin1.dll via LoadLibrary. This in turn initializes the DLL:
- dll_crt0_0 finds that the process it attaches to has been exec'd, so
child_info_spawn::handle_spawn() is called.
- If the DLL is being dynamically loaded, handle_spawn() calls
child_info_spawn::get_parent_handle(). This in turn tries to set
the moreinfo->myself_pinfo value inside the cygheap to NULL.
- However, at this time, the cygheap has not yet been initialized. This
only occurs in the cygheap_fixup_in_child() call after get_parent_handle()
returns.
--> SEGV
This thinko never had a negative side effect, because the cygheap was
pre-allocated at DLL load time until commit 2f9b8ff00c ("Cygwin:
decouple cygheap from Cygwin DLL"). With 2f9b8ff00c, the cygheap
actually doesn't exist until after the call to cygheap_fixup_in_child().
Fix this problem by moving the assignment after the call to
cygheap_fixup_in_child().
Fixes: 3de7be4c1d ("* DevNotes: Add entry cgf-000007. [...]")
Fixes: 2f9b8ff00c ("Cygwin: decouple cygheap from Cygwin DLL")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
After decoupling cygheap from the DLL loading address, the check
for a different _cygheap_start has gone. So the matching string
check in multiple_cygwin_problem is obsolete now.
Fixes: 2f9b8ff00c ("Cygwin: decouple cygheap from Cygwin DLL")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
In commit 2dab880c96 I did a mistake when
I copied the new fhandler_serial::switch_modem_lines() from my modified
3.3.6 branch to the current master and I left a copy paste error. This
patch fixes that error.
Fixes: 2dab880c96 ("Cygwin: fix TIOCMBIS/TIOCMBIC not working when using usbser.sys")
- Previously, we have two tty.cc, one is winsup/cygwin/tty.cc and
the other is winsup/cygwin/fhandler/tty.cc. This is somewhat
confusing. This patch renames fhandler/tty.cc to fhandler/pty.cc.
When creating regular Cygwin test releases we need a way to
automate unambiguous version information based on the output
of `git describe'. Allow to inject a release string via a
preprocessor macro CYGPORT__RELEASE_INFO. Change the default
release info to recognize a local, non-distro build.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
We're going to switch to regular test releases, rather than the
old, handcrafted snapshots method.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>