Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
40325b0
Fix msys library name in import libraries
ktbarrett Mar 14, 2021
6270157
Rename dll from cygwin to msys
Alexpux Apr 14, 2019
a2f386e
Convert Unix paths in args/env to Windows form for native Win32 apps
Alexpux Apr 14, 2019
20f6197
Add functionality for changing OS name via MSYSTEM environment variab…
Alexpux Apr 14, 2019
b5bc62a
- Move root to /usr. - Change sorting mount points. - By default moun…
Alexpux Apr 14, 2019
373a34a
Instead of creating Cygwin symlinks, use deep copy by default
Alexpux Apr 14, 2019
9584e94
Automatically rewrite TERM=msys to TERM=cygwin
Alexpux Apr 14, 2019
9b5d551
Do not convert environment for strace
Alexpux Apr 14, 2019
6c7d224
strace.cc: Don't set MSYS=noglob
mingwandroid Aug 23, 2015
4bfb55b
Add debugging for strace make_command_line
mingwandroid Aug 21, 2015
004c621
strace --quiet: be *really* quiet
dscho May 17, 2017
33516d8
path_conv: special-case root directory to have trailing slash
Alexpux Apr 14, 2019
ce5a5c5
When converting to a Unix path, avoid double trailing slashes
dscho Nov 8, 2022
3021a21
dcrt0.cc: Untangle allow_glob from winshell
mingwandroid Aug 21, 2015
248ad25
dcrt0.cc (globify): Don't quote literal strings differently when dos_…
mingwandroid Aug 23, 2015
1edbad5
Add debugging for build_argv
mingwandroid Aug 21, 2015
1bee732
environ.cc: New facility/environment variable MSYS2_ENV_CONV_EXCL
mingwandroid Apr 10, 2016
8496a08
Introduce the `enable_pcon` value for `MSYS`
dscho May 19, 2020
cf8cb2a
popen: call /usr/bin/sh instead of /bin/sh
lazka Jun 5, 2020
ececb65
Disable the 'cygwin' GitHub workflow
dscho Mar 17, 2021
107383c
CI: add a GHA for doing a basic build test
lazka Aug 9, 2020
d18b348
Set up a GitHub Action to keep in sync with Cygwin
dscho Nov 22, 2019
1836883
Expose full command-lines to other Win32 processes by default
dscho Aug 12, 2020
03c003b
Add a helper to obtain a function's address in kernel32.dll
dscho Apr 16, 2018
ffc64db
Emulate GenerateConsoleCtrlEvent() upon Ctrl+C
dscho Mar 20, 2015
e782e8f
kill: kill Win32 processes more gently
dscho Mar 20, 2015
f5d7da5
Cygwin: make option for native inner link handling.
jeremyd2019 Jul 22, 2021
108b57f
docs: skip building texinfo and PDF files
dscho Nov 8, 2021
45be9b1
install-libs: depend on the "toollibs"
dscho Nov 8, 2021
a9994ee
POSIX-ify the SHELL variable
dscho Nov 23, 2015
924a27d
Handle ORIGINAL_PATH just like PATH
dscho Mar 21, 2017
a19190b
uname: allow setting the system name to CYGWIN
lazka Jul 3, 2022
fb94d1e
Pass environment variables with empty values
dscho Feb 18, 2015
808d059
Optionally disallow empty environment values again
dscho Sep 6, 2022
ba8642b
build_env(): respect the `MSYS` environment variable
dscho Sep 6, 2022
97a85d8
Revert "Cygwin: Enable dynamicbase on the Cygwin DLL by default"
lazka Dec 17, 2022
2f34729
Avoid sharing cygheaps across Cygwin versions
dscho Jan 30, 2023
c904317
uname: report msys2-runtime commit hash, too
dscho Feb 21, 2023
81e8c76
Cygwin: Adjust CWD magic to accommodate for the latest Windows previews
dscho May 22, 2023
432d056
Cygwin: Fix segfault when XSAVE area sizes are unaligned
Mar 12, 2026
c0b496f
Cygwin: console: Set console mode only if std{in,out,err} is console
tyan0 Jul 3, 2025
6b3e1dd
Cygwin: console: Preserve saved modes with redirected stdio
dscho Oct 8, 2026
38e42cf
Cygwin: testsuite: cover console mode preservation with redirected stdio
dscho Oct 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: build

