- From c6a48533a570662524f77d26cc6cc5c65530174d Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 25 Nov 2024 12:48:34 +0100
- Subject: [PATCH 1/8] daemon,tests: Add workaround for Cygwin's "silly rename"
- with invalid UTF-16 filenames
- Add workaround for Cygwin's "silly rename" with invalid UTF-16 filename
- prefix.
- Cygwin has it's own variation of "silly rename" (i.e. if
- someone deletes a file while someone else still has
- a valid fd to that file it first renames that file with a
- special prefix, see
- newlib-cygwin/winsup/cygwin/syscalls.cc, function
- |try_to_bin()|).
- Unfortunately on filesystems supporting Unicode
- (i.e. |FILE_UNICODE_ON_DISK|) Cygwin adds the prefix
- L".\xdc63\xdc79\xdc67", which is NOT a valid UTF-16 sequence,
- and will be rejected by a filesystem validating the
- UTF-16 sequence (e.g. SAMBA, ReFS, OpenZFS, ...; for SAMBA
- Cygwin uses the ".cyg" prefix used for
- non-|FILE_UNICODE_ON_DISK| filesystems).
- In our case the NFSv4.1 protocol requires valid UTF-8
- sequences, and the NFS server will reject filenames if either
- the server or the exported filesystem will validate the UTF-8
- sequence.
- Since Cygwin only does a |rename()| and never a lookup by
- that filename we just stomp the prefix with the ".cyg" prefix
- used for non-|FILE_UNICODE_ON_DISK| filesystems.
- We ignore the side-effects here, e.g. that Win32 will still
- "remember" the original filename in the file name cache.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/setattr.c | 42 ++++++++++++++++++++++++++++++++++++++++
- tests/manual_testing.txt | 6 ++++++
- 2 files changed, 48 insertions(+)
- diff --git a/daemon/setattr.c b/daemon/setattr.c
- index 9eaafb5..34796e1 100644
- --- a/daemon/setattr.c
- +++ b/daemon/setattr.c
- @@ -284,6 +284,48 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- EASSERT((rename->FileNameLength%sizeof(WCHAR)) == 0);
- +#define CYGWIN_STOMP_SILLY_RENAME_INVALID_UTF16_SEQUENCE 1
- +
- +#ifdef CYGWIN_STOMP_SILLY_RENAME_INVALID_UTF16_SEQUENCE
- + /*
- + * Stomp Cygwin "silly rename" invalid Unicode sequence
- + *
- + * Cygwin has it's own variation of "silly rename" (i.e. if
- + * someone deletes a file while someone else still has
- + * a valid fd to that file it first renames that file with a
- + * special prefix, see
- + * newlib-cygwin/winsup/cygwin/syscalls.cc, function
- + * |try_to_bin()|).
- + *
- + * Unfortunately on filesystems supporting Unicode
- + * (i.e. |FILE_UNICODE_ON_DISK|) Cygwin adds the prefix
- + * L".\xdc63\xdc79\xdc67", which is NOT a valid UTF-16 sequence,
- + * and will be rejected by a filesystem validating the
- + * UTF-16 sequence (e.g. SAMBA, ReFS, OpenZFS, ...; for SAMBA
- + * Cygwin uses the ".cyg" prefix used for
- + * non-|FILE_UNICODE_ON_DISK| filesystems).
- + * In our case the NFSv4.1 protocol requires valid UTF-8
- + * sequences, and the NFS server will reject filenames if either
- + * the server or the exported filesystem will validate the UTF-8
- + * sequence.
- + *
- + * Since Cygwin only does a |rename()| and never a lookup by
- + * that filename we just stomp the prefix with the ".cyg" prefix
- + * used for non-|FILE_UNICODE_ON_DISK| filesystems.
- + * We ignore the side-effects here, e.g. that Win32 will still
- + * "remember" the original filename in the file name cache.
- + */
- + if ((rename->FileNameLength > (4*sizeof(wchar_t))) &&
- + (!memcmp(rename->FileName,
- + L".\xdc63\xdc79\xdc67", (4*sizeof(wchar_t))))) {
- + DPRINTF(1, ("handle_nfs41_rename(args->path='%s'): "
- + "Cygwin sillyrename prefix \".\\xdc63\\xdc79\\xdc67\" "
- + "detected, squishing prefix to \".cyg\"\n",
- + args->path));
- + (void)memcpy(rename->FileName, L".cyg", 4*sizeof(wchar_t));
- + }
- +#endif /* CYGWIN_STOMP_SILLY_RENAME_INVALID_UTF16_SEQUENCE */
- +
- dst_path.len = (unsigned short)WideCharToMultiByte(CP_UTF8,
- WC_ERR_INVALID_CHARS|WC_NO_BEST_FIT_CHARS,
- rename->FileName, rename->FileNameLength/sizeof(WCHAR),
- diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
- index 16972b0..699d20e 100644
- --- a/tests/manual_testing.txt
- +++ b/tests/manual_testing.txt
- @@ -432,7 +432,13 @@ bash /usr/share/msnfs41client/tests/misc/wintartest_comparewinvsgnu001.bash myta
- # The NFS server has a weekly cron job removing files called ".nfs*" which
- # are more than a week old to deal with .nfs* files from NFS clients which
- # crashed while having deleted files open.
- +#
- +# The test here comes in two variations, one using "rm myfile" (which triggers
- +# Cygwin "silly rename" (see newlib-cygwin/winsup/cygwin/syscalls.cc,
- +# function |try_to_bin()|), and one using $ cmd /C "del myfile" #, which
- +# bypasses the Cygwin code
- bash -c 'set -o errexit ; rm -Rf sillytestdir ; mkdir sillytestdir ; cd sillytestdir ; touch sillytest ; ( command exec {n}<"sillytest" ; printf "fd=%d\n" $n ; sleep 10) & sleep 1 ; ls -la ; cmd /C "del sillytest" ; ls -la ; if [[ "$(ls -1 .nfs*)" != "" ]] ; then echo "# test OK" ; else echo "# test FAILED" ; fi ; wait'
- +bash -c 'set -o errexit ; rm -Rf sillytestdir ; mkdir sillytestdir ; cd sillytestdir ; touch sillytest ; ( command exec {n}<"sillytest" ; printf "fd=%d\n" $n ; sleep 10) & sleep 1 ; ls -la ; rm -f sillytest ; ls -la ; if [[ "$(ls -1 .nfs*)" != "" ]] ; then echo "# test OK" ; else echo "# test FAILED" ; fi ; wait'
- #
- # EOF.
- --
- 2.45.1
- From a936e7a852c91facacf3d9fdc27edcb7247887c0 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 25 Nov 2024 13:39:35 +0100
- Subject: [PATCH 2/8] cygwin: nfsurlconv in shell-safe mode should also encode
- '(', ')'
- nfsurlconv in shell-safe mode should also encode '(', ')'
- Reported-by: Martin Wege <martin.l.wege@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/utils/nfsurlconv/nfsurlconv.ksh | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
- diff --git a/cygwin/utils/nfsurlconv/nfsurlconv.ksh b/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- index d7c2671..8dbe955 100644
- --- a/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- +++ b/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- @@ -224,8 +224,9 @@ function urlencodestr
- # ("/" for nfs://-URLS) are allowed
- #
- if (( posix_shell_safe != 0 )) ; then
- - # in POSIX shell safe mode we also encode '!', '*', '$'
- - if (( ch_num > 127 )) || [[ "$ch" != ~(Elr)[/-_.+\'(),[:alnum:]] ]] ; then
- + # in POSIX shell safe mode we also encode
- + # '!', '*', '$', "(", ")", "{", "}", "#"
- + if (( ch_num > 127 )) || [[ "$ch" != ~(Elr)[/-_.,[:alnum:]] ]] ; then
- url+="%$ch_hexval"
- else
- url+="$ch"
- @@ -283,7 +284,7 @@ function main
- # fixme: Need better text layout for $ nfsurlconv --man #
- typeset -r nfsurlconv_usage=$'+
- - [-?\n@(#)\$Id: nfsurlconv (Roland Mainz) 2024-11-22 \$\n]
- + [-?\n@(#)\$Id: nfsurlconv (Roland Mainz) 2024-11-25 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?nfsurlconv - convert hostname,port,path from/to a nfs://-URL]
- [+DESCRIPTION?\bnfsurlconv\b convert { hostname, port, path } from/to a nfs://-URL.]
- --
- 2.45.1
- From 18e3d236d5cf7156e71ae645bb42681e6d6966c4 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 25 Nov 2024 14:06:25 +0100
- Subject: [PATCH 3/8] cygwin: mount_sshnfs,nfsurlconv,sshnfs: Fix URL decoding
- with path "+c"
- mount_sshnfs,nfsurlconv,sshnfs: Fix URL decoding in function "urldecodestr"
- with path "+c", e.g. "nfs://bbb:12049//a/b/%2bc"
- Reported-by: Martin Wege <martin.l.wege@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/utils/mount_sshnfs/mount_sshnfs.ksh | 8 ++++----
- cygwin/utils/nfsurlconv/nfsurlconv.ksh | 2 +-
- cygwin/utils/sshnfs/sshnfs.ksh | 2 +-
- 3 files changed, 6 insertions(+), 6 deletions(-)
- diff --git a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- index 861a010..ace325a 100644
- --- a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- +++ b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- @@ -254,7 +254,7 @@ function urldecodestr
- # urldecode '+' to ' '
- s="${s//+/ }"
- # urldecode %<hexdigit><hexdigit>
- - s="${s//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x}"
- + s="${s//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x[]}"
- # quote any remaining "%" to make it safe for printf(1)
- s="${s//%/%%}"
- @@ -422,7 +422,7 @@ function cmd_mount
- # fixme: Need better text layout for $ mount_sshnfs mount --man #
- typeset -r mount_sshnfs_cmdmount_usage=$'+
- - [-?\n@(#)\$Id: mount_sshnfs mount (Roland Mainz) 2024-09-03 \$\n]
- + [-?\n@(#)\$Id: mount_sshnfs mount (Roland Mainz) 2024-11-25 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?mount_sshnfs mount - mount NFSv4 filesystem through ssh
- tunnel]
- @@ -788,7 +788,7 @@ function cmd_umount
- typeset mydebug=false # fixme: should be "bool" for ksh93v
- # fixme: Need better text layout for $ mount_sshnfs mount --man #
- typeset -r mount_sshnfs_cmdumount_usage=$'+
- - [-?\n@(#)\$Id: mount_sshnfs umount (Roland Mainz) 2024-09-03 \$\n]
- + [-?\n@(#)\$Id: mount_sshnfs umount (Roland Mainz) 2024-11-25 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?mount_sshnfs umount - unmount NFSv4 filesystem mounted
- via mount_sshnfs mount]
- @@ -892,7 +892,7 @@ function main
- # fixme: Need better text layout for $ mount_sshnfs --man #
- typeset -r mount_sshnfs_usage=$'+
- - [-?\n@(#)\$Id: mount_sshnfs (Roland Mainz) 2024-09-03 \$\n]
- + [-?\n@(#)\$Id: mount_sshnfs (Roland Mainz) 2024-11-25 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?mount_sshnfs - mount/umount NFSv4 filesystem via ssh
- tunnel]
- diff --git a/cygwin/utils/nfsurlconv/nfsurlconv.ksh b/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- index 8dbe955..063ad77 100644
- --- a/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- +++ b/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- @@ -52,7 +52,7 @@ function urldecodestr
- # urldecode '+' to ' '
- s="${s//+/ }"
- # urldecode %<hexdigit><hexdigit>
- - s="${s//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x}"
- + s="${s//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x[]}"
- # quote any remaining "%" to make it safe for printf(1)
- s="${s//%/%%}"
- diff --git a/cygwin/utils/sshnfs/sshnfs.ksh b/cygwin/utils/sshnfs/sshnfs.ksh
- index 29f5dc0..6582ae2 100644
- --- a/cygwin/utils/sshnfs/sshnfs.ksh
- +++ b/cygwin/utils/sshnfs/sshnfs.ksh
- @@ -236,7 +236,7 @@ function urldecodestr
- # urldecode '+' to ' '
- s="${s//+/ }"
- # urldecode %<hexdigit><hexdigit>
- - s="${s//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x}"
- + s="${s//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x[]}"
- # quote any remaining "%" to make it safe for printf(1)
- s="${s//%/%%}"
- --
- 2.45.1
- From d68f6349b7fb3db70e62b748f46b9c6c282d2eae Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 25 Nov 2024 14:18:46 +0100
- Subject: [PATCH 4/8] cygwin: nfsurlconv: Always encode '+'
- cygwin: nfsurlconv must always encode '+' to make sure
- it is not decoded as <space>.
- Reported-by: Martin Wege <martin.l.wege@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/utils/nfsurlconv/nfsurlconv.ksh | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
- diff --git a/cygwin/utils/nfsurlconv/nfsurlconv.ksh b/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- index 063ad77..505fb56 100644
- --- a/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- +++ b/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- @@ -223,6 +223,9 @@ function urlencodestr
- # Only alphanumerics, "$-_.+!*'()," and reserved characters
- # ("/" for nfs://-URLS) are allowed
- #
- + # Note that '+' must always be encoded to make sure
- + # it is not decoded as <space>
- + #
- if (( posix_shell_safe != 0 )) ; then
- # in POSIX shell safe mode we also encode
- # '!', '*', '$', "(", ")", "{", "}", "#"
- @@ -233,7 +236,7 @@ function urlencodestr
- fi
- else
- - if (( ch_num > 127 )) || [[ "$ch" != ~(Elr)[/$-_.+!*\'(),[:alnum:]] ]] ; then
- + if (( ch_num > 127 )) || [[ "$ch" != ~(Elr)[/$-_.!*\'(),[:alnum:]] ]] ; then
- url+="%$ch_hexval"
- else
- url+="$ch"
- --
- 2.45.1
- From e2a80807a871a115d5b9a6d409e2bb7859f02b3e Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 25 Nov 2024 16:45:07 +0100
- Subject: [PATCH 5/8] daemon: Add workaround for MSYS2's "silly rename" with
- invalid UTF-16 filenames
- Add workaround for MSYS2's "silly rename" with invalid UTF-16 filename
- prefix. Since MSYS2 is a fork of Cygwin they share almost all code,
- except that the prefix for the files is different.
- Reported-by: Cedric Blancher <cedric.blancher@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/setattr.c | 19 +++++++++++++++++++
- 1 file changed, 19 insertions(+)
- diff --git a/daemon/setattr.c b/daemon/setattr.c
- index 34796e1..84efb70 100644
- --- a/daemon/setattr.c
- +++ b/daemon/setattr.c
- @@ -285,6 +285,7 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- EASSERT((rename->FileNameLength%sizeof(WCHAR)) == 0);
- #define CYGWIN_STOMP_SILLY_RENAME_INVALID_UTF16_SEQUENCE 1
- +#define MSYS2_STOMP_SILLY_RENAME_INVALID_UTF16_SEQUENCE 1
- #ifdef CYGWIN_STOMP_SILLY_RENAME_INVALID_UTF16_SEQUENCE
- /*
- @@ -325,6 +326,24 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- (void)memcpy(rename->FileName, L".cyg", 4*sizeof(wchar_t));
- }
- #endif /* CYGWIN_STOMP_SILLY_RENAME_INVALID_UTF16_SEQUENCE */
- +#ifdef MSYS2_STOMP_SILLY_RENAME_INVALID_UTF16_SEQUENCE
- + /*
- + * Stomp MSYS2 "silly rename" invalid Unicode sequence
- + *
- + * Same procedure as Cygwin "silly rename", just with a different
- + * prefix (L".\xdc6d\xdc73\xdc79\xdc73")
- + */
- + if ((rename->FileNameLength > (5*sizeof(wchar_t))) &&
- + (!memcmp(rename->FileName,
- + L".\xdc6d\xdc73\xdc79\xdc73", (5*sizeof(wchar_t))))) {
- + DPRINTF(1, ("handle_nfs41_rename(args->path='%s'): "
- + "msys2 sillyrename prefix "
- + "\".\\xdc6d\\xdc73\\xdc79\\xdc73\" detected, squishing "
- + "prefix to \".msys\"\n",
- + args->path));
- + (void)memcpy(rename->FileName, L".msys", 5*sizeof(wchar_t));
- + }
- +#endif /* MSYS2_STOMP_SILLY_RENAME_INVALID_UTF16_SEQUENCE */
- dst_path.len = (unsigned short)WideCharToMultiByte(CP_UTF8,
- WC_ERR_INVALID_CHARS|WC_NO_BEST_FIT_CHARS,
- --
- 2.45.1
- From 8dc5082d8656d2b378590ff50f2d34e11c0595ac Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 25 Nov 2024 17:38:47 +0100
- Subject: [PATCH 6/8] cygwin: Add MSYS2 as supported toolkit to
- README.bintarball
- Add MSYS2 as supported toolkit to README.bintarball
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/README.bintarball.txt | 86 +++++++++++++++++++++++++++++-------
- 1 file changed, 69 insertions(+), 17 deletions(-)
- diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
- index 050007e..f335787 100644
- --- a/cygwin/README.bintarball.txt
- +++ b/cygwin/README.bintarball.txt
- @@ -43,10 +43,10 @@ NFSv4.1 filesystem driver for Windows 10/11&Windows Server 2019
- characters in the mount path, independent of current locale.
- - UNC paths
- - - Mounting UNC paths without DOS driver letter
- + - Mounting UNC paths without DOS driver letterpacman -S --noconfirm
- - IPv6 support in UNC paths
- - - /sbin/nfs_mount prints UNC paths in Win32+Cygwin formats
- - - Cygwin bash+ksh93 support UNC paths, e.g.
- + - /sbin/nfs_mount prints UNC paths in Win32+Cygwin/MSYS2 formats
- + - Cygwin/MSYS2 bash+ksh93 support UNC paths, e.g.
- cd //derfwnb4966@2049/nfs4/bigdisk/mysqldb4/
- - WSL support
- @@ -70,11 +70,11 @@ NFSv4.1 filesystem driver for Windows 10/11&Windows Server 2019
- - See Linux export(5) refer= option, nfsref(5) or
- https://docs.oracle.com/cd/E86824_01/html/E54764/nfsref-1m.html
- -- SFU/Cygwin support, including:
- +- SFU/Cygwin/MSYS2 support, including:
- - POSIX uid/gid+mode
- - Backwards compatibility to Microsoft's NFSv3 driver
- - Cygwin ACLs, e.g. setfacl/getfacl
- - - Cygwin symlinks
- + - Cygwin/MSYS2 symlinks
- - Custom primary group support
- - Supports primary group changes in the calling process/thread
- @@ -89,7 +89,7 @@ NFSv4.1 filesystem driver for Windows 10/11&Windows Server 2019
- - Software compatibility:
- - Any NFSv4.1 server (Linux, Solaris, Illumos, FreeBSD, nfs4j,
- ...)
- - - All tools from Cygwin/MinGW
- + - All tools from Cygwin/MSYS2/MinGW
- - Visual Studio
- - VMware Workstation (can use VMs hosted on NFSv4.1 filesystem)
- @@ -141,6 +141,38 @@ NFSv4.1 filesystem driver for Windows 10/11&Windows Server 2019
- bison
- cygport
- libiconv-devel
- +- MSYS2 (64bit, optional):
- + - Packages (recommended):
- + base-devel
- + gcc
- + clang
- + sed
- + time
- + coreutils
- + util-linux
- + grep
- + sed
- + emacs
- + gdb
- + make
- + gettext
- + gettext-devel
- + git
- + subversion
- + flex
- + bison
- + unzip
- + pax
- + tar
- + libiconv-devel
- + ncurses-devel
- + gmp-devel
- + mpfr-devel
- + mpc-devel
- + isl-devel
- + procps-ng
- + libiconv-devel
- +
- #
- # 4. Download and install Cygwin (if not installed yet):
- @@ -183,7 +215,25 @@ setup-x86.exe --allow-unsupported-windows -q --no-verify --site "http://ctm.crou
- #
- -# 5. Download "ms-nfs41-client" installation tarball:
- +# 5. Download and install MSYS2/64bit [OPTIONAL]
- +#
- +# 1. Download&&install from Cygwin
- +# ---- snip ----
- +mkdir -p download && cd download
- +wget 'https://github.com/msys2/msys2-installer/releases/download/2024-11-16/msys2-x86_64-20241116.exe'
- +chmod a+x msys2-x86_64-20241116.exe
- +./msys2-x86_64-20241116 --default-answer --root 'C:\msys64' install
- +# ---- snip ----
- +
- +# 2. Install extra packages:
- +# Start MSYS2 UCRT mintty and execute this:
- +# ---- snip ----
- +pacman -S --noconfirm base-devel gcc clang sed time coreutils util-linux grep sed emacs gdb make gettext gettext-devel git subversion flex bison unzip pax tar libiconv-devel ncurses-devel gmp-devel mpfr-devel mpc-devel isl-devel procps-ng libiconv-devel
- +# ---- snip ----
- +
- +
- +#
- +# 6. Download "ms-nfs41-client" installation tarball:
- #
- # (from a Cygwin terminal)
- $ mkdir -p ~/download
- @@ -194,7 +244,7 @@ SHA2-256(${bintarball.base_filename}.tar.bz2)= ${bintarball.archive_sha256hash}
- #
- -# 6. Installation (as "Administrator"):
- +# 7. Installation (as "Administrator"):
- #
- $ (cd / && tar -xf ~/download/${bintarball.base_filename}.tar.bz2 )
- $ /sbin/msnfs41client install
- @@ -202,14 +252,14 @@ $ /sbin/msnfs41client install
- #
- -# 7. Deinstallation:
- +# 8. Deinstallation:
- #
- $ (set -o xtrace ; cd / && tar -tf ~/download/${bintarball.base_filename}.tar.bz2 | while read i ; do [[ -f "$i" ]] && rm "$i" ; done)
- <REBOOT>
- #
- -# 8. Usage:
- +# 9. Usage:
- #
- # Option a)
- @@ -353,10 +403,10 @@ $ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk
- limitation
- - Not all POSIX file types (e.g. block devices) etc. are supported
- +
- #
- -# 9. Notes:
- +# 10. Notes:
- #
- -
- - Idmapping (including uid/gid mapping) between NFSv4 client and
- NFSv4 server works via /lib/msnfs41client/cygwin_idmapper.ksh,
- which either uses builtin static data, or /usr/bin/getent passwd
- @@ -368,7 +418,7 @@ $ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk
- client and server side.
- - UNC paths are supported, after successful mounting /sbin/nfs_mount
- - will list the paths in Cygwin UNC format.
- + will list the paths in Cygwin/MSYS2 UNC format.
- - SIDs work, users with valid Windows accounts (see Cygwin idmapping
- above get their SIDs, unknown users with valid uid/gid values get
- @@ -380,7 +430,7 @@ $ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk
- - pass URL to nfs_mount.exe like this:
- $ nfs_mount -o sec=sys,rw 'L' nfs://derfwnb4966_ipv4//bigdisk #
- -- Cygwin symlinks are supported, but might require
- +- Cygwin/MSYS2 symlinks are supported, but might require
- $ fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1 #.
- This includes symlinks to UNC paths, e.g. as Admin
- $ cmd /c 'mklink /d c:\home\rmainz \\derfwpc5131_ipv6@2049\nfs4\export\home2\rmainz' #
- @@ -451,8 +501,9 @@ $ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk
- user+groups to a small script for the NFSv4 server to set-up
- these accounts on the server side.
- +
- #
- -# 10. Known issues:
- +# 11. Known issues:
- #
- - The kernel driver ("nfs41_driver.sys") does not yet have a
- cryptographic signature for SecureBoot - which means it will only
- @@ -567,8 +618,9 @@ $ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk
- OR "nocache" option, e.g.
- $ /sbin/nfs_mount -o rw,writethru 'j' derfwpc5131:/export/home/rmainz #
- +
- #
- -# 11. Notes for troubleshooting && finding bugs/debugging:
- +# 12. Notes for troubleshooting && finding bugs/debugging:
- #
- - nfsd_debug.exe has the -d option to set a level for debug
- output.
- @@ -603,7 +655,7 @@ $ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk
- #
- -# 12. Source code:
- +# 13. Source code:
- #
- - Source code can be obtained from https://github.com/kofemann/ms-nfs41-client
- or as git bundle from /usr/src/msnfs41client/msnfs41client_git.bundle
- --
- 2.45.1
- From 08cc3d52d011043335596f9be65b11d602307fce Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 25 Nov 2024 17:39:39 +0100
- Subject: [PATCH 7/8] tests: Add MSYS2 installation instructions for tests
- Add MSYS2 installation instructions for tests
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/manual_testing.txt | 43 +++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 42 insertions(+), 1 deletion(-)
- diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
- index 699d20e..48614f2 100644
- --- a/tests/manual_testing.txt
- +++ b/tests/manual_testing.txt
- @@ -7,7 +7,8 @@
- #
- # Notes:
- -# - The following Cygwin packages must be installed for running the tests:
- +# - Cygwin enviroment:
- +# The following Cygwin packages must be installed for running the tests:
- # ---- snip ----
- # gcc-core
- # gcc-g++
- @@ -42,6 +43,46 @@
- # gettext-devel
- # ---- snip ----
- #
- +# - MSYS2 environment:
- +# - Install the env with:
- +# $ mkdir -p download && cd download
- +# $ wget 'https://github.com/msys2/msys2-installer/releases/download/2024-11-16/msys2-x86_64-20241116.exe'
- +# $ chmod a+x msys2-x86_64-20241116.exe
- +# $ ./msys2-x86_64-20241116 --default-answer --root 'C:\msys64' install
- +# - The following MSYS2 packages should be installed for running the tests with MSYS2:
- +# (install with $ pacman -S --noconfirm ${name_of_package} # (use space to separate package names)
- +# ---- snip ----
- +# base-devel
- +# gcc
- +# clang
- +# sed
- +# time
- +# coreutils
- +# util-linux
- +# grep
- +# sed
- +# emacs
- +# gdb
- +# make
- +# gettext
- +# gettext-devel
- +# git
- +# subversion
- +# flex
- +# bison
- +# unzip
- +# pax
- +# tar
- +# libiconv-devel
- +# ncurses-devel
- +# gmp-devel
- +# mpfr-devel
- +# mpc-devel
- +# isl-devel
- +# procps-ng
- +# libiconv-devel
- +# ---- snip ----
- +#
- # - Benchmarking/profiling should be done with the realtime virus checker
- # disabled, e.g. disable it like this from an "Adminstrator" terminal:
- # $ powershell -Command 'Set-MpPreference -DisableRealtimeMonitoring 1' #
- --
- 2.45.1
- From a1d0ceb97ad59c75429fd09d02f9ba65941f80b2 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 25 Nov 2024 19:21:47 +0100
- Subject: [PATCH 8/8] tests: Add MSYS2 support to nfsbuildtest bash build
- tests: Add MSYS2 support to nfsbuildtest.ksh93
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/nfsbuildtest/nfsbuildtest.ksh93 | 157 +++++++++++++++++---------
- 1 file changed, 101 insertions(+), 56 deletions(-)
- diff --git a/tests/nfsbuildtest/nfsbuildtest.ksh93 b/tests/nfsbuildtest/nfsbuildtest.ksh93
- index 4823005..ecda2cd 100644
- --- a/tests/nfsbuildtest/nfsbuildtest.ksh93
- +++ b/tests/nfsbuildtest/nfsbuildtest.ksh93
- @@ -117,7 +117,7 @@ function gcc_build
- # patch sources and configure build
- #
- - # Cygwin: workaround for configure using cp -p where ln -s should be used
- + # Cygwin/MSYS2: workaround for configure using cp -p where ln -s should be used
- # (this is an automake/autoconf issue, they should trust Cygwin and not use
- # ancient workarounds for issues which no longer exists)
- (set -o xtrace ; sed -i "s/as_ln_s='cp -pR'/as_ln_s='ln -s'/g" $(find . -name 'configure') )
- @@ -285,8 +285,8 @@ function bash_build
- # disable loadable plugins
- sed -i -E 's/-\( cd \$\(LOADABLES_DIR\) && \$\(MAKE\) \$\(MFLAGS\) DESTDIR=\$\(DESTDIR\) \$@ \)//' Makefile.in
- - # Cygwin: workaround for configure using cp -p where ln -s should be used
- - # (this is an automake/autoconf issue, they should trust Cygwin and not use
- + # Cygwin/MSYS2: workaround for configure using cp -p where ln -s should be used
- + # (this is an automake/autoconf issue, they should trust Cygwin/MSYS2 and not use
- # ancient workarounds for issues which no longer exists)
- (set -o xtrace ; sed -i "s/as_ln_s='cp -pR'/as_ln_s='ln -s'/g" $(find . -name 'configure') )
- @@ -329,10 +329,18 @@ function bash_build
- #
- # build bash
- #
- - if (( (cygwin_vers.major*1000+cygwin_vers.minor) >= 3005 )) ; then
- - time ksh93 -c 'export SHELL=/bin/ksh93 ; bmake -j8 install DESTDIR=$PWD/install_root'
- + if $config_use_posix_ksh93_builtins ; then
- + if is_cygwin && (( (cygwin_vers.major*1000+cygwin_vers.minor) >= 3005 )) ; then
- + time ksh93 -c 'export SHELL=/bin/ksh93 ; bmake -j8 install DESTDIR=$PWD/install_root'
- + else
- + time ksh93 -c 'export SHELL=/bin/ksh93 ; make -j8 install DESTDIR=$PWD/install_root'
- + fi
- else
- - time ksh93 -c 'export SHELL=/bin/ksh93 ; make -j8 install DESTDIR=$PWD/install_root'
- + if is_cygwin && (( (cygwin_vers.major*1000+cygwin_vers.minor) >= 3005 )) ; then
- + time bash -c 'export SHELL=/bin/bash ; bmake -j8 install DESTDIR=$PWD/install_root'
- + else
- + time bash -c 'export SHELL=/bin/bash ; make -j8 install DESTDIR=$PWD/install_root'
- + fi
- fi
- echo $?
- @@ -464,7 +472,7 @@ function msnfs41client_clean
- function get_cpv_cygwin_version
- {
- nameref c_vers=$1
- - typeset uname_r="${ uname -r ; }"
- + typeset uname_r="${ /usr/bin/uname -r ; }"
- typeset leftover
- leftover="${uname_r/~(Elr)([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-([[:digit:]]+)\..+/x}"
- @@ -483,21 +491,50 @@ function get_cpv_cygwin_version
- return 0
- }
- +function is_cygwin
- +{
- + if [[ "$(/usr/bin/uname -s)" == ~(El)CYGWIN_NT ]] ; then
- + return 0
- + fi
- +
- + return 1
- +}
- +
- +function is_mingw64
- +{
- + if [[ "$(/usr/bin/uname -s)" == ~(El)MINGW64_NT ]] ; then
- + return 0
- + fi
- +
- + return 1
- +}
- #
- -# Enumerate installed Cygwin packages and fill
- +# Enumerate installed toolkit packages and fill
- # an associative array with the package names
- #
- -function enumerate_cygwin_packages
- +function enumerate_toolkit_packages
- {
- nameref package_arr=$1
- typeset i j
- - # cygcheck in Cygwin 3.3 does not support -n
- - /usr/bin/cygcheck -c -d | while read i j ; do
- - package_arr["$i"]='true'
- - done
- - return 0
- + if is_cygwin ; then
- + # cygcheck in Cygwin 3.3 does not support -n
- + /usr/bin/cygcheck -c -d | while read i j ; do
- + package_arr["$i"]='true'
- + done
- + return 0
- + elif is_mingw64 ; then
- + # cygcheck in Cygwin 3.3 does not support -n
- + /usr/bin/pacman -Qqn | while read i j ; do
- + package_arr["$i"]='true'
- + done
- + return 0
- + fi
- +
- + print -u2 -f $"%s: Unsupported toolkit.\n" "$0"
- +
- + return 1
- }
- @@ -505,12 +542,12 @@ function enumerate_cygwin_packages
- # test if a Cygwin package is installed, based on
- # the array of package names passed as $1
- #
- -function is_cygwin_pkg_installed
- +function is_toolkit_pkg_installed
- {
- nameref package_arr=$1
- typeset package_name="$2"
- if [[ ! -v package_arr["$package_name"] ]] ; then
- - print -u2 -f $"Cygwin package '%s' not installed.\n" "$package_name"
- + print -u2 -f $"Toolkit package '%s' not installed.\n" "$package_name"
- return 1
- fi
- @@ -520,7 +557,7 @@ function is_cygwin_pkg_installed
- function main
- {
- - typeset -A icp # installed cygwin packages
- + typeset -A itp # installed toolkit packages
- integer errc=0 # error counter
- typeset target="$1"
- typeset subcmd="$2"
- @@ -528,28 +565,28 @@ function main
- get_cpv_cygwin_version cygwin_vers
- - enumerate_cygwin_packages icp
- + enumerate_toolkit_packages itp
- case "${target}_${subcmd}" in
- 'gcc_createcache')
- - is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'git' || (( errc++ ))
- gcc_createcache
- return $?
- ;;
- 'gcc_build')
- - is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'gcc-core' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'gcc-g++' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'make' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'flex' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'bison' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'libgmp-devel' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'libmpfr-devel' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'libmpc-devel' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'libintl-devel' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'libisl-devel' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'gettext' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'gettext-devel' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'git' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'gcc-core' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'gcc-g++' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'make' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'flex' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'bison' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'libgmp-devel' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'libmpfr-devel' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'libmpc-devel' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'libintl-devel' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'libisl-devel' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'gettext' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'gettext-devel' || (( errc++ ))
- (( errc > 0 )) && return 1
- gcc_build
- return $?
- @@ -559,25 +596,31 @@ function main
- return $?
- ;;
- 'bash_createcache')
- - is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'git' || (( errc++ ))
- bash_createcache
- return $?
- ;;
- 'bash_build')
- - is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'gcc-core' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'gcc-g++' || (( errc++ ))
- - if (( (cygwin_vers.major*1000+cygwin_vers.minor) >= 3005 )) ; then
- - print '# bash_build: Using Cygwin >= 3.5 config'
- - # Only Cygwin >= 3.5 has /usr/bin/bmake
- - is_cygwin_pkg_installed icp 'bmake' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'git' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'gcc-core' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'gcc-g++' || (( errc++ ))
- + if is_cygwin ; then
- + if (( (cygwin_vers.major*1000+cygwin_vers.minor) >= 3005 )) ; then
- + print '# bash_build: Using Cygwin >= 3.5 config'
- + # Only Cygwin >= 3.5 has /usr/bin/bmake
- + is_toolkit_pkg_installed itp 'bmake' || (( errc++ ))
- + else
- + print '# bash_build: Using Cygwin < 3.5 config'
- + is_toolkit_pkg_installed itp 'make' || (( errc++ ))
- + fi
- + elif is_mingw64 ; then
- + is_toolkit_pkg_installed itp 'make' || (( errc++ ))
- else
- - print '# bash_build: Using Cygwin < 3.5 config'
- - is_cygwin_pkg_installed icp 'make' || (( errc++ ))
- + print '# bash_build: unsupported toolkit'
- fi
- - is_cygwin_pkg_installed icp 'libncurses-devel' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'gettext' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'gettext-devel' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'libncurses-devel' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'gettext' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'gettext-devel' || (( errc++ ))
- (( errc > 0 )) && return 1
- bash_build
- return $?
- @@ -587,20 +630,20 @@ function main
- return $?
- ;;
- 'msnfs41client_createcache')
- - is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'git' || (( errc++ ))
- msnfs41client_createcache
- return $?
- ;;
- 'msnfs41client_build')
- - is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'gcc-core' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'gcc-g++' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'mingw64-i686-clang' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'mingw64-x86_64-clang' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'make' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'tar' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'bzip2' || (( errc++ ))
- - is_cygwin_pkg_installed icp 'openssl' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'git' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'gcc-core' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'gcc-g++' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'mingw64-i686-clang' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'mingw64-x86_64-clang' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'make' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'tar' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'bzip2' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'openssl' || (( errc++ ))
- (( errc > 0 )) && return 1
- msnfs41client_build
- return $?
- @@ -626,7 +669,9 @@ function main
- #
- builtin id
- builtin mkdir
- -builtin uname
- +# builtin uname - for now (until we have a native MSYS2 ksh93) we
- +# should not use the builtin uname here, because it will store the
- +# toolkit name (Cygwin, MSYS2, ...) at libast built time
- main "$@"
- return $?
- --
- 2.45.1
msnfs41client: Patches for nfsurlconv+URL parsing+MSYS2 support+testing+misc, 2024-11-25
Posted by Anonymous on Mon 25th Nov 2024 18:29
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.