pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for clang/ReactOS, cleanup, tests+ misc, 2026-01-15
Posted by Anonymous on Thu 15th Jan 2026 17:56
raw | new post

  1. From d7b0ba827842b4b47e1b565e4310760ab83dc581 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Thu, 15 Jan 2026 16:43:27 +0100
  4. Subject: [PATCH 1/5] tests: Add ReactOS build via RosBE to manual tests
  5.  
  6. Add ReactOS build via RosBE to manual tests.
  7.  
  8. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  9. ---
  10. tests/manual_testing.txt | 31 ++++++++++++++++++++++++++++++-
  11.  1 file changed, 30 insertions(+), 1 deletion(-)
  12.  
  13. diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
  14. index f12d057..7e44ca7 100644
  15. --- a/tests/manual_testing.txt
  16. +++ b/tests/manual_testing.txt
  17. @@ -1,5 +1,5 @@
  18.  #
  19. -# ms-nfs41-client manual testing sequence, 2026-01-03
  20. +# ms-nfs41-client manual testing sequence, 2026-01-15
  21.  #
  22.  # Draft version, needs to be turned into automated tests
  23.  # if possible
  24. @@ -1211,5 +1211,34 @@ filedisk /umount U:
  25.  lssparse /cygdrive/n/winntfs_filedisk_001.img
  26.  rm /cygdrive/n/winntfs_filedisk_001.img
  27.  
  28. +
  29. +#
  30. +# Build ReactOS
  31. +# (free Windows NT clone)
  32. +#
  33. +
  34. +#### Setup:
  35. +- Mount case-insensitive filesystem
  36. +- Install RosBE (ReactOS Build Environment)
  37. +$ curl --remote-name 'https://downloads.sourceforge.net/reactos/RosBE-2.2.1.exe'
  38. +$ chmod a+x RosBE-2.2.1.exe
  39. +$ ./RosBE-2.2.1.exe
  40. +
  41. +#### Build ReactOS/i386 (green terminal, $ cmd.exe /t:0B /k "C:\RosBE\RosBE.cmd" #):
  42. +<inside RosBE command prompt>
  43. +git clone https://github.com/reactos/reactos
  44. +cd reactos
  45. +configure.cmd
  46. +cd output-MinGW-i386
  47. +ninja bootcd livecd
  48. +
  49. +#### Build ReactOS/AMD64 (blue terminal, $ cmd.exe /t:0B /k "C:\RosBE\RosBE.cmd" amd64 #):
  50. +<inside RosBE command prompt>
  51. +git clone https://github.com/reactos/reactos
  52. +cd reactos
  53. +configure.cmd -DARCH=amd64
  54. +cd output-MinGW-amd64
  55. +ninja bootcd livecd
  56. +
  57.  #
  58.  # EOF.
  59. --
  60. 2.51.0
  61.  
  62. From 3016e29c0368a67fbeb94c8b309d9811ceeff60a Mon Sep 17 00:00:00 2001
  63. From: Dan Shelton <dan.f.shelton@gmail.com>
  64. Date: Thu, 15 Jan 2026 17:30:12 +0100
  65. Subject: [PATCH 2/5] libtirpc: Fix clang printf()-style format warnings
  66.  
  67. Fix clang printf()-style format warnings.
  68.  
  69. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  70. ---
  71. libtirpc/src/auth_sspi.c | 6 ++++--
  72.  libtirpc/src/clnt_vc.c   | 9 +++++----
  73.  libtirpc/src/wintirpc.c  | 6 ++++--
  74.  3 files changed, 13 insertions(+), 8 deletions(-)
  75.  
  76. diff --git a/libtirpc/src/auth_sspi.c b/libtirpc/src/auth_sspi.c
  77. index 4e82183..bc15ca2 100644
  78. --- a/libtirpc/src/auth_sspi.c
  79. +++ b/libtirpc/src/auth_sspi.c
  80. @@ -929,7 +929,8 @@ void log_hexdump(bool_t on, const char *title, const u_char *buf,
  81.  
  82.      if (!on) return;
  83.  
  84. -       fprintf(fd_out, "%04x: %s (len=%d)\n", GetCurrentThreadId(), title, len);
  85. +       fprintf(fd_out, "%04lx: %s (len=%d)\n",
  86. +               (unsigned long)GetCurrentThreadId(), title, len);
  87.         for (i = 0; i < len; i += 0x10) {
  88.                 fprintf(fd_out, "  %04x: ", (u_int)(i + offset));
  89.                 jm = len - i;
  90. @@ -962,7 +963,8 @@ void log_debug(const char *fmt, ...)
  91.         va_list ap;
  92.  
  93.         va_start(ap, fmt);
  94. -       fprintf(fd_out, "%04x: rpcsec_gss: ", GetCurrentThreadId());
  95. +       fprintf(fd_out, "%04lx: rpcsec_gss: ",
  96. +               (unsigned long)GetCurrentThreadId());
  97.         vfprintf(fd_out, fmt, ap);
  98.         fprintf(fd_out, "\n");
  99.      fflush(fd_out);
  100. diff --git a/libtirpc/src/clnt_vc.c b/libtirpc/src/clnt_vc.c
  101. index fc22b3a..aabb8b4 100644
  102. --- a/libtirpc/src/clnt_vc.c
  103. +++ b/libtirpc/src/clnt_vc.c
  104. @@ -216,7 +216,7 @@ static const char __no_mem_str[] = "out of memory";
  105.                 (void)fprintf(stderr, \
  106.                         "#### FATAL: exception in " \
  107.                         "thr=%04lx'%s'/%ld ####\n", \
  108. -                       (long)GetCurrentThreadId(), \
  109. +                       (unsigned long)GetCurrentThreadId(), \
  110.                         __FILE__, (long)__LINE__); }
  111.  #else
  112.  #define TIRPCDbgEnter()
  113. @@ -238,7 +238,8 @@ static unsigned int WINAPI clnt_cb_thread(void *args)
  114.      char cred_area[2 * MAX_AUTH_BYTES + RQCRED_SIZE];
  115.  
  116.      (void)fprintf(stderr/*stdout*/,
  117. -        "%04lx: cb: Callback thread running\n", (long)GetCurrentThreadId());
  118. +        "%04lx: cb: Callback thread running\n",
  119. +        (unsigned long)GetCurrentThreadId());
  120.  
  121.  #ifdef DEBUG_TIRPC_CB_DEADLOCKS
  122.      int cond_wait_timed_fails;
  123. @@ -550,9 +551,9 @@ clnt_vc_create(
  124.          cl->cb_thread = (HANDLE)_beginthreadex(NULL,
  125.              0, clnt_cb_thread, cl, 0, NULL);
  126.          if (cl->cb_thread == INVALID_HANDLE_VALUE) {
  127. -            (void)fprintf(stderr, "%04lx: _beginthreadex() failed %d\n",
  128. +            (void)fprintf(stderr, "%04lx: _beginthreadex() failed, lasterr=%d\n",
  129.                  (long)GetCurrentThreadId(),
  130. -                GetLastError());
  131. +                (int)GetLastError());
  132.              goto err;
  133.          } else
  134.              fprintf(stdout, "%04lx: started the callback thread %04lx\n",
  135. diff --git a/libtirpc/src/wintirpc.c b/libtirpc/src/wintirpc.c
  136. index 71132c7..29e092b 100644
  137. --- a/libtirpc/src/wintirpc.c
  138. +++ b/libtirpc/src/wintirpc.c
  139. @@ -519,7 +519,8 @@ void wintirpc_syslog(int prio, const char *format, ...)
  140.                 default:                prio_s = "UNKNOWN_ERROR"; break;
  141.         }
  142.  
  143. -       (void)fprintf(stderr, "%04x: %s: ", GetCurrentThreadId(), prio_s);
  144. +       (void)fprintf(stderr, "%04lx: %s: ",
  145. +               (unsigned long)GetCurrentThreadId(), prio_s);
  146.         (void)vfprintf(stderr, format, args);
  147.         (void)fputc('\n', stderr);
  148.         (void)fflush(stderr);
  149. @@ -531,7 +532,8 @@ void wintirpc_warnx(const char *format, ...)
  150.  {
  151.      va_list args;
  152.      va_start(args, format);
  153. -    (void)fprintf(stderr, "%04x: ", GetCurrentThreadId());
  154. +    (void)fprintf(stderr, "%04lx: ",
  155. +       (unsigned long)GetCurrentThreadId());
  156.      (void)vfprintf(stderr, format, args);
  157.      (void)fflush(stderr);
  158.      va_end(args);
  159. --
  160. 2.51.0
  161.  
  162. From 01c62bbf71911ceff248c7268538e6bb89025ebe Mon Sep 17 00:00:00 2001
  163. From: Dan Shelton <dan.f.shelton@gmail.com>
  164. Date: Thu, 15 Jan 2026 17:47:29 +0100
  165. Subject: [PATCH 3/5] daemon: Fix clang
  166.  -Wincompatible-pointer-types-discards-qualifiers warning in streams code
  167.  
  168. Fix clang warning "daemon\winstreams.c(533,9): warning : passing
  169. 'FILE_STREAM_INFORMATION *restrict *restrict' (aka 'struct
  170. _FILE_STREAM_INFORMATION *restrict *restrict') to parameter of type
  171. 'PFILE_STREAM_INFORMATION *' (aka 'struct _FILE_STREAM_INFORMATION **')"
  172. discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers].
  173.  
  174. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  175. ---
  176. daemon/winstreams.c | 6 +++---
  177.  daemon/winstreams.h | 3 ++-
  178.  2 files changed, 5 insertions(+), 4 deletions(-)
  179.  
  180. diff --git a/daemon/winstreams.c b/daemon/winstreams.c
  181. index 1d42f6e..df620e5 100644
  182. --- a/daemon/winstreams.c
  183. +++ b/daemon/winstreams.c
  184. @@ -299,7 +299,7 @@ void populate_stream_list(
  185.      stream->NextEntryOffset =
  186.          ALIGNED_STREAMINFOSIZE(stream->StreamNameLength);
  187.      last_win_stream = stream;
  188. -    stream = (PFILE_STREAM_INFORMATION)STREAMINFO_NEXT_ENTRY(stream);
  189. +    stream = STREAMINFO_NEXT_ENTRY(stream);
  190.  
  191.      /*
  192.       * Enumerate streams
  193. @@ -375,7 +375,7 @@ next_readdir_entry:
  194.          if (is_win_stream) {
  195.              stream->NextEntryOffset =
  196.                  ALIGNED_STREAMINFOSIZE(stream->StreamNameLength);
  197. -            stream = (PFILE_STREAM_INFORMATION)STREAMINFO_NEXT_ENTRY(stream);
  198. +            stream = STREAMINFO_NEXT_ENTRY(stream);
  199.          }
  200.  
  201.          position += entry->next_entry_offset;
  202. @@ -387,7 +387,7 @@ int get_stream_list(
  203.      IN OUT nfs41_open_state *state,
  204.      IN nfs41_path_fh *streamfile,
  205.      IN const nfs41_file_info *basefile_info,
  206. -    OUT PFILE_STREAM_INFORMATION *restrict streamlist_out,
  207. +    OUT FILE_STREAM_INFORMATION *restrict *restrict streamlist_out,
  208.      OUT ULONG *streamlist_out_size)
  209.  {
  210.      unsigned char *entry_list;
  211. diff --git a/daemon/winstreams.h b/daemon/winstreams.h
  212. index c7a021c..3f9a117 100644
  213. --- a/daemon/winstreams.h
  214. +++ b/daemon/winstreams.h
  215. @@ -28,7 +28,8 @@
  216.  #include "nfs41_types.h"
  217.  #include "from_kernel.h"
  218.  
  219. -#define STREAMINFO_NEXT_ENTRY(str) ((PBYTE)(str) + (str)->NextEntryOffset)
  220. +#define STREAMINFO_NEXT_ENTRY(str) \
  221. +    ((PFILE_STREAM_INFORMATION)((PBYTE)(str) + (str)->NextEntryOffset))
  222.  
  223.  static __inline
  224.  bool is_stream_path(const nfs41_abs_path *restrict path)
  225. --
  226. 2.51.0
  227.  
  228. From 1c9fa138e8a1a21f2bf97292aaa0a40137def292 Mon Sep 17 00:00:00 2001
  229. From: Dan Shelton <dan.f.shelton@gmail.com>
  230. Date: Thu, 15 Jan 2026 17:52:10 +0100
  231. Subject: [PATCH 4/5] daemon: Fix clang warning "warning : '&&' within '||'
  232.  [-Wlogical-op-parentheses]" in parse_fs_location_server_address()
  233.  
  234. Fix clang warning "warning : '&&' within '||' [-Wlogical-op-parentheses]" in
  235. parse_fs_location_server_address().
  236.  
  237. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  238. ---
  239. daemon/util.c | 2 +-
  240.  1 file changed, 1 insertion(+), 1 deletion(-)
  241.  
  242. diff --git a/daemon/util.c b/daemon/util.c
  243. index 7029bb6..c12115c 100644
  244. --- a/daemon/util.c
  245. +++ b/daemon/util.c
  246. @@ -772,7 +772,7 @@ int parse_fs_location_server_address(IN const char *restrict inaddr,
  247.      int colon_count = count_chars(inaddr, ':');
  248.  
  249.      if (((dot_count == 5) && (colon_count == 0)) ||
  250. -        (colon_count == 7) && (dot_count == 2)) {
  251. +        ((colon_count == 7) && (dot_count == 2))) {
  252.          int num1, num2;
  253.          const char *begin_dot = NULL;
  254.          if (parse_last_two_numbers(inaddr, &begin_dot, &num1, &num2)) {
  255. --
  256. 2.51.0
  257.  
  258. From 2b9d2dd8521ac3e72ee599efc9d2d02a4c64c737 Mon Sep 17 00:00:00 2001
  259. From: Roland Mainz <roland.mainz@nrubsig.org>
  260. Date: Thu, 15 Jan 2026 18:39:14 +0100
  261. Subject: [PATCH 5/5] daemon,sys,tests: Add #error statements for unsupported
  262.  compilers
  263.  
  264. Add #error statements for unsupported compilers.
  265.  
  266. Reported-by: Dan Shelton <dan.f.shelton@gmail.com>
  267. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  268. ---
  269. daemon/sid.h                 | 12 +++++++-----
  270.  sys/nfs41sys_driver.h        | 12 ++++++++----
  271.  sys/nfs41sys_openclose.c     | 10 +++++++---
  272.  tests/winfsinfo1/winfsinfo.c | 10 +++++++---
  273.  tests/winsg/winsg.c          | 12 +++++++-----
  274.  5 files changed, 36 insertions(+), 20 deletions(-)
  275.  
  276. diff --git a/daemon/sid.h b/daemon/sid.h
  277. index e6f2be8..02942c5 100644
  278. --- a/daemon/sid.h
  279. +++ b/daemon/sid.h
  280. @@ -1,7 +1,7 @@
  281.  
  282.  /* NFSv4.1 client for Windows
  283.   * Copyright (C) 2012 The Regents of the University of Michigan
  284. - * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  285. + * Copyright (C) 2023-2026 Roland Mainz <roland.mainz@nrubsig.org>
  286.   *
  287.   * Olga Kornievskaia <aglo@umich.edu>
  288.   * Casey Bodley <cbodley@umich.edu>
  289. @@ -48,20 +48,22 @@ extern sidcache group_sidcache;
  290.  
  291.  
  292.  /*
  293. - * DECLARE_SID_BUFFER - declare a buffer for a SID value
  294. + * |DECLARE_SID_BUFFER| - declare a buffer for a SID value
  295.   * Note that buffers with SID values must be 16byte aligned
  296.   * on Windows 10/32bit, othewise the kernel might return
  297.   * |ERROR_NOACCESS|(=998) - "Invalid access to memory location".
  298.   */
  299. -#ifdef _MSC_BUILD
  300. +#if defined(_MSC_BUILD)
  301.  /* Visual Studio */
  302.  #define DECLARE_SID_BUFFER(varname) \
  303.      __declspec(align(16)) char (varname)[MAX_SID_BUFFER_SIZE]
  304. -#else
  305. +#elif defined(__clang__)
  306.  /* clang */
  307.  #define DECLARE_SID_BUFFER(varname) \
  308.      char (varname)[MAX_SID_BUFFER_SIZE] __attribute__((aligned(16)))
  309. -#endif /* _MSC_BUILD */
  310. +#else
  311. +#error Compiler not supported yet
  312. +#endif /* |_MSC_BUILD| */
  313.  
  314.  
  315.  /* prototypes */
  316. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  317. index 6eb05d1..670285c 100644
  318. --- a/sys/nfs41sys_driver.h
  319. +++ b/sys/nfs41sys_driver.h
  320. @@ -1,6 +1,6 @@
  321.  /* NFSv4.1 client for Windows
  322.   * Copyright (C) 2012 The Regents of the University of Michigan
  323. - * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  324. + * Copyright (C) 2023-2026 Roland Mainz <roland.mainz@nrubsig.org>
  325.   *
  326.   * Olga Kornievskaia <aglo@umich.edu>
  327.   * Casey Bodley <cbodley@umich.edu>
  328. @@ -513,11 +513,15 @@ typedef struct _NFS41_SRV_OPEN {
  329.       * |open_pg_sidbuff| - Note that buffers with SID values must be 16byte
  330.       * aligned on Windows 10/32bit
  331.       */
  332. -#ifdef _MSC_BUILD
  333. +#if defined(_MSC_BUILD)
  334. +    /* Visual Studio */
  335.      __declspec(align(16)) char open_pg_sidbuff[MAX_SID_BUFFER_SIZE];
  336. -#else
  337. +#elif defined(__clang__)
  338. +    /* clang */
  339.      char open_pg_sidbuff[MAX_SID_BUFFER_SIZE] __attribute__((aligned(16)));
  340. -#endif /* _MSC_BUILD */
  341. +#else
  342. +#error Compiler not supported yet
  343. +#endif /* |_MSC_BUILD| */
  344.  
  345.      /* |open_pg_sid| - PrimaryGroup SID used for opening this NFS handle */
  346.      PSID            open_pg_sid;
  347. diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
  348. index d25d719..f1db990 100644
  349. --- a/sys/nfs41sys_openclose.c
  350. +++ b/sys/nfs41sys_openclose.c
  351. @@ -1385,11 +1385,15 @@ NTSTATUS nfs41_ShouldTryToCollapseThisOpen(
  352.       * |pg_sidbuff| - Note that buffers with SID values must be 16byte
  353.       * aligned on Windows 10/32bit
  354.       */
  355. -#ifdef _MSC_BUILD
  356. +#if defined(_MSC_BUILD)
  357. +    /* Visual Studio */
  358.      __declspec(align(16)) char pg_sidbuff[MAX_SID_BUFFER_SIZE];
  359. -#else
  360. +#elif defined(__clang__)
  361. +    /* clang */
  362.      char pg_sidbuff[MAX_SID_BUFFER_SIZE] __attribute__((aligned(16)));
  363. -#endif /* _MSC_BUILD */
  364. +#else
  365. +#error Compiler not supported yet
  366. +#endif /* |_MSC_BUILD| */
  367.      PSID pg_sid = (PSID)&pg_sidbuff[0];
  368.  
  369.      (void)get_primarygroup_id(pg_sid);
  370. diff --git a/tests/winfsinfo1/winfsinfo.c b/tests/winfsinfo1/winfsinfo.c
  371. index a1c12b5..81bdf65 100644
  372. --- a/tests/winfsinfo1/winfsinfo.c
  373. +++ b/tests/winfsinfo1/winfsinfo.c
  374. @@ -1076,11 +1076,15 @@ int get_file_remote_protocol_info(const char *progname, const char *filename)
  375.  {
  376.      int res = EXIT_FAILURE;
  377.      bool ok;
  378. -#ifdef _MSC_BUILD
  379. +#if defined(_MSC_BUILD)
  380. +    /* Visual Studio */
  381.      __declspec(align(16)) FILE_REMOTE_PROTOCOL_INFO frpi;
  382. -#else
  383. +#elif defined(__clang__)
  384. +    /* clang */
  385.      FILE_REMOTE_PROTOCOL_INFO frpi __attribute__((aligned(16)));
  386. -#endif
  387. +#else
  388. +#error Compiler not supported yet
  389. +#endif /* |_MSC_BUILD| */
  390.      int i;
  391.      (void)memset(&frpi, 0, sizeof(frpi));
  392.  
  393. diff --git a/tests/winsg/winsg.c b/tests/winsg/winsg.c
  394. index ba8e8d2..75e405c 100644
  395. --- a/tests/winsg/winsg.c
  396. +++ b/tests/winsg/winsg.c
  397. @@ -2,7 +2,7 @@
  398.  /*
  399.   * MIT License
  400.   *
  401. - * Copyright (c) 2024-2025 Roland Mainz <roland.mainz@nrubsig.org>
  402. + * Copyright (c) 2024-2026 Roland Mainz <roland.mainz@nrubsig.org>
  403.   *
  404.   * Permission is hereby granted, free of charge, to any person obtaining a copy
  405.   * of this software and associated documentation files (the "Software"), to deal
  406. @@ -70,20 +70,22 @@
  407.  #define MAX_SID_BUFFER_SIZE (128)
  408.  
  409.  /*
  410. - * DECLARE_SID_BUFFER - declare a buffer for a SID value
  411. + * |DECLARE_SID_BUFFER| - declare a buffer for a SID value
  412.   * Note that buffers with SID values must be 16byte aligned
  413.   * on Windows 10/32bit, othewise the kernel might return
  414.   * |ERROR_NOACCESS|(=998) - "Invalid access to memory location".
  415.   */
  416. -#ifdef _MSC_BUILD
  417. +#if defined(_MSC_BUILD)
  418.  /* Visual Studio */
  419.  #define DECLARE_SID_BUFFER(varname) \
  420.      __declspec(align(16)) char (varname)[MAX_SID_BUFFER_SIZE]
  421. -#else
  422. +#elif defined(__clang__)
  423.  /* clang */
  424.  #define DECLARE_SID_BUFFER(varname) \
  425.      char (varname)[MAX_SID_BUFFER_SIZE] __attribute__((aligned(16)))
  426. -#endif /* _MSC_BUILD */
  427. +#else
  428. +#error Compiler not supported yet
  429. +#endif /* |_MSC_BUILD| */
  430.  
  431.  /*
  432.   * Performance hack:
  433. --
  434. 2.51.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