on: [push, pull_request]

permissions:
contents: read

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v7

- name: setup-msys2
uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true
install: msys2-devel base-devel autotools cocom diffutils gcc gettext-devel libiconv-devel make mingw-w64-cross-crt mingw-w64-cross-gcc mingw-w64-cross-zlib perl zlib-devel xmlto docbook-xsl libzstd-devel

- name: Build
shell: msys2 {0}
run: |
(cd winsup && ./autogen.sh)
./configure --disable-dependency-tracking --with-msys2-runtime-commit="$GITHUB_SHA"
make -j8

- name: Install
shell: msys2 {0}
run: |
make DESTDIR="$(pwd)"/_dest install

- name: Upload
uses: actions/upload-artifact@v7
with:
name: install
path: _dest/

generate-msys2-tests-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- id: matrix
uses: msys2/msys2-tests/gha-matrix-gen@main

msys2-tests:
needs: [build, generate-msys2-tests-matrix]
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-msys2-tests-matrix.outputs.matrix) }}

name: msys2-tests ${{ matrix.msystem }}-${{ matrix.cc }}
runs-on: ${{ matrix.runner }}
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
FC: ${{ matrix.fc }}
steps:
- id: msys2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: ${{ matrix.packages }}

- name: Add staging repo
shell: msys2 {0}
run: |
sed -i '1s|^|[staging]\nServer = https://repo.msys2.org/staging/\nSigLevel = Never\n|' /etc/pacman.conf

- name: Update using staging
shell: pwsh
run: |
msys2 -c 'pacman --noconfirm -Suuy'
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
msys2 -c 'pacman --noconfirm -Suu'

- name: Download msys2-runtime artifact
uses: actions/download-artifact@v8
with:
name: install
path: ${{ steps.msys2.outputs.msys2-location }}

- name: uname -a
shell: msys2 {0}
run: uname -a

- name: Run tests
uses: msys2/msys2-tests@main

8 changes: 1 addition & 7 deletions .github/workflows/cygwin.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: cygwin

on:
push:
# since master is a symbolic reference to main, don't run for both
branches-ignore:
- 'master'
tags:
- '*'
on: workflow_dispatch

jobs:
fedora-build:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/sync-with-cygwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: sync-with-cygwin

# File: .github/workflows/repo-sync.yml

on:
workflow_dispatch:
schedule:
- cron: "42 * * * *"
jobs:
repo-sync:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Fetch Cygwin's latest master and tags
run: |
git init --bare
# Potentially use git://sourceware.org/git/newlib-cygwin.git directly, but GitHub seems more reliable
git fetch https://github.com/cygwin/cygwin master:refs/heads/cygwin/master 'refs/tags/*:refs/tags/*'
- name: Push to our fork
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY refs/heads/cygwin/master 'refs/tags/*:refs/tags/*'
46 changes: 42 additions & 4 deletions winsup/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,40 @@ AC_CHECK_TOOL(RANLIB, ranlib, ranlib)
AC_CHECK_TOOL(STRIP, strip, strip)
AC_CHECK_TOOL(WINDRES, windres, windres)

# Record msys2-runtime commit
AC_ARG_WITH([msys2-runtime-commit],
[AS_HELP_STRING([--with-msys2-runtime-commit=COMMIT],
[indicate the msys2-runtime commit corresponding to this build])],
[MSYS2_RUNTIME_COMMIT=$withval], [MSYS2_RUNTIME_COMMIT=yes])
case "$MSYS2_RUNTIME_COMMIT" in
no)
MSYS2_RUNTIME_COMMIT=
MSYS2_RUNTIME_COMMIT_SHORT=
MSYS2_RUNTIME_COMMIT_HEX=0
;;
yes|auto)
if MSYS2_RUNTIME_COMMIT="$(git --git-dir="$srcdir/../.git" rev-parse HEAD)"
then
MSYS2_RUNTIME_COMMIT_SHORT="$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')"
MSYS2_RUNTIME_COMMIT_HEX="0x${MSYS2_RUNTIME_COMMIT_SHORT}ul"
else
AC_MSG_WARN([Could not determine msys2-runtime commit])
MSYS2_RUNTIME_COMMIT=
MSYS2_RUNTIME_COMMIT_SHORT=
MSYS2_RUNTIME_COMMIT_HEX=0
fi
;;
*)
expr "$MSYS2_RUNTIME_COMMIT" : '@<:@0-9a-f@:>@\{6,64\}$' ||
AC_MSG_ERROR([Invalid commit name: "$MSYS2_RUNTIME_COMMIT"])
MSYS2_RUNTIME_COMMIT_SHORT="$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')"
MSYS2_RUNTIME_COMMIT_HEX="0x${MSYS2_RUNTIME_COMMIT_SHORT}ul"
;;
esac
AC_SUBST(MSYS2_RUNTIME_COMMIT)
AC_SUBST(MSYS2_RUNTIME_COMMIT_SHORT)
AC_SUBST(MSYS2_RUNTIME_COMMIT_HEX)

