pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for nfs_mount.exe UTF-16LE issue, more tests+cleanup+misc, 2025-02-19
Posted by Anonymous on Wed 19th Feb 2025 15:48
raw | new post

  1. From 0a6bddb64c664dc0cbeb30dc2e3c1f41c342b59c Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 19 Feb 2025 13:03:57 +0100
  4. Subject: [PATCH 1/6] cygwin,mount: nfs_mount.exe should not output UTF-16
  5.  
  6. nfs_mount.exe should not output UTF-16 - this breaks shell scripts
  7. and other applications which want to parse the output.
  8.  
  9. Instead we now use |_setmode(_fileno(stdout), _O_U8TEXT);|, which seems
  10. to work for mount points with Japanse characters.
  11.  
  12. Reported-by: Lionel Cons <lionelcons1972@gmail.com>
  13. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  14. ---
  15. cygwin/utils/mount_sshnfs/mount_sshnfs.ksh | 22 ++++------------------
  16.  mount/mount.c                              | 15 ++++++++++-----
  17.  2 files changed, 14 insertions(+), 23 deletions(-)
  18.  
  19. diff --git a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
  20. index 2426b5f..227f29f 100644
  21. --- a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
  22. +++ b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
  23. @@ -422,7 +422,7 @@ function cmd_mount
  24.  
  25.         # fixme: Need better text layout for $ mount_sshnfs mount --man #
  26.         typeset -r mount_sshnfs_cmdmount_usage=$'+
  27. -       [-?\n@(#)\$Id: mount_sshnfs mount (Roland Mainz) 2025-02-17 \$\n]
  28. +       [-?\n@(#)\$Id: mount_sshnfs mount (Roland Mainz) 2025-02-19 \$\n]
  29.         [-author?Roland Mainz <roland.mainz@nrubsig.org>]
  30.         [+NAME?mount_sshnfs mount - mount NFSv4 filesystem through ssh
  31.                 tunnel]
  32. @@ -692,21 +692,7 @@ function cmd_mount
  33.  
  34.                                 # fixme: we should set LC_ALL=C because below we depend on
  35.                                 # a l10n message
  36. -                               if false ; then
  37. -                                       stdout="${ "${c.msnfsv41_nfsmountcmd}" "${mount_args[@]}" ; (( retval=$? )) ;}"
  38. -                               else
  39. -                                       #
  40. -                                       # FIXME: workaround for Cygwin 3.6 issue that
  41. -                                       # stdout="${ cmd ; }" only reads the first character
  42. -                                       # Observed with ksh93u+m/1.0.10 2024-08-01+Cygwin
  43. -                                       # 3.6.0-0.374.g4dd859d01c22.x86_64
  44. -                                       #
  45. -                                       typeset tmpfilename="$(mktemp '/tmp/mount_sshnfs_XXXXXXXXXX.tmp')"
  46. -
  47. -                                       "${c.msnfsv41_nfsmountcmd}" "${mount_args[@]}" >"${tmpfilename}" ; (( retval=$? ))
  48. -                                       IFS='' read stdout <"${tmpfilename}"
  49. -                                       rm -f -- "${tmpfilename}"
  50. -                               fi
  51. +                               stdout="${ "${c.msnfsv41_nfsmountcmd}" "${mount_args[@]}" ; (( retval=$? )) ;}"
  52.  
  53.                                 cat <<<"$stdout"
  54.  
  55. @@ -807,7 +793,7 @@ function cmd_umount
  56.         typeset mydebug=false # fixme: should be "bool" for ksh93v
  57.         # fixme: Need better text layout for $ mount_sshnfs mount --man #
  58.         typeset -r mount_sshnfs_cmdumount_usage=$'+
  59. -       [-?\n@(#)\$Id: mount_sshnfs umount (Roland Mainz) 2025-02-17 \$\n]
  60. +       [-?\n@(#)\$Id: mount_sshnfs umount (Roland Mainz) 2025-02-19 \$\n]
  61.         [-author?Roland Mainz <roland.mainz@nrubsig.org>]
  62.         [+NAME?mount_sshnfs umount - unmount NFSv4 filesystem mounted
  63.                 via mount_sshnfs mount]
  64. @@ -911,7 +897,7 @@ function main
  65.  
  66.         # fixme: Need better text layout for $ mount_sshnfs --man #
  67.         typeset -r mount_sshnfs_usage=$'+
  68. -       [-?\n@(#)\$Id: mount_sshnfs (Roland Mainz) 2025-02-17 \$\n]
  69. +       [-?\n@(#)\$Id: mount_sshnfs (Roland Mainz) 2025-02-19 \$\n]
  70.         [-author?Roland Mainz <roland.mainz@nrubsig.org>]
  71.         [+NAME?mount_sshnfs - mount/umount NFSv4 filesystem via ssh
  72.                 tunnel]
  73. diff --git a/mount/mount.c b/mount/mount.c
  74. index 2ebf8e5..c3d0487 100644
  75. --- a/mount/mount.c
  76. +++ b/mount/mount.c
  77. @@ -653,14 +653,19 @@ int __cdecl wmain(int argc, wchar_t *argv[])
  78.  
  79.      (void)setlocale(LC_ALL, "");
  80.      /*
  81. -     * |_O_WTEXT| - set streams to wide-char mode so we print
  82. +     * |_O_U8TEXT| - set streams to UTF-8 mode so we print
  83.       * non-ASCII characters like Japanese or Chinese/GB18030
  84.       * correctly.
  85. -     * Note that in CRT/UCRT any attempt to use single-byte
  86. -     * functions like |printf()| will trigger an exception
  87. +     * Notes:
  88. +     * 1. in CRT/UCRT any attempt to use single-byte
  89. +     * functions like |printf()| with |_O_U8TEXT| or |_O_WTEXT|
  90. +     * will trigger an exception
  91. +     * 2. |_O_WTEXT| cannot be used here, because then
  92. +     * stdout will contain UTF-16LE characters, which will break
  93. +     * bash x=$(nfs_mount.exe)
  94.       */
  95. -    (void)_setmode(_fileno(stdout), _O_WTEXT);
  96. -    (void)_setmode(_fileno(stderr), _O_WTEXT);
  97. +    (void)_setmode(_fileno(stdout), _O_U8TEXT);
  98. +    (void)_setmode(_fileno(stderr), _O_U8TEXT);
  99.  
  100.      crtsetdbgflags |= _CRTDBG_ALLOC_MEM_DF;  /* use debug heap */
  101.      crtsetdbgflags |= _CRTDBG_LEAK_CHECK_DF; /* report leaks on exit */
  102. --
  103. 2.45.1
  104.  
  105. From f25f7cd5b523b5e86bfaa9ed54d4cca4106a563d Mon Sep 17 00:00:00 2001
  106. From: Roland Mainz <roland.mainz@nrubsig.org>
  107. Date: Wed, 19 Feb 2025 14:29:42 +0100
  108. Subject: [PATCH 2/6] tests: Add ACL copy/cloning via icacls&xcopy /O tests
  109.  
  110. dd ACL copy/cloning via icacls&xcopy /O tests
  111.  
  112. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  113. ---
  114. tests/manual_testing.txt | 23 +++++++++++++++++++++++
  115.  1 file changed, 23 insertions(+)
  116.  
  117. diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
  118. index 230da79..ea321e2 100644
  119. --- a/tests/manual_testing.txt
  120. +++ b/tests/manual_testing.txt
  121. @@ -302,6 +302,29 @@ or one-liner:
  122.  ksh93 -c 'rm -f test1.txt ; touch test1.txt ; icacls test1.txt /grant:r "cygwingrp1:(WDAC)" /grant:r "cygwingrp2:(WDAC)" /t /c ; getfacl test1.txt | grep -C 20 --colour -E "cygwingrp[12]"'
  123.  -------- snip --------
  124.  
  125. +Same test with xcopy /O (requires SeBackupPrivilege/SeRestorePrivilege):
  126. +-------- snip --------
  127. +# cd to a NFS >= v4.1 filesystem
  128. +# getfact output should contain both "cygwingrp1" and "cygwingrp2"
  129. +ksh93 -c 'rm -f test1.txt subdir1/test1.txt ; touch test1.txt ; icacls test1.txt /grant:r "cygwingrp1:(WDAC)" /grant:r "cygwingrp2:(WDAC)" /t /c ; xcopy /O /I test1.txt "subdir1\\" ; getfacl subdir1/test1.txt | grep -C 20 --colour -E "cygwingrp[12]"'
  130. +-------- snip --------
  131. +
  132. +Same test with icacls /save+/restore (requires SeBackupPrivilege/SeRestorePrivilege):
  133. +-------- snip --------
  134. +# * Test: Copy ACL from "test1.txt" to "test2.txt"
  135. +# * Expected result: getfacl output should contain both "cygwingrp1" and "cygwingrp2"
  136. +# * Description:
  137. +# 1. save ACL data of "test1.txt" to "aclspec.icacls"
  138. +# 2. replace the filename "test1.txt" with "test2.txt" in
  139. +#   "aclspec.icacls" and save the resulting data as
  140. +#   "aclspec2.icacls"
  141. +# 3. use $ icacls . /restore aclspec2.icacls # to set
  142. +#   the ACL on "test2.txt"
  143. +# * Usage:
  144. +#   cd to a NFS >= v4.1 filesystem and execute the one-liner below:
  145. +ksh93 -c 'rm -f test1.txt test2.txt aclspec.icacls aclspec2.icacls ; touch test1.txt ; touch test2.txt ; icacls test1.txt /grant:r "cygwingrp1:(WDAC)" /grant:r "cygwingrp2:(WDAC)" /t /c ; icacls test1.txt /save aclspec.icacls ; iconv -f UTF16LE -t UTF-8 <aclspec.icacls | { IFS="" read fname ; IFS="" read aclstr ; } ; printf "test2.txt\r\n%s\n" "$aclstr" | iconv -f UTF-8 -t UTF16LE >aclspec2.icacls ; icacls . /restore aclspec2.icacls ; getfacl test2.txt | grep -C 20 --colour -E "cygwingrp[12]"'
  146. +-------- snip --------
  147. +
  148.  #
  149.  # Test for "Generic Write" ACL:
  150.  #
  151. --
  152. 2.45.1
  153.  
  154. From f5faffb2feb6ad389b610370dd91f3222a5d2ec3 Mon Sep 17 00:00:00 2001
  155. From: Dan Shelton <dan.f.shelton@gmail.com>
  156. Date: Wed, 19 Feb 2025 14:55:06 +0100
  157. Subject: [PATCH 3/6] daemon,include,mount,sys: Cleanup #ifndef HDR/#define HDR
  158.  1/#endif /* !HDR */ include guards
  159.  
  160. Cleanup #ifndef HDR/#define HDR 1/#endif /* !HDR */ include guards
  161.  
  162. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  163. ---
  164. daemon/daemon_debug.h   | 4 ++--
  165.  daemon/delegation.h     | 4 ++--
  166.  daemon/idmap.h          | 2 +-
  167.  daemon/list.h           | 2 +-
  168.  daemon/name_cache.h     | 2 +-
  169.  daemon/nfs41.h          | 4 ++--
  170.  daemon/nfs41_callback.h | 2 +-
  171.  daemon/nfs41_compound.h | 4 ++--
  172.  daemon/nfs41_const.h    | 2 +-
  173.  daemon/nfs41_ops.h      | 4 +---
  174.  daemon/nfs41_types.h    | 2 +-
  175.  daemon/nfs41_xdr.h      | 2 +-
  176.  daemon/pnfs.h           | 2 +-
  177.  daemon/recovery.h       | 4 ++--
  178.  daemon/service.h        | 4 ++--
  179.  daemon/tree.h           | 4 ++--
  180.  daemon/upcall.h         | 2 +-
  181.  daemon/util.h           | 2 +-
  182.  include/from_kernel.h   | 8 ++++----
  183.  include/nfs41_driver.h  | 3 ++-
  184.  mount/options.h         | 2 +-
  185.  mount/urlparser1.h      | 2 +-
  186.  sys/nfs41sys_driver.h   | 1 +
  187.  sys/wmlkm.h             | 2 +-
  188.  24 files changed, 35 insertions(+), 35 deletions(-)
  189.  
  190. diff --git a/daemon/daemon_debug.h b/daemon/daemon_debug.h
  191. index fd0f7b7..ae609d8 100644
  192. --- a/daemon/daemon_debug.h
  193. +++ b/daemon/daemon_debug.h
  194. @@ -21,7 +21,7 @@
  195.   */
  196.  
  197.  #ifndef _DAEMON_DEBUG_
  198. -#define _DAEMON_DEBUG_
  199. +#define _DAEMON_DEBUG_ 1
  200.  
  201.  #ifdef _DEBUG
  202.  /* use visual studio's debug heap */
  203. @@ -180,4 +180,4 @@ void debug_delayed_free(void *in_ptr);
  204.  typedef struct _FILE_FULL_EA_INFORMATION FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
  205.  void debug_print_ea(PFILE_FULL_EA_INFORMATION ea);
  206.  
  207. -#endif
  208. +#endif /* !_DAEMON_DEBUG_ */
  209. diff --git a/daemon/delegation.h b/daemon/delegation.h
  210. index 517dc32..25235b4 100644
  211. --- a/daemon/delegation.h
  212. +++ b/daemon/delegation.h
  213. @@ -20,7 +20,7 @@
  214.   */
  215.  
  216.  #ifndef DELEGATION_H
  217. -#define DELEGATION_H
  218. +#define DELEGATION_H 1
  219.  
  220.  #include "nfs41.h"
  221.  
  222. @@ -106,4 +106,4 @@ int nfs41_client_delegation_recovery(
  223.  int nfs41_client_delegation_return_lru(
  224.      IN nfs41_client *client);
  225.  
  226. -#endif /* DELEGATION_H */
  227. +#endif /* !DELEGATION_H */
  228. diff --git a/daemon/idmap.h b/daemon/idmap.h
  229. index 4c42496..0e99bed 100644
  230. --- a/daemon/idmap.h
  231. +++ b/daemon/idmap.h
  232. @@ -21,7 +21,7 @@
  233.   */
  234.  
  235.  #ifndef IDMAP_H
  236. -#define IDMAP_H
  237. +#define IDMAP_H 1
  238.  
  239.  #include "nfs41_types.h"
  240.  
  241. diff --git a/daemon/list.h b/daemon/list.h
  242. index 5159b0d..26a4301 100644
  243. --- a/daemon/list.h
  244. +++ b/daemon/list.h
  245. @@ -20,7 +20,7 @@
  246.   */
  247.  
  248.  #ifndef NFS41_LIST_H
  249. -#define NFS41_LIST_H
  250. +#define NFS41_LIST_H 1
  251.  
  252.  
  253.  /* doubly-linked list */
  254. diff --git a/daemon/name_cache.h b/daemon/name_cache.h
  255. index fbea8c5..c224bf8 100644
  256. --- a/daemon/name_cache.h
  257. +++ b/daemon/name_cache.h
  258. @@ -20,7 +20,7 @@
  259.   */
  260.  
  261.  #ifndef __NFS41_DAEMON_NAME_CACHE_H__
  262. -#define __NFS41_DAEMON_NAME_CACHE_H__
  263. +#define __NFS41_DAEMON_NAME_CACHE_H__ 1
  264.  
  265.  #include "nfs41.h"
  266.  
  267. diff --git a/daemon/nfs41.h b/daemon/nfs41.h
  268. index da161b0..65d0e18 100644
  269. --- a/daemon/nfs41.h
  270. +++ b/daemon/nfs41.h
  271. @@ -22,7 +22,7 @@
  272.   */
  273.  
  274.  #ifndef __NFS41__
  275. -#define __NFS41__
  276. +#define __NFS41__ 1
  277.  
  278.  #include <stdbool.h>
  279.  #include "util.h"
  280. @@ -570,4 +570,4 @@ int nfs41_ea_set(
  281.      IN nfs41_open_state *state,
  282.      IN struct _FILE_FULL_EA_INFORMATION *ea);
  283.  
  284. -#endif /* __NFS41__ */
  285. +#endif /* !__NFS41__ */
  286. diff --git a/daemon/nfs41_callback.h b/daemon/nfs41_callback.h
  287. index 0ccd912..2b04955 100644
  288. --- a/daemon/nfs41_callback.h
  289. +++ b/daemon/nfs41_callback.h
  290. @@ -20,7 +20,7 @@
  291.   */
  292.  
  293.  #ifndef __NFS41_CALLBACK_H__
  294. -#define __NFS41_CALLBACK_H__
  295. +#define __NFS41_CALLBACK_H__ 1
  296.  
  297.  #include "wintirpc.h"
  298.  #include "rpc/rpc.h"
  299. diff --git a/daemon/nfs41_compound.h b/daemon/nfs41_compound.h
  300. index b6af292..a4b5495 100644
  301. --- a/daemon/nfs41_compound.h
  302. +++ b/daemon/nfs41_compound.h
  303. @@ -20,7 +20,7 @@
  304.   */
  305.  
  306.  #ifndef __NFS41_DAEMON_COMPOUND_H__
  307. -#define __NFS41_DAEMON_COMPOUND_H__
  308. +#define __NFS41_DAEMON_COMPOUND_H__ 1
  309.  
  310.  #include "nfs41.h"
  311.  
  312. @@ -78,4 +78,4 @@ int compound_encode_send_decode(
  313.      nfs41_compound *compound,
  314.      bool_t try_recovery);
  315.  
  316. -#endif /* __NFS41_DAEMON_COMPOUND_H__ */
  317. +#endif /* !__NFS41_DAEMON_COMPOUND_H__ */
  318. diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
  319. index f36ee6c..0612913 100644
  320. --- a/daemon/nfs41_const.h
  321. +++ b/daemon/nfs41_const.h
  322. @@ -21,7 +21,7 @@
  323.   */
  324.  
  325.  #ifndef __NFS41_NFS_CONST_H__
  326. -#define __NFS41_NFS_CONST_H__
  327. +#define __NFS41_NFS_CONST_H__ 1
  328.  
  329.  
  330.  /*
  331. diff --git a/daemon/nfs41_ops.h b/daemon/nfs41_ops.h
  332. index bdb07a9..efd162b 100644
  333. --- a/daemon/nfs41_ops.h
  334. +++ b/daemon/nfs41_ops.h
  335. @@ -22,7 +22,7 @@
  336.   */
  337.  
  338.  #ifndef __NFS41_NFS_OPS_H__
  339. -#define __NFS41_NFS_OPS_H__
  340. +#define __NFS41_NFS_OPS_H__ 1
  341.  
  342.  #include "nfs41.h"
  343.  #include "pnfs.h"
  344. @@ -810,7 +810,6 @@ typedef struct __nfs42_deallocate_res {
  345.      uint32_t    status;
  346.  } nfs42_deallocate_res;
  347.  
  348. -#if 1
  349.  /* OP_SEEK */
  350.  typedef struct __nfs42_seek_args {
  351.      stateid_arg     *stateid; /* -> nfs41_op_open_res_ok.stateid */
  352. @@ -828,7 +827,6 @@ typedef struct __nfs42_seek_res {
  353.      /* case NFS4_OK: */
  354.      nfs42_seek_res_ok   resok4;
  355.  } nfs42_seek_res;
  356. -#endif
  357.  
  358.  /* OP_READDIR */
  359.  typedef struct __nfs41_readdir_args {
  360. diff --git a/daemon/nfs41_types.h b/daemon/nfs41_types.h
  361. index c08332c..948beea 100644
  362. --- a/daemon/nfs41_types.h
  363. +++ b/daemon/nfs41_types.h
  364. @@ -21,7 +21,7 @@
  365.   */
  366.  
  367.  #ifndef __NFS41_DAEMON_TYPES_H__
  368. -#define __NFS41_DAEMON_TYPES_H__
  369. +#define __NFS41_DAEMON_TYPES_H__ 1
  370.  
  371.  #include "wintirpc.h"
  372.  #include "rpc/xdr.h"
  373. diff --git a/daemon/nfs41_xdr.h b/daemon/nfs41_xdr.h
  374. index d89548c..09cac97 100644
  375. --- a/daemon/nfs41_xdr.h
  376. +++ b/daemon/nfs41_xdr.h
  377. @@ -22,7 +22,7 @@
  378.   */
  379.  
  380.  #ifndef __NFS41_NFS_XDR_H__
  381. -#define __NFS41_NFS_XDR_H__
  382. +#define __NFS41_NFS_XDR_H__ 1
  383.  
  384.  #include "nfs41_types.h"
  385.  #include "nfs41_compound.h"
  386. diff --git a/daemon/pnfs.h b/daemon/pnfs.h
  387. index a63fac0..30f00ec 100644
  388. --- a/daemon/pnfs.h
  389. +++ b/daemon/pnfs.h
  390. @@ -20,7 +20,7 @@
  391.   */
  392.  
  393.  #ifndef __PNFS_H__
  394. -#define __PNFS_H__
  395. +#define __PNFS_H__ 1
  396.  
  397.  #include "nfs41_types.h"
  398.  #include "list.h"
  399. diff --git a/daemon/recovery.h b/daemon/recovery.h
  400. index b16044e..006a08f 100644
  401. --- a/daemon/recovery.h
  402. +++ b/daemon/recovery.h
  403. @@ -20,7 +20,7 @@
  404.   */
  405.  
  406.  #ifndef RECOVERY_H
  407. -#define RECOVERY_H
  408. +#define RECOVERY_H 1
  409.  
  410.  #include "nfs41.h"
  411.  
  412. @@ -56,4 +56,4 @@ bool_t nfs41_recover_stateid(
  413.      IN nfs41_session *session,
  414.      IN struct __nfs_argop4 *argop);
  415.  
  416. -#endif /* RECOVERY_H */
  417. +#endif /* !RECOVERY_H */
  418. diff --git a/daemon/service.h b/daemon/service.h
  419. index 2fa3a7b..dab82df 100644
  420. --- a/daemon/service.h
  421. +++ b/daemon/service.h
  422. @@ -50,7 +50,7 @@ Copyright (C) Microsoft Corporation.  All rights reserved.
  423.  ------------------------------------------------------------------------------*/
  424.  
  425.  #ifndef _SERVICE_H
  426. -#define _SERVICE_H
  427. +#define _SERVICE_H 1
  428.  
  429.  
  430.  #ifdef __cplusplus
  431. @@ -134,4 +134,4 @@ extern "C" {
  432.  }
  433.  #endif
  434.  
  435. -#endif
  436. +#endif /* !_SERVICE_H */
  437. diff --git a/daemon/tree.h b/daemon/tree.h
  438. index 2cd61a2..1083117 100644
  439. --- a/daemon/tree.h
  440. +++ b/daemon/tree.h
  441. @@ -28,7 +28,7 @@
  442.   */
  443.  
  444.  #ifndef        _SYS_TREE_H_
  445. -#define        _SYS_TREE_H_
  446. +#define        _SYS_TREE_H_ 1
  447.  
  448.  //#include <sys/cdefs.h>
  449.  
  450. @@ -762,4 +762,4 @@ name##_RB_MINMAX(struct name *head, int val)                                \
  451.             ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);    \
  452.              (x) = (y))
  453.  
  454. -#endif /* _SYS_TREE_H_ */
  455. +#endif /* !_SYS_TREE_H_ */
  456. diff --git a/daemon/upcall.h b/daemon/upcall.h
  457. index 94f830c..abf53ad 100644
  458. --- a/daemon/upcall.h
  459. +++ b/daemon/upcall.h
  460. @@ -22,7 +22,7 @@
  461.   */
  462.  
  463.  #ifndef __NFS41_DAEMON_UPCALL_H__
  464. -#define __NFS41_DAEMON_UPCALL_H__
  465. +#define __NFS41_DAEMON_UPCALL_H__ 1
  466.  
  467.  #include "nfs41_build_features.h"
  468.  #include "nfs41_ops.h"
  469. diff --git a/daemon/util.h b/daemon/util.h
  470. index 45e1b68..03f6ca4 100644
  471. --- a/daemon/util.h
  472. +++ b/daemon/util.h
  473. @@ -22,7 +22,7 @@
  474.   */
  475.  
  476.  #ifndef __NFS41_DAEMON_UTIL_H__
  477. -#define __NFS41_DAEMON_UTIL_H__
  478. +#define __NFS41_DAEMON_UTIL_H__ 1
  479.  
  480.  #include <stdlib.h>
  481.  #include <stdbool.h>
  482. diff --git a/include/from_kernel.h b/include/from_kernel.h
  483. index 7a9c47a..962ceef 100644
  484. --- a/include/from_kernel.h
  485. +++ b/include/from_kernel.h
  486. @@ -21,8 +21,8 @@
  487.   * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  488.   */
  489.  
  490. -#ifndef _NFS41_DAEMON_
  491. -#define _NFS41_DAEMON_
  492. +#ifndef _NFS41_FROM_KERNEL_
  493. +#define _NFS41_FROM_KERNEL_ 1
  494.  
  495.  #define FILE_DIRECTORY_FILE                     0x00000001
  496.  #define FILE_WRITE_THROUGH                      0x00000002
  497. @@ -450,7 +450,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
  498.      LARGE_INTEGER FileOffset;
  499.      LARGE_INTEGER Length;
  500.  } FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER;
  501. -#endif /* _WINIOCTL_ */
  502. +#endif /* !_WINIOCTL_ */
  503.  
  504.  /*
  505.   * |FILE_ZERO_DATA_INFORMATION| - test for
  506. @@ -464,4 +464,4 @@ typedef struct _FILE_ZERO_DATA_INFORMATION {
  507.  } FILE_ZERO_DATA_INFORMATION, *PFILE_ZERO_DATA_INFORMATION;
  508.  #endif /* !_WINIOCTL_ */
  509.  
  510. -#endif
  511. +#endif /* !_NFS41_FROM_KERNEL_ */
  512. diff --git a/include/nfs41_driver.h b/include/nfs41_driver.h
  513. index 37b3141..6dce9d9 100644
  514. --- a/include/nfs41_driver.h
  515. +++ b/include/nfs41_driver.h
  516. @@ -137,4 +137,5 @@ typedef enum _nfs41_start_driver_state {
  517.   */
  518.  #define ERROR_NFS_VERSION_MISMATCH ERROR_REMOTE_FILE_VERSION_MISMATCH
  519.  #define STATUS_NFS_VERSION_MISMATCH STATUS_REMOTE_FILE_VERSION_MISMATCH
  520. -#endif
  521. +
  522. +#endif /* !_NFS41_DRIVER_ */
  523. diff --git a/mount/options.h b/mount/options.h
  524. index 0f2cc5f..88b117d 100644
  525. --- a/mount/options.h
  526. +++ b/mount/options.h
  527. @@ -21,7 +21,7 @@
  528.   */
  529.  
  530.  #ifndef __NFS41_MOUNT_OPTIONS_H__
  531. -#define __NFS41_MOUNT_OPTIONS_H__
  532. +#define __NFS41_MOUNT_OPTIONS_H__ 1
  533.  
  534.  
  535.  #define MOUNT_OPTION_BUFFER_SECRET ('n4')
  536. diff --git a/mount/urlparser1.h b/mount/urlparser1.h
  537. index 451f28c..c6f7cc9 100644
  538. --- a/mount/urlparser1.h
  539. +++ b/mount/urlparser1.h
  540. @@ -25,7 +25,7 @@
  541.  /* urlparser1.h - header for simple URL parser */
  542.  
  543.  #ifndef __URLPARSER1_H__
  544. -#define __URLPARSER1_H__
  545. +#define __URLPARSER1_H__ 1
  546.  
  547.  #include <stdlib.h>
  548.  
  549. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  550. index f14d33d..65884ca 100644
  551. --- a/sys/nfs41sys_driver.h
  552. +++ b/sys/nfs41sys_driver.h
  553. @@ -28,6 +28,7 @@
  554.  #if ((__STDC_VERSION__-0) < 201710L)
  555.  #error Code requires ISO C17
  556.  #endif
  557. +
  558.  #ifndef _NFS41SYS_DRIVER_H_
  559.  #define _NFS41SYS_DRIVER_H_ 1
  560.  
  561. diff --git a/sys/wmlkm.h b/sys/wmlkm.h
  562. index cb42710..d279414 100644
  563. --- a/sys/wmlkm.h
  564. +++ b/sys/wmlkm.h
  565. @@ -45,5 +45,5 @@ WmlTrace(
  566.  };
  567.  #endif
  568.  
  569. -#endif // NFS41_WMLKM_H
  570. +#endif /* !NFS41_WMLKM_H */
  571.  
  572. --
  573. 2.45.1
  574.  
  575. From bc3c6ef7c85c7cfb3fcdfbb2832f8953857e9e05 Mon Sep 17 00:00:00 2001
  576. From: Dan Shelton <dan.f.shelton@gmail.com>
  577. Date: Wed, 19 Feb 2025 14:59:39 +0100
  578. Subject: [PATCH 4/6] libtirpc: Fix typo in "cb: possible deadlock" warning
  579.  
  580. Fix typo in "cb: possible deadlock" warning
  581.  
  582. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  583. ---
  584. libtirpc/src/clnt_vc.c | 2 +-
  585.  1 file changed, 1 insertion(+), 1 deletion(-)
  586.  
  587. diff --git a/libtirpc/src/clnt_vc.c b/libtirpc/src/clnt_vc.c
  588. index 70f3c15..ce431ce 100644
  589. --- a/libtirpc/src/clnt_vc.c
  590. +++ b/libtirpc/src/clnt_vc.c
  591. @@ -259,7 +259,7 @@ loop_restart:
  592.                  if (cond_wait_timed_fails++ > 2) {
  593.                      mutex_unlock(&clnt_fd_lock);
  594.                      (void)fprintf(stdout,
  595. -                        "%04lx: cb: possible deadlockm, lasterr=%d\n",
  596. +                        "%04lx: cb: possible deadlock, lasterr=%d\n",
  597.                          (long)GetCurrentThreadId(), (int)lasterr);
  598.                      goto loop_restart;
  599.                  }
  600. --
  601. 2.45.1
  602.  
  603. From c57463d38c2ce1e81e62494e90723e3d32ac3f47 Mon Sep 17 00:00:00 2001
  604. From: Roland Mainz <roland.mainz@nrubsig.org>
  605. Date: Wed, 19 Feb 2025 16:32:40 +0100
  606. Subject: [PATCH 5/6] tests: testsparsefile1.ksh should work on C: drive too
  607.  
  608. testsparsefile1.ksh should work on C: drive too
  609.  
  610. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  611. ---
  612. tests/sparsefiles/testsparsefile1.ksh | 11 ++++++++---
  613.  1 file changed, 8 insertions(+), 3 deletions(-)
  614.  
  615. diff --git a/tests/sparsefiles/testsparsefile1.ksh b/tests/sparsefiles/testsparsefile1.ksh
  616. index fa0eef5..0d9d015 100644
  617. --- a/tests/sparsefiles/testsparsefile1.ksh
  618. +++ b/tests/sparsefiles/testsparsefile1.ksh
  619. @@ -38,7 +38,8 @@ function test_sparse_holeonly
  620.      #set -o xtrace
  621.  
  622.      rm -f 'sparse_file_hole_only'
  623. -    dd if='/dev/null' of='sparse_file_hole_only' bs=1 count=1 seek=$((65536*1024))
  624. +    dd if='/dev/null' of='sparse_file_hole_only' bs=1 count=0 seek=$((65536*1024))
  625. +    chattr -V +S 'sparse_file_hole_only'
  626.  
  627.      ls -l 'sparse_file_hole_only'
  628.      /cygdrive/c/Windows/system32/fsutil sparse queryrange 'sparse_file_hole_only'
  629. @@ -70,6 +71,7 @@ function test_normal_file
  630.  
  631.      rm -f 'test_normal_file'
  632.      dd if='/dev/zero' of='test_normal_file' bs=1024 count=1024
  633. +    chattr -V +S 'test_normal_file'
  634.  
  635.      ls -l 'test_normal_file'
  636.      /cygdrive/c/Windows/system32/fsutil sparse queryrange 'test_normal_file'
  637. @@ -124,6 +126,7 @@ function test_multihole_sparsefile1
  638.      #
  639.      rm -f 'mysparsefile'
  640.      printf '' >'mysparsefile' # trunc
  641. +    chattr -V +S 'mysparsefile'
  642.  
  643.      for i in ${!c.filecontent[@]} ; do
  644.          dd of='mysparsefile' bs=1 conv=notrunc seek=${c.filecontent[$i].pos} status=none <<<"${c.filecontent[$i].data}"
  645. @@ -180,13 +183,15 @@ function test_sparse_punchhole1
  646.      #set -o xtrace
  647.  
  648.      rm -f 'sparse_file_punchhole'
  649. -    dd if='/dev/zero' of='sparse_file_punchhole' count=8 bs=$((1024*1024)) status=none
  650. +    touch 'sparse_file_punchhole'
  651.      chattr -V +S 'sparse_file_punchhole'
  652.  
  653. +    dd if='/dev/zero' of='sparse_file_punchhole' conv=notrunc count=32 bs=$((1024*1024)) status=none
  654. +
  655.      printf '# expected: one data section before fallocate\n'
  656.      /cygdrive/c/Windows/system32/fsutil sparse queryrange 'sparse_file_punchhole'
  657.  
  658. -    fallocate -n -p -o $((0x16000)) -l $((0x8000)) 'sparse_file_punchhole'
  659. +    fallocate -n -p -o $((8*1024*1024)) -l $((4*1024*1024)) 'sparse_file_punchhole'
  660.  
  661.      printf '# expected: two data section after fallocate\n'
  662.      /cygdrive/c/Windows/system32/fsutil sparse queryrange 'sparse_file_punchhole'
  663. --
  664. 2.45.1
  665.  
  666. From c4c604a02a2729f88c8f4bd315ea72f49ea3a6f1 Mon Sep 17 00:00:00 2001
  667. From: Roland Mainz <roland.mainz@nrubsig.org>
  668. Date: Wed, 19 Feb 2025 16:39:09 +0100
  669. Subject: [PATCH 6/6] tests: testsparsefile1.ksh: Add test for
  670.  /usr/bin/truncate
  671.  
  672. testsparsefile1.ksh: Add test for /usr/bin/truncate
  673.  
  674. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  675. ---
  676. tests/sparsefiles/testsparsefile1.ksh | 41 +++++++++++++++++++++++++--
  677.  1 file changed, 38 insertions(+), 3 deletions(-)
  678.  
  679. diff --git a/tests/sparsefiles/testsparsefile1.ksh b/tests/sparsefiles/testsparsefile1.ksh
  680. index 0d9d015..293ade9 100644
  681. --- a/tests/sparsefiles/testsparsefile1.ksh
  682. +++ b/tests/sparsefiles/testsparsefile1.ksh
  683. @@ -31,14 +31,14 @@
  684.  #
  685.  
  686.  
  687. -function test_sparse_holeonly
  688. +function test_sparse_holeonly_dd
  689.  {
  690.      set -o errexit
  691.      set -o nounset
  692.      #set -o xtrace
  693.  
  694.      rm -f 'sparse_file_hole_only'
  695. -    dd if='/dev/null' of='sparse_file_hole_only' bs=1 count=0 seek=$((65536*1024))
  696. +    dd if='/dev/null' of='sparse_file_hole_only' bs=1 count=0 seek=$((256*1024*1024))
  697.      chattr -V +S 'sparse_file_hole_only'
  698.  
  699.      ls -l 'sparse_file_hole_only'
  700. @@ -63,6 +63,40 @@ function test_sparse_holeonly
  701.      return 0
  702.  }
  703.  
  704. +function test_sparse_holeonly_truncate
  705. +{
  706. +    set -o errexit
  707. +    set -o nounset
  708. +    #set -o xtrace
  709. +
  710. +    rm -f 'sparse_file_hole_only'
  711. +    touch 'sparse_file_hole_only'
  712. +    chattr -V +S 'sparse_file_hole_only'
  713. +
  714. +    truncate -s $((256*1024*1024)) 'sparse_file_hole_only'
  715. +
  716. +    ls -l 'sparse_file_hole_only'
  717. +    /cygdrive/c/Windows/system32/fsutil sparse queryrange 'sparse_file_hole_only'
  718. +
  719. +    integer fsutil_num_data_sections="$(/cygdrive/c/Windows/system32/fsutil sparse queryrange 'sparse_file_hole_only' | wc -l)"
  720. +
  721. +    #
  722. +    # test whether the file is OK
  723. +    #
  724. +    if (( fsutil_num_data_sections != 0 )) ; then
  725. +        printf "# TEST failed, found %d data sections, expceted %d\n" \
  726. +            fsutil_num_data_sections \
  727. +            0
  728. +        return 1
  729. +    fi
  730. +
  731. +    printf "\n#\n# TEST %q OK, found %d data sections\n#\n" \
  732. +        "$0" \
  733. +        fsutil_num_data_sections
  734. +
  735. +    return 0
  736. +}
  737. +
  738.  function test_normal_file
  739.  {
  740.      set -o errexit
  741. @@ -228,7 +262,8 @@ builtin basename
  742.  builtin rm
  743.  builtin wc
  744.  
  745. -test_sparse_holeonly
  746. +test_sparse_holeonly_dd
  747. +test_sparse_holeonly_truncate
  748.  test_normal_file
  749.  
  750.  test_multihole_sparsefile1 1024 0 4  false
  751. --
  752. 2.45.1

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