pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patch for multiarch support+docs+misc, 2024-05-21
Posted by Anonymous on Tue 21st May 2024 17:05
raw | new post

  1. From 9f531aba9e8ce82de5956ff64f68717a3a1e53e9 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Tue, 21 May 2024 13:48:21 +0200
  4. Subject: [PATCH 1/3] cygwin: Multiarch support for "msnfs41client"+better
  5.  error checking
  6.  
  7. Add support for multiple architectures to msnfs41client.bash,
  8. and improve error checking
  9.  
  10. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  11. ---
  12.  cygwin/devel/msnfs41client.bash | 146 +++++++++++++++++++++++++-------
  13.  1 file changed, 117 insertions(+), 29 deletions(-)
  14.  
  15. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  16. index cf4c516..a0ea540 100644
  17. --- a/cygwin/devel/msnfs41client.bash
  18. +++ b/cygwin/devel/msnfs41client.bash
  19. @@ -44,6 +44,42 @@ function is_windows_admin_account
  20.         return 1
  21.  }
  22.  
  23. +function check_machine_arch
  24. +{
  25. +       typeset winpwd
  26. +       typeset uname_m
  27. +
  28. +       # get the location where this script is installed,
  29. +       # because on Cygwin the script will be installed
  30. +       # in /cygdrive/c/cygwin/lib/msnfs41client/ (32bit) or
  31. +       # in /cygdrive/c/cygwin64/lib/msnfs41client/ (64bit).
  32. +       winpwd="$(cygpath -w "$(dirname -- "$(realpath "${BASH_SOURCE[0]}")")")"
  33. +
  34. +       uname_m="$(uname -m)"
  35. +
  36. +       case "${uname_m}" in
  37. +               'x86_64')
  38. +                       if [[ "${winpwd}" != 'C:\cygwin64\'* ]] ; then
  39. +                               printf $"%s: Requires 64bit Cygwin\n" "$0" 1>&2
  40. +                               return 1
  41. +                       fi
  42. +                       return 0
  43. +                       ;;
  44. +               'i686')
  45. +                       if [[ "${winpwd}" != 'C:\cygwin\'* ]] ; then
  46. +                               printf $"%s: Requires 32bit Cygwin\n" "$0" 1>&2
  47. +                               return 1
  48. +                       fi
  49. +                       return 0
  50. +                       ;;
  51. +               *)
  52. +                       printf $"%s: Unknown arch/Cygwin combination ('%s'/'%s')\n" "$0" "${uname_m}" "${winpwd}" 1>&2
  53. +                       return 1
  54. +                       ;;
  55. +       esac
  56. +       # not reached
  57. +}
  58. +
  59.  function nfsclient_install
  60.  {
  61.         set -o nounset
  62. @@ -52,14 +88,10 @@ function nfsclient_install
  63.  
  64.         # switch to the location where this script is installed,
  65.         # because on Cygwin the script will be installed
  66. -       # in /cygdrive/c/cygwin64/lib/msnfs41client/
  67. +       # in /cygdrive/c/cygwin/lib/msnfs41client/ (32bit) or
  68. +       # in /cygdrive/c/cygwin64/lib/msnfs41client/ (64bit).
  69.         cd -P "$(dirname -- "$(realpath "${BASH_SOURCE[0]}")")"
  70.  
  71. -       if ! is_windows_admin_account ; then
  72. -               printf $"%s: Install requires Windows Adminstator permissions.\n" "$0"
  73. -               return 1
  74. -       fi
  75. -
  76.         # make sure all binaries are executable, Windows cmd does
  77.         # not care, but Cygwin&bash do.
  78.         # If *.ddl are not executable nfs*.exe fail with 0xc0000022
  79. @@ -383,18 +415,30 @@ function nfsclient_system_rundeamon
  80.  
  81.  function watch_kernel_debuglog
  82.  {
  83. +       typeset dbgview_cmd
  84. +
  85.         printf "# logging start...\n" 1>&2
  86. +
  87. +       case "$(uname -m)" in
  88. +               'x86_64') dbgview_cmd='dbgview64' ;;
  89. +               'i686')   dbgview_cmd='dbgview' ;;
  90. +               *)
  91. +                       printf $"%s: Unknown machine type\n" "$0" 1>&2
  92. +                       return 1
  93. +                       ;;
  94. +       esac
  95. +
  96.         # seperate process so SIGINT works
  97.         # use DebugView (https://learn.microsoft.com/en-gb/sysinternals/downloads/debugview) to print kernel log
  98. -       bash -c '
  99. +       dbgview_cmd="${dbgview_cmd}" bash -c '
  100.                 klogname="msnfs41client_watch_kernel_debuglog$$.log"
  101. -               dbgview64 /t /k /l "$klogname" &
  102. +               $dbgview_cmd /t /k /l "$klogname" &
  103.                 (( dbgview_pid=$! ))
  104.                 trap "(( dbgview_pid != 0)) && kill $dbgview_pid && wait ; (( dbgview_pid=0 ))" INT TERM EXIT
  105.                 sleep 2
  106.                 printf "# logging %s ...\n" "$klogname" 1>&2
  107.                 tail -n0 -f "$klogname"'
  108. -       printf "# logging done\n" 1>&2
  109. +       printf '# logging done\n' 1>&2
  110.         return 0
  111.  }
  112.  
  113. @@ -481,12 +525,13 @@ function sys_terminal
  114.         PsExec -accepteula -nobanner \
  115.                 -i \
  116.                 -s -w "$(cygpath -w "$PWD")" \
  117. -               'C:\cygwin64\bin\mintty.exe'
  118. +               "$(cygpath -w "$(which mintty.exe)")" --nodaemon
  119.  }
  120.  
  121.  function main
  122.  {
  123.         typeset cmd="$1"
  124. +       typeset -i numerr=0
  125.  
  126.         # path where this script is installed
  127.         typeset scriptpath="$(dirname -- "$(realpath "${BASH_SOURCE[0]}")")"
  128. @@ -511,66 +556,109 @@ function main
  129.  
  130.         case "$cmd" in
  131.                 'install')
  132. +                       check_machine_arch || (( numerr++ ))
  133. +                       require_cmd 'regtool.exe' || (( numerr++ ))
  134. +                       require_cmd 'cygrunsrv.exe' || (( numerr++ ))
  135. +                       require_cmd 'nfsd.exe' || (( numerr++ ))
  136. +                       require_cmd 'nfs_install.exe' || (( numerr++ ))
  137. +                       require_cmd 'rundll32.exe' || (( numerr++ ))
  138. +                       require_cmd 'bcdedit.exe' || (( numerr++ ))
  139. +                       require_cmd 'fsutil.exe' || (( numerr++ ))
  140. +                       require_cmd 'sc.exe' || (( numerr++ ))
  141. +                       if ! is_windows_admin_account ; then
  142. +                               printf $"%s: %q requires Windows Adminstator permissions.\n" "$0" "$cmd"
  143. +                               (( numerr++ ))
  144. +                       fi
  145. +                       (( numerr > 0 )) && return 1
  146. +
  147.                         nfsclient_install
  148.                         return $?
  149.                         ;;
  150.                 'run_deamon' | 'run_daemon')
  151. -                       #require_cmd 'cdb.exe' || return 1
  152. -                       require_cmd 'nfsd.exe' || return 1
  153. -                       require_cmd 'nfsd_debug.exe' || return 1
  154. -                       require_cmd 'nfs_mount.exe' || return 1
  155. +                       check_machine_arch || (( numerr++ ))
  156. +                       #require_cmd 'cdb.exe' || (( numerr++ ))
  157. +                       require_cmd 'nfsd.exe' || (( numerr++ ))
  158. +                       require_cmd 'nfsd_debug.exe' || (( numerr++ ))
  159. +                       require_cmd 'nfs_mount.exe' || (( numerr++ ))
  160. +                       (( numerr > 0 )) && return 1
  161. +
  162.                         nfsclient_rundeamon
  163.                         return $?
  164.                         ;;
  165.                 'sys_run_deamon' | 'sys_run_daemon')
  166. -                       #require_cmd 'cdb.exe' || return 1
  167. -                       require_cmd 'PsExec.exe' || return 1
  168. -                       require_cmd 'nfsd.exe' || return 1
  169. -                       require_cmd 'nfsd_debug.exe' || return 1
  170. -                       require_cmd 'nfs_mount.exe' || return 1
  171. +                       check_machine_arch || (( numerr++ ))
  172. +                       #require_cmd 'cdb.exe' || (( numerr++ ))
  173. +                       require_cmd 'PsExec.exe' || (( numerr++ ))
  174. +                       require_cmd 'nfsd.exe' || (( numerr++ ))
  175. +                       require_cmd 'nfsd_debug.exe' || (( numerr++ ))
  176. +                       require_cmd 'nfs_mount.exe' || (( numerr++ ))
  177.                         if ! is_windows_admin_account ; then
  178.                                 printf $"%s: %q requires Windows Adminstator permissions.\n" "$0" "$cmd"
  179. -                               return 1
  180. +                               (( numerr++ ))
  181.                         fi
  182. +                       (( numerr > 0 )) && return 1
  183. +
  184.                         nfsclient_system_rundeamon
  185.                         return $?
  186.                         ;;
  187.                 'sys_mount_homedir')
  188. -                       require_cmd 'nfs_mount.exe' || return 1
  189. +                       check_machine_arch || (( numerr++ ))
  190. +                       require_cmd 'nfs_mount.exe' || (( numerr++ ))
  191.                         if ! is_windows_admin_account ; then
  192.                                 printf $"%s: %q requires Windows Adminstator permissions.\n" "$0" "$cmd"
  193. -                               return 1
  194. +                               (( numerr++ ))
  195.                         fi
  196. +                       (( numerr > 0 )) && return 1
  197. +
  198.                         nfsclient_system_mount_homedir
  199.                         return $?
  200.                         ;;
  201.                 'mount_homedir')
  202. -                       require_cmd 'nfs_mount.exe' || return 1
  203. +                       check_machine_arch || (( numerr++ ))
  204. +                       require_cmd 'nfs_mount.exe' || (( numerr++ ))
  205. +                       (( numerr > 0 )) && return 1
  206. +
  207.                         nfsclient_mount_homedir
  208.                         return $?
  209.                         ;;
  210.                 'umount_homedir')
  211. -                       require_cmd 'nfs_mount.exe' || return 1
  212. +                       check_machine_arch || (( numerr++ ))
  213. +                       require_cmd 'nfs_mount.exe' || (( numerr++ ))
  214. +                       (( numerr > 0 )) && return 1
  215. +
  216.                         nfsclient_umount_homedir
  217.                         return $?
  218.                         ;;
  219.                 # misc
  220.                 'watch_kernel_debuglog')
  221. -                       require_cmd 'dbgview64' || return 1
  222. +                       check_machine_arch || (( numerr++ ))
  223. +                       case "$(uname -m)" in
  224. +                               'x86_64') require_cmd 'dbgview64' || (( numerr++ )) ;;
  225. +                               'i686')   require_cmd 'dbgview' || (( numerr++ )) ;;
  226. +                               *)
  227. +                                       printf $"%s: Unknown machine type\n" "$0" 1>&2
  228. +                                       (( numerr++ ))
  229. +                                       ;;
  230. +                       esac
  231.                         if ! is_windows_admin_account ; then
  232.                                 printf $"%s: %q requires Windows Adminstator permissions.\n" "$0" "$cmd"
  233. -                               return 1
  234. +                               (( numerr++ ))
  235.                         fi
  236. +                       (( numerr > 0 )) && return 1
  237. +
  238.                         watch_kernel_debuglog
  239.                         return $?
  240.                         ;;
  241.                 'sys_terminal')
  242. -                       require_cmd 'mintty.exe' || return 1
  243. -                       require_cmd 'PsExec.exe' || return 1
  244. +                       check_machine_arch || (( numerr++ ))
  245. +                       require_cmd 'mintty.exe' || (( numerr++ ))
  246. +                       require_cmd 'PsExec.exe' || (( numerr++ ))
  247.                         if ! is_windows_admin_account ; then
  248.                                 printf $"%s: %q requires Windows Adminstator permissions.\n" "$0" "$cmd"
  249. -                               return 1
  250. +                               (( numerr++ ))
  251.                         fi
  252. +                       (( numerr > 0 )) && return 1
  253. +
  254.                         sys_terminal
  255.                         return $?
  256.                         ;;
  257. --
  258. 2.43.0
  259.  
  260. From c1f1f8743ad7626808b518920c5a2fd6545ff483 Mon Sep 17 00:00:00 2001
  261. From: Roland Mainz <roland.mainz@nrubsig.org>
  262. Date: Tue, 21 May 2024 15:26:12 +0200
  263. Subject: [PATCH 2/3] cygwin,tests: Update README+package lists for Win10/32bit
  264.  
  265. Update README+package lists for Win10/32bit
  266.  
  267. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  268. ---
  269.  cygwin/README.bintarball.txt | 12 ++++++++++++
  270.  tests/manual_testing.txt     | 15 +++++++++++++--
  271.  2 files changed, 25 insertions(+), 2 deletions(-)
  272.  
  273. diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
  274. index 5ceb58b..c24ef18 100644
  275. --- a/cygwin/README.bintarball.txt
  276. +++ b/cygwin/README.bintarball.txt
  277. @@ -101,6 +101,7 @@ NFSv4.1 client and filesystem driver for Windows 10/11
  278.          make
  279.          git
  280.          dos2unix
  281. +        unzip
  282.  
  283.  #
  284.  #
  285. @@ -199,6 +200,15 @@ $ /sbin/nfs_mount
  286.  #
  287.  # 8. Notes:
  288.  #
  289. +- Cygwin 32bit can be installed like this:
  290. +---- snip ----
  291. +# Install Cygwin 32bit on Windows 32 with packages required by "ms-nfs41-client"
  292. +# (Windows NFSv4.1 client):
  293. +# 1. Get installer from https://www.cygwin.com/setup-x86.exe
  294. +# 2. Run installer with these arguments:
  295. +setup-x86.exe --allow-unsupported-windows -q --no-verify --site http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/2022/11/23/063457 -P cygwin,cygwin-devel,cygrunsrv,cygutils,cygutils-extra,bash,bzip2,coreutils,getent,gdb,grep,hostname,less,libiconv,libiconv2,pax,pbzip2,procps-ng,sed,tar,time,util-linux,wget,libnfs,make,git,dos2unix,unzip
  296. +---- snip ----
  297. +
  298.  - Idmapping (including uid/gid mapping) between NFSv4 client and
  299.    NFSv4 server works via /lib/msnfs41client/cygwin_idmapper.ksh,
  300.    which either uses builtin static data, or /usr/bin/getent passwd
  301. @@ -331,6 +341,8 @@ $ /sbin/nfs_mount
  302.    c) the EaSize field cannot be reported for directory queries of
  303.    FileBothDirInformation, FileFullDirInfo, or FileIdFullDirInfo.
  304.  
  305. +- Win10/32bit-only: $ net use H: /delete # does not work,
  306. +  use $ nfs_mount -d 'H' instead #
  307.  
  308.  #
  309.  # 10. Notes for troubleshooting && finding bugs/debugging:
  310. diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
  311. index 0359cb9..cade142 100644
  312. --- a/tests/manual_testing.txt
  313. +++ b/tests/manual_testing.txt
  314. @@ -1,5 +1,5 @@
  315.  #
  316. -# ms-nfs41-client manual testing sequence, 2024-02-26
  317. +# ms-nfs41-client manual testing sequence, 2024-05-21
  318.  #
  319.  # Draft version, needs to be turned into automated tests
  320.  # if possible
  321. @@ -9,10 +9,15 @@
  322.  # Notes:
  323.  # - The following Cygwin packages must be installed for running the tests:
  324.  #   ---- snip ----
  325. +#   gcc-core
  326. +#   gcc-g++
  327. +#   clang
  328. +#   gdb
  329.  #   make
  330. -#   git
  331.  #   netpbm
  332. +#   git
  333.  #   subversion
  334. +#   cygport
  335.  #   dos2unix
  336.  #   ncurses-devel
  337.  #   libgmp-devel
  338. @@ -22,6 +27,12 @@
  339.  #   libisl-devel
  340.  #   flex
  341.  #   bison
  342. +#   unzip
  343. +#   pax
  344. +#   tar
  345. +#   konsole
  346. +#   nedit
  347. +#   emacs
  348.  #   ---- snip ----
  349.  #
  350.  # - Benchmarking/profiling should be done with the realtime virus checker
  351. --
  352. 2.43.0
  353.  
  354. From 8f5aff990ff3af38615c0039b9d39e80773aaac4 Mon Sep 17 00:00:00 2001
  355. From: Roland Mainz <roland.mainz@nrubsig.org>
  356. Date: Tue, 21 May 2024 15:31:48 +0200
  357. Subject: [PATCH 3/3] cygwin: Add comment accessing NFSv4.1 filesystem via NAT
  358.  
  359. Add comment to cygwin/README.bintarball.txt about accessing NFSv4.1
  360. filesystems via Network address translation (NAT) - in such
  361. a case the source port will be >= 1024, and most NFSv4.1 servers
  362. will return a |EPERM| (permission error) in such a case.
  363.  
  364. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  365. ---
  366.  cygwin/README.bintarball.txt | 6 +++++-
  367.  1 file changed, 5 insertions(+), 1 deletion(-)
  368.  
  369. diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
  370. index c24ef18..e91340b 100644
  371. --- a/cygwin/README.bintarball.txt
  372. +++ b/cygwin/README.bintarball.txt
  373. @@ -289,9 +289,13 @@ setup-x86.exe --allow-unsupported-windows -q --no-verify --site http://ctm.crouc
  374.    If nfsd.exe/nfsd_debug.exe is started without the Windows priviledge
  375.    to use reserved ports, then a mount attempt can fail.
  376.    This can be worked around on the NFSv4 server side - on Linux using
  377. -  the "insecure" export option in  /etc/exports and on Solaris/Illumos
  378. +  the "insecure" export option in /etc/exports and on Solaris/Illumos
  379.    using export option "resvport" (see nfs(5)).
  380.  
  381. +- Accessing mounts from a VMware/QEMU/VirtualBox VM using NAT requires
  382. +  the the "insecure" export option in /etc/exports and on
  383. +  Solaris/Illumos using export option "resvport" (see nfs(5)), as the
  384. +  NFSv4 client source TCP port will be >= 1024.
  385.  
  386.  #
  387.  # 9. Known issues:
  388. --
  389. 2.43.0

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at