AC_ARG_ENABLE(debugging,
[AS_HELP_STRING([--enable-debugging],[Build a cygwin DLL which has more consistency checking for debugging])],
[case "${enableval}" in
Expand Down Expand Up @@ -84,11 +118,10 @@ AM_CONDITIONAL(BUILD_DOC, [test $enable_doc != "no"])
AC_CHECK_PROGS([DOCBOOK2XTEXI], [docbook2x-texi db2x_docbook2texi])
if test -z "$DOCBOOK2XTEXI" ; then
if test "x$enable_doc" != "xno"; then
AC_MSG_ERROR([docbook2texi is required to build documentation])
else
unset DOCBOOK2XTEXI
AM_MISSING_PROG([DOCBOOK2XTEXI], [docbook2texi])
AC_MSG_WARN([docbook2texi is required to build documentation])
fi
unset DOCBOOK2XTEXI
AM_MISSING_PROG([DOCBOOK2XTEXI], [docbook2texi])
fi

AC_CHECK_PROGS([XMLTO], [xmlto])
Expand All @@ -106,6 +139,11 @@ if test "x$with_cross_bootstrap" != "xyes"; then
test -n "$MINGW_CXX" || AC_MSG_ERROR([no acceptable MinGW g++ found in \$PATH])
AC_CHECK_PROGS(MINGW_CC, ${target_cpu}-w64-mingw32-gcc)
test -n "$MINGW_CC" || AC_MSG_ERROR([no acceptable MinGW gcc found in \$PATH])

AC_CHECK_PROGS(MINGW32_CC, i686-w64-mingw32-gcc)
test -n "$MINGW32_CC" || AC_MSG_ERROR([no acceptable mingw32 gcc found in \$PATH])
AC_CHECK_PROGS(MINGW64_CC, x86_64-w64-mingw32-gcc)
test -n "$MINGW64_CC" || AC_MSG_ERROR([no acceptable mingw64 gcc found in \$PATH])
fi
AM_CONDITIONAL(CROSS_BOOTSTRAP, [test "x$with_cross_bootstrap" != "xyes"])

Expand Down
4 changes: 2 additions & 2 deletions winsup/cygserver/cygserver-config
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ done

# Check if running on NT
_sys="`uname`"
_nt=`expr "${_sys}" : "CYGWIN_NT"`
_nt=`expr "${_sys}" : "MSYS_NT"`

# Check for running cygserver processes first.
if ps -e | grep -v grep | grep -q ${service_name}
Expand Down Expand Up @@ -178,7 +178,7 @@ then
echo "Do you want to install cygserver as service?"
if request "(Say \"no\" if it's already installed as service)"
then
if ! cygrunsrv -I ${service_name} -d "CYGWIN cygserver" -p /usr/sbin/cygserver
if ! cygrunsrv -I ${service_name} -d "MSYS cygserver" -p /usr/sbin/cygserver
then
echo
echo "Installation of cygserver as service failed. Please check the"
Expand Down
4 changes: 4 additions & 0 deletions winsup/cygserver/transport_pipes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ details. */
#ifndef _TRANSPORT_PIPES_H
#define _TRANSPORT_PIPES_H

#ifdef __MSYS__
#define PIPE_NAME_PREFIX L"\\\\.\\pipe\\msys-"
#else
#define PIPE_NAME_PREFIX L"\\\\.\\pipe\\cygwin-"
#endif
#define PIPE_NAME_SUFFIX L"-lpc"

/* Named pipes based transport, for security on NT */
Expand Down
40 changes: 23 additions & 17 deletions winsup/cygwin/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ if TARGET_X86_64
COMMON_CFLAGS+=-mcmodel=small
endif

VERSION_CFLAGS = -DMSYS2_RUNTIME_COMMIT="\"@MSYS2_RUNTIME_COMMIT@\""
VERSION_CFLAGS += -DMSYS2_RUNTIME_COMMIT_SHORT="\"@MSYS2_RUNTIME_COMMIT_SHORT@\""
VERSION_CFLAGS += -DMSYS2_RUNTIME_COMMIT_HEX="@MSYS2_RUNTIME_COMMIT_HEX@"
COMMON_CFLAGS += $(VERSION_CFLAGS)

AM_CFLAGS=$(cflags_common) $(COMMON_CFLAGS)
AM_CXXFLAGS=$(cxxflags_common) $(COMMON_CFLAGS) -fno-threadsafe-statics

Expand All @@ -37,12 +42,12 @@ newlib_build=$(target_builddir)/newlib
toollibdir=$(tooldir)/lib
toolincludedir=$(tooldir)/include

# Parameters used in building the cygwin.dll.
# Parameters used in building the msys-2.0.dll.

DLL_NAME=cygwin1.dll
NEW_DLL_NAME=new-cygwin1.dll
DEF_FILE=cygwin.def
LIB_NAME=libcygwin.a
DLL_NAME=msys-2.0.dll
NEW_DLL_NAME=new-msys-2.0.dll
DEF_FILE=msys.def
LIB_NAME=libmsys-2.0.a

#
# sources
Expand Down Expand Up @@ -314,6 +319,7 @@ DLL_FILES= \
miscfuncs.cc \
mktemp.cc \
msg.cc \
msys2_path_conv.cc \
mount.cc \
net.cc \
netdb.cc \
Expand Down Expand Up @@ -450,7 +456,7 @@ uname_version.c: .FORCE
version.cc: scripts/mkvers.sh include/cygwin/version.h winver.rc $(src_files)
@echo "Making version.cc and winver.o";\
export CC="$(CC)";\
/bin/sh $(word 1,$^) $(word 2,$^) $(word 3,$^) $(WINDRES) $(CFLAGS)
/bin/sh $(word 1,$^) $(word 2,$^) $(word 3,$^) $(WINDRES) $(CFLAGS) $(VERSION_CFLAGS)

winver.o: version.cc

Expand Down Expand Up @@ -589,36 +595,35 @@ LIBSERVER = $(cygserver_blddir)/libcygserver.a
$(LIBSERVER):
$(MAKE) -C $(cygserver_blddir) libcygserver.a

# We build as new-cygwin1.dll and rename at install time to overcome native
# We build as new-msys-2.0.dll and rename at install time to overcome native
# rebuilding issues (we don't want the build tools to see a partially built
# cygwin1.dll and attempt to use it instead of the old one).
# msys-2.0.dll and attempt to use it instead of the old one).

# linker script
LDSCRIPT=cygwin.sc
$(LDSCRIPT): $(LDSCRIPT).in
$(AM_V_GEN)$(CC) -E - -P < $^ -o $@

# cygwin dll
# msys-2.0 dll
# Set PE and export table header timestamps to zero for reproducible builds.
$(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) $(LIBSERVER)\
$(newlib_build)/libm.a $(newlib_build)/libc.a
$(AM_V_CXXLD)$(CXX) $(CXXFLAGS) \
-mno-use-libstdc-wrappers \
-Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) \
-Wl,--dynamicbase -static \
-Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) -static \
$${SOURCE_DATE_EPOCH:+-Wl,--no-insert-timestamp} \
-Wl,--heap=0 -Wl,--out-implib,cygdll.a -shared -o $@ \
-Wl,--heap=0 -Wl,--out-implib,msysdll.a -shared -o $@ \
-e @DLL_ENTRY@ $(DEF_FILE) \
-Wl,-whole-archive libdll.a -Wl,-no-whole-archive \
$(VERSION_OFILES) \
$(LIBSERVER) \
$(newlib_build)/libm.a \
$(newlib_build)/libc.a \
-lgcc -lkernel32 -lntdll -Wl,-Map,cygwin.map
-lgcc -lkernel32 -lntdll -Wl,-Map,msys.map
@$(MKDIR_P) ${target_builddir}/winsup/testsuite/testinst/bin/
$(AM_V_at)$(INSTALL_PROGRAM) $(NEW_DLL_NAME) ${target_builddir}/winsup/testsuite/testinst/bin/$(DLL_NAME)

