- From 2cbca275ca05f07ca670faf94a9039d8f82b22c1 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 23 Jul 2024 13:54:54 +0200
- Subject: [PATCH 1/5] daemon: Add |NFS4_FATTR4_OWNER_LIMIT| as limit for
- owner/owner_group fields
- Add |NFS4_FATTR4_OWNER_LIMIT| as limit for owner/owner_group fields.
- Previously we used |NFS4_OPAQUE_LIMIT|, which was larger than
- Win32's practical limit of |256|.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/acl.c | 6 +++---
- daemon/name_cache.c | 4 ++--
- daemon/nfs41_const.h | 8 ++++++++
- daemon/nfs41_types.h | 6 +++---
- daemon/nfs41_xdr.c | 10 +++++-----
- daemon/open.c | 3 ++-
- 6 files changed, 23 insertions(+), 14 deletions(-)
- diff --git a/daemon/acl.c b/daemon/acl.c
- index 6facd54..1a4f312 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -296,7 +296,7 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
- PSID *sids = NULL;
- PSID osid = NULL, gsid = NULL;
- DWORD sid_len;
- - char owner[NFS4_OPAQUE_LIMIT+1], group[NFS4_OPAQUE_LIMIT+1];
- + char owner[NFS4_FATTR4_OWNER_LIMIT+1], group[NFS4_FATTR4_OWNER_LIMIT+1];
- nfsacl41 acl = { 0 };
- DPRINTF(ACLLVL1, ("--> handle_getacl(state->path.path='%s')\n",
- @@ -1323,8 +1323,8 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
- nfsacl41 nfs4_acl = { 0 };
- PSID sid = NULL, gsid = NULL;
- BOOL sid_default, gsid_default;
- - char ownerbuf[NFS4_OPAQUE_LIMIT+1];
- - char groupbuf[NFS4_OPAQUE_LIMIT+1];
- + char ownerbuf[NFS4_FATTR4_OWNER_LIMIT+1];
- + char groupbuf[NFS4_FATTR4_OWNER_LIMIT+1];
- DPRINTF(ACLLVL1, ("--> handle_setacl(state->path.path='%s')\n",
- state->path.path));
- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index ec01296..a21aaf2 100644
- --- a/daemon/name_cache.c
- +++ b/daemon/name_cache.c
- @@ -98,8 +98,8 @@ struct attr_cache_entry {
- unsigned type : 4;
- unsigned invalidated : 1;
- unsigned delegated : 1;
- - char owner[NFS4_OPAQUE_LIMIT+1];
- - char owner_group[NFS4_OPAQUE_LIMIT+1];
- + char owner[NFS4_FATTR4_OWNER_LIMIT+1];
- + char owner_group[NFS4_FATTR4_OWNER_LIMIT+1];
- };
- #define ATTR_ENTRY_SIZE sizeof(struct attr_cache_entry)
- diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
- index 7312cd6..2b599fd 100644
- --- a/daemon/nfs41_const.h
- +++ b/daemon/nfs41_const.h
- @@ -35,6 +35,14 @@
- #define NFS4_EASIZE 256
- #define NFS4_EANAME_SIZE 128
- +/*
- + * |NFS4_FATTR4_OWNER_LIMIT| - limits for
- + * |fattr4_owner|+|fattr4_owner_group|
- + * While the Linux implementation uses |NFS4_OPAQUE_LIMIT|(=1024)
- + * the *practical* limit on Windows is 256.
- + * This also affects memory usage, so a lower limit is better.
- + */
- +#define NFS4_FATTR4_OWNER_LIMIT (256)
- #define NFS41_MAX_FILEIO_SIZE (1024 * 1024)
- #define NFS41_MAX_SERVER_CACHE 1024
- diff --git a/daemon/nfs41_types.h b/daemon/nfs41_types.h
- index 5007e77..21ba34a 100644
- --- a/daemon/nfs41_types.h
- +++ b/daemon/nfs41_types.h
- @@ -127,7 +127,7 @@ typedef struct __nfsace4 {
- uint32_t acetype;
- uint32_t aceflag;
- uint32_t acemask;
- - char who[NFS4_OPAQUE_LIMIT];
- + char who[NFS4_FATTR4_OWNER_LIMIT];
- } nfsace4;
- typedef struct __nfsacl41 {
- @@ -238,8 +238,8 @@ typedef struct __nfs41_file_info {
- uint32_t aclsupport;
- /* Buffers */
- - char owner_buf[NFS4_OPAQUE_LIMIT+1];
- - char owner_group_buf[NFS4_OPAQUE_LIMIT+1];
- + char owner_buf[NFS4_FATTR4_OWNER_LIMIT+1];
- + char owner_group_buf[NFS4_FATTR4_OWNER_LIMIT+1];
- } nfs41_file_info;
- #endif /* !__NFS41_DAEMON_TYPES_H__ */
- diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
- index cbca392..cbfbb17 100644
- --- a/daemon/nfs41_xdr.c
- +++ b/daemon/nfs41_xdr.c
- @@ -311,7 +311,7 @@ static bool_t xdr_nfsace4(
- if (xdr->x_op == XDR_FREE)
- return TRUE;
- - return xdr_string(xdr, &who, NFS4_OPAQUE_LIMIT);
- + return xdr_string(xdr, &who, NFS4_FATTR4_OWNER_LIMIT);
- }
- static bool_t xdr_nfsdacl41(
- @@ -1835,7 +1835,7 @@ static bool_t decode_file_attrs(
- char *ptr = info->owner;
- uint32_t owner_len;
- if (!xdr_bytes(xdr, &ptr, &owner_len,
- - NFS4_OPAQUE_LIMIT)) {
- + NFS4_FATTR4_OWNER_LIMIT)) {
- info->owner = NULL;
- return FALSE;
- }
- @@ -1851,7 +1851,7 @@ static bool_t decode_file_attrs(
- char *ptr = info->owner_group;
- uint32_t owner_group_len;
- if (!xdr_bytes(xdr, &ptr, &owner_group_len,
- - NFS4_OPAQUE_LIMIT)) {
- + NFS4_FATTR4_OWNER_LIMIT)) {
- info->owner_group = NULL;
- return FALSE;
- }
- @@ -2672,7 +2672,7 @@ static bool_t encode_file_attrs(
- char *ptr = &info->owner[0];
- uint32_t owner_len = (uint32_t)strlen(info->owner);
- if (!xdr_bytes(&localxdr, &ptr, &owner_len,
- - NFS4_OPAQUE_LIMIT))
- + NFS4_FATTR4_OWNER_LIMIT))
- return FALSE;
- attrs->attrmask.arr[1] |= FATTR4_WORD1_OWNER;
- }
- @@ -2680,7 +2680,7 @@ static bool_t encode_file_attrs(
- char *ptr = &info->owner_group[0];
- uint32_t owner_group_len = (uint32_t)strlen(info->owner_group);
- if (!xdr_bytes(&localxdr, &ptr, &owner_group_len,
- - NFS4_OPAQUE_LIMIT))
- + NFS4_FATTR4_OWNER_LIMIT))
- return FALSE;
- attrs->attrmask.arr[1] |= FATTR4_WORD1_OWNER_GROUP;
- }
- diff --git a/daemon/open.c b/daemon/open.c
- index dfaf17f..6769e93 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -775,7 +775,8 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- args->changeattr = info.change;
- #ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
- - char owner[NFS4_OPAQUE_LIMIT], owner_group[NFS4_OPAQUE_LIMIT];
- + char owner[NFS4_FATTR4_OWNER_LIMIT+1];
- + char owner_group[NFS4_FATTR4_OWNER_LIMIT+1];
- uid_t map_uid = ~0UL;
- gid_t map_gid = ~0UL;
- char *at_ch; /* pointer to '@' */
- --
- 2.45.1
- From 489456ae4ca85be413fa9aaaa1d60d2c86118724 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 23 Jul 2024 14:09:30 +0200
- Subject: [PATCH 2/5] daemon,dll,tests: |GETTOKINFO_EXTRA_BUFFER| does not fit
- 50 group SIDs
- |GETTOKINFO_EXTRA_BUFFER| does not fit 50 group SIDs, as seen with
- winsg.exe in an enterprise network.
- As fix we increase the buffer size from |2048| to |8192|.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/accesstoken.c | 4 ++--
- dll/nfs41_np.c | 4 ++--
- tests/winsg/winsg.c | 4 ++--
- 3 files changed, 6 insertions(+), 6 deletions(-)
- diff --git a/daemon/accesstoken.c b/daemon/accesstoken.c
- index 4ad62b1..c212c91 100644
- --- a/daemon/accesstoken.c
- +++ b/daemon/accesstoken.c
- @@ -37,10 +37,10 @@
- * |ERROR_INSUFFICIENT_BUFFER| if you just pass the |sizeof(TOKEN_*)|
- * value.
- * Instead of calling |GetTokenInformation()| with |NULL| arg to
- - * obtain the size to allocate we just provide 2048 bytes of extra
- + * obtain the size to allocate we just provide 8192 bytes of extra
- * space after the |TOKEN_*| size, and pray it is enough.
- */
- -#define GETTOKINFO_EXTRA_BUFFER (2048)
- +#define GETTOKINFO_EXTRA_BUFFER (8192)
- bool get_token_user_name(HANDLE tok, char *out_buffer)
- {
- diff --git a/dll/nfs41_np.c b/dll/nfs41_np.c
- index 6e24e21..5538ab3 100644
- --- a/dll/nfs41_np.c
- +++ b/dll/nfs41_np.c
- @@ -93,10 +93,10 @@ bool equal_luid(LUID *l1, LUID *l2)
- * |ERROR_INSUFFICIENT_BUFFER| if you just pass the |sizeof(TOKEN_*)|
- * value.
- * Instead of calling |GetTokenInformation()| with |NULL| arg to
- - * obtain the size to allocate we just provide 2048 bytes of extra
- + * obtain the size to allocate we just provide 8192 bytes of extra
- * space after the |TOKEN_*| size, and pray it is enough.
- */
- -#define GETTOKINFO_EXTRA_BUFFER (2048)
- +#define GETTOKINFO_EXTRA_BUFFER (8192)
- static
- bool get_token_authenticationid(HANDLE tok, LUID *out_authenticationid)
- diff --git a/tests/winsg/winsg.c b/tests/winsg/winsg.c
- index a0f18d8..da5c3a8 100644
- --- a/tests/winsg/winsg.c
- +++ b/tests/winsg/winsg.c
- @@ -80,10 +80,10 @@
- * always fails in Win10 with |ERROR_INSUFFICIENT_BUFFER| if you
- * just pass the |sizeof(TOKEN_*)| value. Instead of calling
- * |GetTokenInformation()| with |NULL| arg to obtain the size to
- - * allocate we just provide 2048 bytes of extra space after the
- + * allocate we just provide 8192 bytes of extra space after the
- * |TOKEN_*| size, and pray it is enough
- */
- -#define GETTOKINFO_EXTRA_BUFFER (2048)
- +#define GETTOKINFO_EXTRA_BUFFER (8192)
- D(
- static
- --
- 2.45.1
- From ed793ae5091f64bf74abeb7072cefa8ea65117ef Mon Sep 17 00:00:00 2001
- From: Cedric Blancher <cedric.blancher@gmail.com>
- Date: Tue, 23 Jul 2024 14:16:29 +0200
- Subject: [PATCH 3/5] tests/winsg: winsg.exe crashes with D() debugging
- enabled.
- winsg.exe crashes with D() debugging enabled.
- Signed-off-by: Roland Mainz <roland.mainz@nrubsig.org>
- ---
- tests/winsg/winsg.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
- diff --git a/tests/winsg/winsg.c b/tests/winsg/winsg.c
- index da5c3a8..4860710 100644
- --- a/tests/winsg/winsg.c
- +++ b/tests/winsg/winsg.c
- @@ -428,7 +428,10 @@ int main(int ac, char *av[])
- "# shelltype=%d, cmd_arg_index=%d, "
- "av[cmd_arg_index]='%s', "
- "new group name '%s'\n",
- - (int)st, cmd_arg_index, av[cmd_arg_index], newgrpname));
- + (int)st,
- + cmd_arg_index,
- + ((cmd_arg_index >= 0)?av[cmd_arg_index]:"<negative-av-idx>"),
- + newgrpname));
- if (!OpenProcessToken(GetCurrentProcess(),
- TOKEN_QUERY|TOKEN_ADJUST_DEFAULT|TOKEN_DUPLICATE,
- --
- 2.45.1
- From 40f50fbffef38c8f5c062d7719218e3d32e6bed4 Mon Sep 17 00:00:00 2001
- From: Cedric Blancher <cedric.blancher@gmail.com>
- Date: Tue, 23 Jul 2024 14:20:02 +0200
- Subject: [PATCH 4/5] tests/winsg: winsg -L fails with "print_groups_in_token:
- LookupAccountSidA() failed, status=122."
- winsg.exe -L fails with "print_groups_in_token: LookupAccountSidA()
- failed, status=122." after printing the first group, because the
- buffer size arguments passed to LookupAccountSidA() must be reset
- to the original values after each iteration.
- Signed-off-by: Roland Mainz <roland.mainz@nrubsig.org>
- ---
- tests/winsg/winsg.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
- diff --git a/tests/winsg/winsg.c b/tests/winsg/winsg.c
- index 4860710..b6d332c 100644
- --- a/tests/winsg/winsg.c
- +++ b/tests/winsg/winsg.c
- @@ -163,9 +163,9 @@ int print_groups_in_token(HANDLE tok)
- DWORD tokdatalen;
- PTOKEN_GROUPS ptgroups;
- char namebuffer[GNLEN+1];
- - DWORD namesize = GNLEN+1;
- + DWORD namesize;
- char domainbuffer[UNLEN+1];
- - DWORD domainbuffer_size = sizeof(domainbuffer);
- + DWORD domainbuffer_size;
- SID_NAME_USE name_use;
- tokdatalen = sizeof(TOKEN_GROUPS)+GETTOKINFO_EXTRA_BUFFER;
- @@ -189,6 +189,9 @@ int print_groups_in_token(HANDLE tok)
- continue;
- }
- + namesize = sizeof(namebuffer)-1;
- + domainbuffer_size = sizeof(domainbuffer)-1;
- +
- if (!LookupAccountSidA(NULL, ptgroups->Groups[i].Sid,
- namebuffer, &namesize, domainbuffer, &domainbuffer_size, &name_use)) {
- D((void)fprintf(stderr, "print_groups_in_token: "
- --
- 2.45.1
- From 99f41ba7044e9f7326d4f59e03069a2b7ec70da2 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 23 Jul 2024 18:56:32 +0200
- Subject: [PATCH 5/5] tests: nfsbuildtest.ksh93 should have a "bash" target
- nfsbuildtest.ksh93 should have a "bash" target
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/nfsbuildtest/nfsbuildtest.ksh93 | 441 ++++++++++++++++++++------
- 1 file changed, 340 insertions(+), 101 deletions(-)
- diff --git a/tests/nfsbuildtest/nfsbuildtest.ksh93 b/tests/nfsbuildtest/nfsbuildtest.ksh93
- index fe7d492..e7b7003 100644
- --- a/tests/nfsbuildtest/nfsbuildtest.ksh93
- +++ b/tests/nfsbuildtest/nfsbuildtest.ksh93
- @@ -3,129 +3,368 @@
- #
- # nfsbuildtest.ksh93
- #
- -# Simple NFSv4 torture test by building gcc in parallel
- +# Simple NFSv4 torture test by building { bash, gcc } in parallel
- # on a NFS filesystem
- #
- -set -o xtrace
- -set -o errexit
- -set -o nounset
- #
- -# build config
- +# Usage:
- +# - build bash:
- +# $ ksh93 nfsbuildtest.ksh93 bash clean
- +# $ ksh93 nfsbuildtest.ksh93 bash createcache
- +# $ ksh93 nfsbuildtest.ksh93 bash build
- #
- -typeset config_cp_p_function_not_implemented_workaround=false
- -typeset config_use_posix_ksh93_builtins=true
- -
- -compound gitdata=(
- - typeset url='git://repo.or.cz/gcc.git'
- - # use fixed git tag, so build times are compareable
- - typeset tag='releases/gcc-13.1.0'
- -)
- -
- -typeset -a configure_options=(
- - # Per irc://irc.oftc.net/#gcc:
- - # ".. pch is broken on windows as allocation using the fixed
- - # address might not succeed in general and there is fixed
- - # retry loop using delay that kills all performance
- - # benefits..."
- - '--disable-libstdcxx-pch'
- -)
- -
- -#
- -# temp dir setup
- +# - build gcc:
- +# $ ksh93 nfsbuildtest.ksh93 gcc clean
- +# $ ksh93 nfsbuildtest.ksh93 gcc createcache
- +# $ ksh93 nfsbuildtest.ksh93 gcc build
- #
- -# fixme: Does not work with NFSv4.1 filesystem from exported Linux tmpfs - why ?
- -#tmpdir='/cygdrive/m/tmpdir'
- -#mkdir -p "$tmpdir"
- -#chmod a=rwxt "$tmpdir"
- -#if [[ -d "$tmpdir" && -w "$tmpdir" ]] ; then
- -# export TMPDIR="$tmpdir"
- -#fi
- +function gcc_createcache
- +{
- + set -o xtrace
- + set -o errexit
- + set -o nounset
- -#
- -# print user info
- -#
- -id -a
- -pwd
- + mkdir -p 'gitbundles'
- + rm -f 'gitbundles/gcc.bundle'
- -#
- -# source checkout
- -#
- + git -c checkout.workers=16 clone git://repo.or.cz/gcc.git
- + cd gcc
- + git config --global --add safe.directory "$PWD"
- + git bundle create '../gitbundles/gcc.bundle' --all
- + git config --global --unset safe.directory "$PWD"
- + cd ..
- + rm -Rf gcc
- -#time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch git://gcc.gnu.org/git/gcc.git
- -#time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch https://github.com/gcc-mirror/gcc.git
- -
- -if [[ -f '../gitbundles/gcc.bundle' ]] ; then
- - # Use local bundle as cache,
- - # so build times only depend on local filesystem performance
- - # and not HTTPS speed
- - #
- - # The bundle was created like this:
- - # ---- snip ----
- - # git clone git://repo.or.cz/gcc.git
- - # cd gcc
- - # git bundle create '../gitbundles/gcc.bundle' --all
- - # cd ..
- - # rm -Rf gcc
- - # ---- snip ----
- - time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch '../gitbundles/gcc.bundle'
- -else
- - time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch "${gitdata.url}"
- -fi
- -
- -cd "$PWD/gcc/"
- -
- -if $config_use_posix_ksh93_builtins ; then
- - PATH="/usr/ast/bin:/opt/ast/bin:$PATH"
- -fi
- + return 0
- +}
- -#
- -# patch sources and configure build
- -#
- -# 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
- -# 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') )
- +function gcc_build
- +{
- + set -o xtrace
- + set -o errexit
- + set -o nounset
- +
- + #
- + # build config
- + #
- + typeset config_cp_p_function_not_implemented_workaround=false
- + typeset config_use_posix_ksh93_builtins=true
- +
- + compound gitdata=(
- + typeset url='git://repo.or.cz/gcc.git'
- + # use fixed git tag, so build times are compareable
- + typeset tag='releases/gcc-13.1.0'
- + )
- +
- + typeset -a configure_options=(
- + # Per irc://irc.oftc.net/#gcc:
- + # ".. pch is broken on windows as allocation using the fixed
- + # address might not succeed in general and there is fixed
- + # retry loop using delay that kills all performance
- + # benefits..."
- + '--disable-libstdcxx-pch'
- + )
- +
- + #
- + # temp dir setup
- + #
- +
- + # fixme: Does not work with NFSv4.1 filesystem from exported Linux tmpfs - why ?
- + #tmpdir='/cygdrive/m/tmpdir'
- + #mkdir -p "$tmpdir"
- + #chmod a=rwxt "$tmpdir"
- + #if [[ -d "$tmpdir" && -w "$tmpdir" ]] ; then
- + # export TMPDIR="$tmpdir"
- + #fi
- +
- + #
- + # print user info
- + #
- + id -a
- + pwd
- +
- + #
- + # source checkout
- + #
- +
- + #time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch git://gcc.gnu.org/git/gcc.git
- + #time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch https://github.com/gcc-mirror/gcc.git
- +
- + if [[ -f '../gitbundles/gcc.bundle' ]] ; then
- + # Use local bundle as cache,
- + # so build times only depend on local filesystem performance
- + # and not HTTPS speed
- + time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch '../gitbundles/gcc.bundle'
- + else
- + time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch "${gitdata.url}"
- + fi
- +
- + cd "$PWD/gcc/"
- -if $config_use_posix_ksh93_builtins ; then
- - (set -o xtrace ; sed -i "s/\/bin\/sh/\/bin\/ksh93/g" $(find . -name 'configure') )
- -fi
- + if $config_use_posix_ksh93_builtins ; then
- + PATH="/usr/ast/bin:/opt/ast/bin:$PATH"
- + fi
- +
- + #
- + # patch sources and configure build
- + #
- -if $config_use_posix_ksh93_builtins ; then
- - ksh93 ./configure "${configure_options[@]}"
- -else
- - bash ./configure "${configure_options[@]}"
- -fi
- + # 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
- + # 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') )
- +
- + if $config_use_posix_ksh93_builtins ; then
- + (set -o xtrace ; sed -i "s/\/bin\/sh/\/bin\/ksh93/g" $(find . -name 'configure') )
- + fi
- -if $config_cp_p_function_not_implemented_workaround ; then
- - # workaround for $ cp -p # failing with "Function not
- - # implemented" in older versions of ms-nfs41-client
- if $config_use_posix_ksh93_builtins ; then
- - (
- - set -o xtrace
- - sed -i -r 's/(cp.*)([[:space:]]+-p[[:space:]]+)/\2 -A pt /g' \
- + export CONFIG_SHELL=/usr/bin/ksh93
- + ksh93 ./configure "${configure_options[@]}"
- + else
- + export CONFIG_SHELL=/usr/bin/bash
- + bash ./configure "${configure_options[@]}"
- + fi
- +
- + if $config_cp_p_function_not_implemented_workaround ; then
- + # workaround for $ cp -p # failing with "Function not
- + # implemented" in older versions of ms-nfs41-client
- + if $config_use_posix_ksh93_builtins ; then
- + (
- + set -o xtrace
- + sed -i -r 's/(cp.*)([[:space:]]+-p[[:space:]]+)/\2 -A pt /g' \
- + $(find . -name 'Makefile' -o -name 'Makefile.in')
- + )
- + else
- + (
- + set -o xtrace ; sed -i -r 's/(cp.*)([[:space:]]+-p[[:space:]]+)/\2--no-preserve=ownership /g' \
- $(find . -name 'Makefile' -o -name 'Makefile.in')
- - )
- + )
- + fi
- + fi
- +
- + if $config_use_posix_ksh93_builtins ; then
- + # replace /bin/sh with /bin/ksh93 for speed
- + (set -o xtrace ; sed -i -r 's/\/bin\/sh/\/bin\/ksh93/g' \
- + $(find . -name 'Makefile' -o -name 'Makefile.in') )
- + fi
- +
- + #
- + # build gcc
- + #
- + time ksh93 -c 'export SHELL=/bin/ksh93 ; (yes | make -j8 all)'
- + echo $?
- +
- + echo "#Done."
- + return 0
- +}
- +
- +
- +function gcc_clean
- +{
- + set -o xtrace
- + set -o errexit
- + set -o nounset
- +
- + rm -Rf gcc
- + return 0
- +}
- +
- +
- +function bash_createcache
- +{
- + set -o xtrace
- + set -o errexit
- + set -o nounset
- +
- + mkdir -p 'gitbundles'
- + rm -f 'gitbundles/bash.bundle'
- +
- + git -c checkout.workers=16 clone 'https://github.com/bminor/bash.git'
- + cd bash
- + git config --global --add safe.directory "$PWD"
- + git bundle create '../gitbundles/bash.bundle' --all
- + git config --global --unset safe.directory "$PWD"
- + cd ..
- + rm -Rf bash
- +
- + return 0
- +}
- +
- +
- +function bash_build
- +{
- + set -o xtrace
- + set -o errexit
- + set -o nounset
- +
- + #
- + # build config
- + #
- + typeset config_cp_p_function_not_implemented_workaround=false
- + typeset config_use_posix_ksh93_builtins=true
- +
- + compound gitdata=(
- + typeset url='https://github.com/bminor/bash.git'
- + # use fixed git tag, so build times are compareable
- + typeset tag='master'
- + )
- +
- + typeset -a configure_options=(
- + '--with-curses'
- + )
- +
- + #
- + # temp dir setup
- + #
- +
- + # fixme: Does not work with NFSv4.1 filesystem from exported Linux tmpfs - why ?
- + #tmpdir='/cygdrive/m/tmpdir'
- + #mkdir -p "$tmpdir"
- + #chmod a=rwxt "$tmpdir"
- + #if [[ -d "$tmpdir" && -w "$tmpdir" ]] ; then
- + # export TMPDIR="$tmpdir"
- + #fi
- +
- + #
- + # print user info
- + #
- + id -a
- + pwd
- +
- + #
- + # source checkout
- + #
- +
- + if [[ -f '../gitbundles/bash.bundle' ]] ; then
- + # Use local bundle as cache,
- + # so build times only depend on local filesystem performance
- + # and not HTTPS speed
- + time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch '../gitbundles/bash.bundle'
- else
- - (
- - set -o xtrace ; sed -i -r 's/(cp.*)([[:space:]]+-p[[:space:]]+)/\2--no-preserve=ownership /g' \
- + time git -c checkout.workers=16 clone -b "${gitdata.tag}" --single-branch "${gitdata.url}"
- + fi
- +
- + cd "$PWD/bash/"
- +
- + if $config_use_posix_ksh93_builtins ; then
- + PATH="/usr/ast/bin:/opt/ast/bin:$PATH"
- + fi
- +
- + #
- + # patch sources and configure build
- + #
- +
- + # 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
- + # 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') )
- +
- + if $config_use_posix_ksh93_builtins ; then
- + (set -o xtrace ; sed -i "s/\/bin\/sh/\/bin\/ksh93/g" $(find . -name 'configure') )
- + fi
- +
- + if $config_use_posix_ksh93_builtins ; then
- + CONFIG_SHELL=/usr/bin/ksh93 ksh93 ./configure "${configure_options[@]}"
- + else
- + CONFIG_SHELL=/usr/bin/bash bash ./configure "${configure_options[@]}"
- + fi
- +
- + if $config_cp_p_function_not_implemented_workaround ; then
- + # workaround for $ cp -p # failing with "Function not
- + # implemented" in older versions of ms-nfs41-client
- + if $config_use_posix_ksh93_builtins ; then
- + (
- + set -o xtrace
- + sed -i -r 's/(cp.*)([[:space:]]+-p[[:space:]]+)/\2 -A pt /g' \
- + $(find . -name 'Makefile' -o -name 'Makefile.in')
- + )
- + else
- + (
- + set -o xtrace ; sed -i -r 's/(cp.*)([[:space:]]+-p[[:space:]]+)/\2--no-preserve=ownership /g' \
- $(find . -name 'Makefile' -o -name 'Makefile.in')
- - )
- + )
- + fi
- fi
- -fi
- -if $config_use_posix_ksh93_builtins ; then
- - # replace /bin/sh with /bin/ksh93 for speed
- - (set -o xtrace ; sed -i -r 's/\/bin\/sh/\/bin\/ksh93/g' \
- - $(find . -name 'Makefile' -o -name 'Makefile.in') )
- -fi
- + if $config_use_posix_ksh93_builtins ; then
- + # replace /bin/sh with /bin/ksh93 for speed
- + (set -o xtrace ; sed -i -r 's/\/bin\/sh/\/bin\/ksh93/g' \
- + $(find . -name 'Makefile' -o -name 'Makefile.in') )
- + fi
- +
- + #
- + # build bash
- + #
- + time ksh93 -c 'export SHELL=/bin/ksh93 ; bmake -j8'
- + echo $?
- +
- + echo "#Done."
- + return 0
- +}
- +
- +
- +function bash_clean
- +{
- + set -o xtrace
- + set -o errexit
- + set -o nounset
- +
- + rm -Rf bash
- + return 0
- +}
- +
- +builtin id
- +builtin mkdir
- +
- +function main
- +{
- + typeset target="$1"
- + typeset subcmd="$2"
- +
- + case "${target}_${subcmd}" in
- + 'gcc_createcache')
- + gcc_createcache
- + return $?
- + ;;
- + 'gcc_build')
- + gcc_build
- + return $?
- + ;;
- + 'gcc_clean')
- + gcc_clean
- + return $?
- + ;;
- + 'bash_createcache')
- + bash_createcache
- + return $?
- + ;;
- + 'bash_build')
- + bash_build
- + return $?
- + ;;
- + 'bash_clean')
- + bash_clean
- + return $?
- + ;;
- + *)
- + print -u2 -f $"%s: Unknown %q/%q combination." \
- + "$0" "${target}" "${subcmd}"
- + return 1
- + ;;
- + esac
- +
- + # not reached
- + return 1
- +}
- #
- -# build gcc
- +# main
- #
- -time ksh93 -c 'export SHELL=/bin/ksh93 ; (yes | make -j8 all)'
- -echo $?
- +main "$@"
- +return $?
- -echo "#Done."
- +# EOF.
- --
- 2.45.1
msnfs41client: Patches for realistic owner/owner_group buffers, WinSG fixes, more tests+misc, 2024-07-23
Posted by Anonymous on Tue 23rd Jul 2024 18:10
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.