- From e53d97e9bf5e78f91ac9d378b0e3eaa478eb6415 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 17 Sep 2024 13:17:04 +0200
- Subject: [PATCH 1/2] daemon: Improve debugging/error messages in Cygwin
- idmapper
- Improve debugging/error messages in Cygwin idmapper.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/idmap_cygwin.c | 72 +++++++++++++++++++++++++++++++++----------
- 1 file changed, 55 insertions(+), 17 deletions(-)
- diff --git a/daemon/idmap_cygwin.c b/daemon/idmap_cygwin.c
- index 3d4a1be..ec60142 100644
- --- a/daemon/idmap_cygwin.c
- +++ b/daemon/idmap_cygwin.c
- @@ -1,5 +1,5 @@
- /* NFSv4.1 client for Windows
- - * Copyright X 2023 Roland Mainz <roland.mainz@nrubsig.org>
- + * Copyright (C) 2023-2024 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Roland Mainz <roland.mainz@nrubsig.org>
- *
- @@ -65,7 +65,9 @@ int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid,
- cpv_name_val *cnv_cur = NULL;
- const char *localaccoutname = NULL;
- - DPRINTF(CYGWINIDLVL, ("--> cygwin_getent_passwd('%s')\n", name));
- + DPRINTF(CYGWINIDLVL,
- + ("--> cygwin_getent_passwd(name='%s')\n",
- + name));
- /* fixme: better quoting for |name| needed */
- (void)snprintf(cmdbuff, sizeof(cmdbuff),
- @@ -74,7 +76,10 @@ int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid,
- name);
- if ((script_pipe = subcmd_popen(cmdbuff)) == NULL) {
- int last_error = GetLastError();
- - DPRINTF(0, ("cygwin_getent_passwd: '%s' failed, GetLastError()='%d'\n",
- + DPRINTF(0,
- + ("cygwin_getent_passwd(name='%s'): "
- + "'%s' failed, GetLastError()='%d'\n",
- + name,
- cmdbuff,
- last_error));
- goto fail;
- @@ -82,25 +87,37 @@ int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid,
- if (!subcmd_readcmdoutput(script_pipe,
- buff, sizeof(buff), &num_buff_read)) {
- - DPRINTF(0, ("cygwin_getent_passwd: subcmd_readcmdoutput() failed\n"));
- + DPRINTF(0,
- + ("cygwin_getent_passwd(name='%s'): "
- + "subcmd_readcmdoutput() failed\n",
- + name));
- goto fail;
- }
- buff[num_buff_read] = '\0';
- if (num_buff_read < 10) {
- - DPRINTF(0, ("cygwin_getent_passwd: Could not read enough data, returned %d\n", (int)num_buff_read));
- + DPRINTF(0,
- + ("cygwin_getent_passwd(name='%s'): "
- + "Could not read enough data, returned %d\n",
- + name, (int)num_buff_read));
- goto fail;
- }
- cpvp = cpv_create_parser(buff, 0/*CPVFLAG_DEBUG_OUTPUT*/);
- if (!cpvp) {
- - DPRINTF(0, ("cygwin_getent_passwd: Could not create parser\n"));
- + DPRINTF(0,
- + ("cygwin_getent_passwd(name='%s'): "
- + "Could not create parser\n",
- + name));
- goto fail;
- }
- if (cpv_read_cpv_header(cpvp)) {
- - DPRINTF(0, ("cygwin_getent_passwd: cpv_read_cpv_header failed\n"));
- + DPRINTF(0,
- + ("cygwin_getent_passwd(name='%s'): "
- + "cpv_read_cpv_header failed\n",
- + name));
- goto fail;
- }
- @@ -149,7 +166,8 @@ fail:
- cpv_free_parser(cpvp);
- if (res == 0) {
- - DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_passwd('%s'): "
- + DPRINTF(CYGWINIDLVL,
- + ("<-- cygwin_getent_passwd(name='%s'): "
- "returning res_uid=%u, res_gid=%u, res_loginname='%s'\n",
- name,
- (unsigned int)(*res_uid),
- @@ -157,7 +175,8 @@ fail:
- res_loginname?res_loginname:"<NULL>"));
- }
- else {
- - DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_passwd('%s'): no match found\n",
- + DPRINTF(CYGWINIDLVL,
- + ("<-- cygwin_getent_passwd(name='%s'): no match found\n",
- name));
- }
- @@ -180,7 +199,9 @@ int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid)
- const char *localgroupname = NULL;
- - DPRINTF(CYGWINIDLVL, ("--> cygwin_getent_group('%s')\n", name));
- + DPRINTF(CYGWINIDLVL,
- + ("--> cygwin_getent_group(name='%s')\n",
- + name));
- /* fixme: better quoting for |name| needed */
- (void)snprintf(cmdbuff, sizeof(cmdbuff),
- @@ -189,7 +210,10 @@ int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid)
- name);
- if ((script_pipe = subcmd_popen(cmdbuff)) == NULL) {
- int last_error = GetLastError();
- - DPRINTF(0, ("cygwin_getent_group: '%s' failed, GetLastError()='%d'\n",
- + DPRINTF(0,
- + ("cygwin_getent_group(name='%s'): "
- + "'%s' failed, GetLastError()='%d'\n",
- + name,
- cmdbuff,
- last_error));
- goto fail;
- @@ -197,25 +221,37 @@ int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid)
- if (!subcmd_readcmdoutput(script_pipe,
- buff, sizeof(buff), &num_buff_read)) {
- - DPRINTF(0, ("cygwin_getent_group: subcmd_readcmdoutput() failed\n"));
- + DPRINTF(0,
- + ("cygwin_getent_group(name='%s'): "
- + "subcmd_readcmdoutput() failed\n",
- + name));
- goto fail;
- }
- buff[num_buff_read] = '\0';
- if (num_buff_read < 10) {
- - DPRINTF(0, ("cygwin_getent_group: Could not read enough data, returned %d\n", (int)num_buff_read));
- + DPRINTF(0,
- + ("cygwin_getent_group(name='%s'): "
- + "Could not read enough data, returned %d\n",
- + name, (int)num_buff_read));
- goto fail;
- }
- cpvp = cpv_create_parser(buff, 0/*CPVFLAG_DEBUG_OUTPUT*/);
- if (!cpvp) {
- - DPRINTF(0, ("cygwin_getent_group: Could not create parser\n"));
- + DPRINTF(0,
- + ("cygwin_getent_group(name='%s'): "
- + "Could not create parser\n",
- + name));
- goto fail;
- }
- if (cpv_read_cpv_header(cpvp)) {
- - DPRINTF(0, ("cygwin_getent_group: cpv_read_cpv_header failed\n"));
- + DPRINTF(0,
- + ("cygwin_getent_group(name='%s'): "
- + "cpv_read_cpv_header failed\n",
- + name));
- goto fail;
- }
- @@ -257,14 +293,16 @@ fail:
- cpv_free_parser(cpvp);
- if (res == 0) {
- - DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_group('%s'): "
- + DPRINTF(CYGWINIDLVL,
- + ("<-- cygwin_getent_group(name='%s'): "
- "returning res_gid=%u, res_group_name='%s'\n",
- name,
- (unsigned int)(*res_gid),
- res_group_name?res_group_name:"<NULL>"));
- }
- else {
- - DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_group('%s'): no match found\n",
- + DPRINTF(CYGWINIDLVL,
- + ("<-- cygwin_getent_group(name='%s'): no match found\n",
- name));
- }
- --
- 2.45.1
- From aa934fe5f965d1c797a6a8d08d79947d8fe22b48 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 17 Sep 2024 13:49:44 +0200
- Subject: [PATCH 2/2] cygwin: msnfs41client.bash install subcmd should test if
- ksh93 is working
- msnfs41client.bash install subcmd should test if /usr/bin/ksh93 is
- working, as ksh93 is used by the Cygwin idmapper code to run a ksh93
- script to do the idmapping.
- This is needed because ksh93 build with Cygwin 3.6 does not work
- on Cygwin 3.5.4, as reported in
- https://sourceforge.net/p/ms-nfs41-client/mailman/message/58817841/
- Reported-by: Mark Liam Brown <brownmarkliam@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/devel/msnfs41client.bash | 24 ++++++++++++++++++++++++
- 1 file changed, 24 insertions(+)
- diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
- index dca774f..50efb21 100755
- --- a/cygwin/devel/msnfs41client.bash
- +++ b/cygwin/devel/msnfs41client.bash
- @@ -185,6 +185,30 @@ function nfsclient_install
- # query new 'ms-nfs41-client-service'
- sc query 'ms-nfs41-client-service'
- + #
- + # check whether ksh93 works
- + # (The ms-nfs41-client cygwin idmapper uses ksh93 scripts for
- + # idmapping, and if ksh93 does not work properly nfsd*.exe
- + # will not work)
- + #
- + set +o xtrace
- + typeset cmdout
- + cmdout="$( \
- + { \
- + /usr/bin/ksh93 -c \
- + 'compound c=(typeset -a ar); c.ar=("hello"); c.ar+=("world"); printf "%s" "${c.ar[*]}"' ; \
- + echo $? ; } 2>&1 \
- + )"
- +
- + if [[ "${cmdout}" != $'hello world0' ]] ; then
- + printf $"ERROR: /usr/bin/ksh93 does not work, expected test output |%q|, got |%q|\n" \
- + $'hello world0' \
- + "$cmdout"
- + return 1
- + fi
- + printf '/usr/bin/ksh93 is working\n'
- + set -o xtrace
- +
- # check whether the driver really has been installed
- md5sum \
- "$PWD/nfs41_driver.sys" \
- --
- 2.45.1
msnfs41client: Patches for better idmapper debug output+idmapper ksh93 functional test, 2024-09-17
Posted by Anonymous on Tue 17th Sep 2024 16:35
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.