# cygwin import library
# msys-2.0 import library
toolopts=--cpu=@target_cpu@ --ar=@AR@ --as=@AS@ --nm=@NM@ --objcopy=@OBJCOPY@

$(DEF_FILE): scripts/gendef cygwin.din
Expand All @@ -631,13 +636,14 @@ sigfe.s: $(DEF_FILE) tlsoffsets

LIBCOS=$(addsuffix .o,$(basename $(LIB_FILES)))
$(LIB_NAME): $(DEF_FILE) $(LIBCOS) | $(NEW_DLL_NAME)
$(AM_V_GEN)$(srcdir)/scripts/mkimport $(toolopts) $(NEW_FUNCTIONS) $@ cygdll.a $(wordlist 2,99,$^)
$(AM_V_GEN)$(srcdir)/scripts/mkimport $(toolopts) $(NEW_FUNCTIONS) $@ msysdll.a $(wordlist 2,99,$^)

# sublibs
# import libraries for some subset of symbols indicated by given objects
speclib=\
$(srcdir)/scripts/speclib $(toolopts) \
--exclude='cygwin' \
--exclude='msys' \
--exclude='(?i:dll)' \
--exclude='reloc' \
--exclude='^main$$' \
Expand Down Expand Up @@ -687,7 +693,7 @@ all-local: $(LIB_NAME) $(SUBLIBS)
clean-local:
-rm -f $(BUILT_SOURCES)
-rm -f $(DEF_FILE) sigfe.s
-rm -f cygwin.sc cygdll.a cygwin.map
-rm -f cygwin.sc msysdll.a msys.map
-rm -f $(NEW_DLL_NAME)
-rm -f $(LIB_NAME) $(SUBLIBS)
-rm -f version.cc
Expand All @@ -705,7 +711,7 @@ man_MANS = regex/regex.3 regex/regex.7
install-exec-hook: install-libs
install-data-local: install-headers install-ldif

install-libs:
install-libs: install-toollibDATA
@$(MKDIR_P) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) $(NEW_DLL_NAME) $(DESTDIR)$(bindir)/$(DLL_NAME)
@$(MKDIR_P) $(DESTDIR)$(toollibdir)
Expand Down
8 changes: 8 additions & 0 deletions winsup/cygwin/crt0.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ details. */

extern int main (int argc, char **argv);

#ifdef __MSYS__
void msys_crt0 (int (*main) (int, char **));
#else
void cygwin_crt0 (int (*main) (int, char **));
#endif

void
mainCRTStartup ()
{
#ifdef __MSYS__
msys_crt0 (main);
#else
cygwin_crt0 (main);
#endif

/* These are never actually called. They are just here to force the inclusion
of things like -lbinmode. */
Expand Down
6 changes: 3 additions & 3 deletions winsup/cygwin/cygwin.din
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LIBRARY "cygwin1.dll" BASE=0x180040000
LIBRARY "msys-2.0.dll" BASE=0x180040000

EXPORTS
# Exported variables
Expand Down Expand Up @@ -404,8 +404,8 @@ cygwin_attach_handle_to_fd SIGFE
cygwin_conv_path SIGFE
cygwin_conv_path_list SIGFE
cygwin_create_path SIGFE
cygwin_detach_dll SIGFE_MAYBE
cygwin_dll_init NOSIGFE
msys_detach_dll SIGFE_MAYBE
msys_dll_init NOSIGFE
cygwin_internal NOSIGFE
cygwin_logon_user SIGFE
cygwin_posix_path_list_p NOSIGFE
Expand Down
Loading
Loading