pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for VS19 link.exe crash on SMB/NFS filesystem, tests, docs+misc, 2024-09-04
Posted by Anonymous on Wed 4th Sep 2024 13:22
raw | new post

  1. From b62c49c6bc17071b80d4b4e415109890bfe00225 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 4 Sep 2024 12:07:48 +0200
  4. Subject: [PATCH 1/5] cygwin: Document the Visual Studio Installer config
  5.  file+Cygwin install
  6.  
  7. Document the Visual Studio Installer config file
  8. ("ms-nfs41-client/build.vc19/ms-nfs41-client.vsconfig") and add Cygwin
  9. installion instructions.
  10.  
  11. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  12. ---
  13. cygwin/README.txt | 10 +++++++++-
  14.  1 file changed, 9 insertions(+), 1 deletion(-)
  15.  
  16. diff --git a/cygwin/README.txt b/cygwin/README.txt
  17. index 39dd517..eb26dd3 100644
  18. --- a/cygwin/README.txt
  19. +++ b/cygwin/README.txt
  20. @@ -7,9 +7,17 @@
  21.  ######## Building ms-nfs41-client using Cygwin+Makefile:
  22.  ** Required software:
  23.  - Visual Studio 19
  24. +  Start Visual Studio 19 installer and import the installer
  25. +  config file "ms-nfs41-client/build.vc19/ms-nfs41-client.vsconfig",
  26. +  and then install Visual Studio.
  27. +  (Note that due to a bug in the VS installer it is sometimes
  28. +  required to manually add another (random) component to be installed,
  29. +  otherwise the imported config might be ignored)
  30.  - WDK for Windows 10, version 2004, from
  31.    https://go.microsoft.com/fwlink/?linkid=2128854
  32. -- Cygwin >= 3.5.0
  33. +- Cygwin 64bit >= 3.5.0
  34. +  (see "ms-nfs41-clientcygwin/README.bintarball.txt" for Cygwin 32bit
  35. +  and 64bit installation instructions)
  36.  
  37.  ** Build the project using Cygwin command line (bash/ksh93):
  38.  export PATH+=":/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/"
  39. --
  40. 2.45.1
  41.  
  42. From a4ac921e90e21678ba671662755da16db71b3467 Mon Sep 17 00:00:00 2001
  43. From: Roland Mainz <roland.mainz@nrubsig.org>
  44. Date: Wed, 4 Sep 2024 12:39:45 +0200
  45. Subject: [PATCH 2/5] tests: Add test module for |GetFileTime()| to winfsinfo
  46.  
  47. Add test module for |GetFileTime()| to winfsinfo.
  48.  
  49. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  50. ---
  51. tests/winfsinfo1/winfsinfo.c | 71 +++++++++++++++++++++++++++++++++++-
  52.  1 file changed, 70 insertions(+), 1 deletion(-)
  53.  
  54. diff --git a/tests/winfsinfo1/winfsinfo.c b/tests/winfsinfo1/winfsinfo.c
  55. index 42591f1..3c203f7 100644
  56. --- a/tests/winfsinfo1/winfsinfo.c
  57. +++ b/tests/winfsinfo1/winfsinfo.c
  58. @@ -439,6 +439,71 @@ done:
  59.      return res;
  60.  }
  61.  
  62. +
  63. +static
  64. +bool get_getfiletime(const char *progname, const char *filename)
  65. +{
  66. +    int res = EXIT_FAILURE;
  67. +    bool ok;
  68. +    FILETIME creationTime;
  69. +    FILETIME lastAccessTime;
  70. +    FILETIME lastWriteTime;
  71. +
  72. +    HANDLE fileHandle = CreateFileA(filename,
  73. +        GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
  74. +        FILE_FLAG_BACKUP_SEMANTICS, NULL);
  75. +    if (fileHandle == INVALID_HANDLE_VALUE) {
  76. +        (void)fprintf(stderr,
  77. +            "%s: Error opening file '%s'. Last error was %d.\n",
  78. +            progname,
  79. +            filename,
  80. +            (int)GetLastError());
  81. +        return EXIT_FAILURE;
  82. +    }
  83. +
  84. +    ok = GetFileTime(fileHandle, &creationTime, &lastAccessTime, &lastWriteTime);
  85. +
  86. +    if (!ok) {
  87. +        (void)fprintf(stderr, "%s: GetFileTime() "
  88. +            "error. GetLastError()==%d.\n",
  89. +            progname,
  90. +            (int)GetLastError());
  91. +        res = EXIT_FAILURE;
  92. +        goto done;
  93. +    }
  94. +
  95. +    (void)printf("(\n");
  96. +    (void)printf("\tfilename='%s'\n", filename);
  97. +
  98. +    SYSTEMTIME st;
  99. +
  100. +    /*
  101. +     * Note that SYSTEMTIME is in UTC, so
  102. +     * use $ (TZ=UTC ls -lad "$filename") to compare
  103. +     */
  104. +    (void)FileTimeToSystemTime(&creationTime, &st);
  105. +    (void)printf("\tcreationTime='%04d-%02d-%02d %02d:%02d:%02d.%d'\n",
  106. +        st.wYear, st.wMonth, st.wDay, st.wHour,
  107. +        st.wMinute, st.wSecond, st.wMilliseconds);
  108. +
  109. +    (void)FileTimeToSystemTime(&lastAccessTime, &st);
  110. +    (void)printf("\tlastAccessTime='%04d-%02d-%02d %02d:%02d:%02d.%d'\n",
  111. +        st.wYear, st.wMonth, st.wDay, st.wHour,
  112. +        st.wMinute, st.wSecond, st.wMilliseconds);
  113. +
  114. +    (void)FileTimeToSystemTime(&lastWriteTime, &st);
  115. +    (void)printf("\tlastWriteTime='%04d-%02d-%02d %02d:%02d:%02d.%d'\n",
  116. +        st.wYear, st.wMonth, st.wDay, st.wHour,
  117. +        st.wMinute, st.wSecond, st.wMilliseconds);
  118. +
  119. +    (void)printf(")\n");
  120. +    res = EXIT_SUCCESS;
  121. +
  122. +done:
  123. +    (void)CloseHandle(fileHandle);
  124. +    return res;
  125. +}
  126. +
  127.  static
  128.  void usage(void)
  129.  {
  130. @@ -447,7 +512,8 @@ void usage(void)
  131.          "filebasicinfo|"
  132.          "fileexinfostandard|"
  133.          "filestandardinfo|"
  134. -        "filenormalizednameinfo"
  135. +        "filenormalizednameinfo|"
  136. +        "getfiletime"
  137.          "> path\n");
  138.  }
  139.  
  140. @@ -477,6 +543,9 @@ int main(int ac, char *av[])
  141.      else if (!strcmp(subcmd, "filenormalizednameinfo")) {
  142.          return get_filenormalizednameinfo(av[0], av[2]);
  143.      }
  144. +    else if (!strcmp(subcmd, "getfiletime")) {
  145. +        return get_getfiletime(av[0], av[2]);
  146. +    }
  147.      else {
  148.          (void)fprintf(stderr, "%s: Unknown subcmd '%s'\n", av[0], subcmd);
  149.          return EXIT_FAILURE;
  150. --
  151. 2.45.1
  152.  
  153. From 656b3156e07ef6f0af6ce1297eaa361a277abf58 Mon Sep 17 00:00:00 2001
  154. From: Roland Mainz <roland.mainz@nrubsig.org>
  155. Date: Wed, 4 Sep 2024 12:47:28 +0200
  156. Subject: [PATCH 3/5] tests: winfsinfo should output local time, not UTC
  157.  
  158. winfsinfo should output local time, not UTC
  159.  
  160. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  161. ---
  162. tests/winfsinfo1/winfsinfo.c | 33 ++++++++++++++++++---------------
  163.  1 file changed, 18 insertions(+), 15 deletions(-)
  164.  
  165. diff --git a/tests/winfsinfo1/winfsinfo.c b/tests/winfsinfo1/winfsinfo.c
  166. index 3c203f7..702761a 100644
  167. --- a/tests/winfsinfo1/winfsinfo.c
  168. +++ b/tests/winfsinfo1/winfsinfo.c
  169. @@ -38,6 +38,18 @@
  170.  #include <stdint.h>
  171.  #include <stdbool.h>
  172.  
  173. +static
  174. +bool filetime2localsystemtime(const FILETIME *ft, SYSTEMTIME *st)
  175. +{
  176. +    FILETIME localft;
  177. +
  178. +    if (!FileTimeToLocalFileTime(ft, &localft))
  179. +        return false;
  180. +    if (!FileTimeToSystemTime(&localft, st))
  181. +        return false;
  182. +    return true;
  183. +}
  184. +
  185.  
  186.  static
  187.  bool getvolumeinfo(const char *progname, const char *filename)
  188. @@ -222,7 +234,6 @@ done:
  189.      return res;
  190.  }
  191.  
  192. -
  193.  /*
  194.   * Win10 uses |FileNetworkOpenInformation| to get the information
  195.   * for |GetFileExInfoStandard|
  196. @@ -252,21 +263,17 @@ bool get_fileexinfostandard(const char *progname, const char *filename)
  197.  
  198.      SYSTEMTIME st;
  199.  
  200. -    /*
  201. -     * Note that SYSTEMTIME is in UTC, so
  202. -     * use $ (TZ=UTC ls -lad "$filename") to compare
  203. -     */
  204. -    (void)FileTimeToSystemTime(&finfo.ftCreationTime, &st);
  205. +    (void)filetime2localsystemtime(&finfo.ftCreationTime, &st);
  206.      (void)printf("\tftCreationTime='%04d-%02d-%02d %02d:%02d:%02d.%d'\n",
  207.          st.wYear, st.wMonth, st.wDay, st.wHour,
  208.          st.wMinute, st.wSecond, st.wMilliseconds);
  209.  
  210. -    (void)FileTimeToSystemTime(&finfo.ftLastAccessTime, &st);
  211. +    (void)filetime2localsystemtime(&finfo.ftLastAccessTime, &st);
  212.      (void)printf("\tftLastAccessTime='%04d-%02d-%02d %02d:%02d:%02d.%d'\n",
  213.          st.wYear, st.wMonth, st.wDay, st.wHour,
  214.          st.wMinute, st.wSecond, st.wMilliseconds);
  215.  
  216. -    (void)FileTimeToSystemTime(&finfo.ftLastWriteTime, &st);
  217. +    (void)filetime2localsystemtime(&finfo.ftLastWriteTime, &st);
  218.      (void)printf("\tftLastWriteTime='%04d-%02d-%02d %02d:%02d:%02d.%d'\n",
  219.          st.wYear, st.wMonth, st.wDay, st.wHour,
  220.          st.wMinute, st.wSecond, st.wMilliseconds);
  221. @@ -477,21 +484,17 @@ bool get_getfiletime(const char *progname, const char *filename)
  222.  
  223.      SYSTEMTIME st;
  224.  
  225. -    /*
  226. -     * Note that SYSTEMTIME is in UTC, so
  227. -     * use $ (TZ=UTC ls -lad "$filename") to compare
  228. -     */
  229. -    (void)FileTimeToSystemTime(&creationTime, &st);
  230. +    (void)filetime2localsystemtime(&creationTime, &st);
  231.      (void)printf("\tcreationTime='%04d-%02d-%02d %02d:%02d:%02d.%d'\n",
  232.          st.wYear, st.wMonth, st.wDay, st.wHour,
  233.          st.wMinute, st.wSecond, st.wMilliseconds);
  234.  
  235. -    (void)FileTimeToSystemTime(&lastAccessTime, &st);
  236. +    (void)filetime2localsystemtime(&lastAccessTime, &st);
  237.      (void)printf("\tlastAccessTime='%04d-%02d-%02d %02d:%02d:%02d.%d'\n",
  238.          st.wYear, st.wMonth, st.wDay, st.wHour,
  239.          st.wMinute, st.wSecond, st.wMilliseconds);
  240.  
  241. -    (void)FileTimeToSystemTime(&lastWriteTime, &st);
  242. +    (void)filetime2localsystemtime(&lastWriteTime, &st);
  243.      (void)printf("\tlastWriteTime='%04d-%02d-%02d %02d:%02d:%02d.%d'\n",
  244.          st.wYear, st.wMonth, st.wDay, st.wHour,
  245.          st.wMinute, st.wSecond, st.wMilliseconds);
  246. --
  247. 2.45.1
  248.  
  249. From a2186200f5ba607f6212ac27cd7caddffd72490f Mon Sep 17 00:00:00 2001
  250. From: Roland Mainz <roland.mainz@nrubsig.org>
  251. Date: Wed, 4 Sep 2024 13:26:11 +0200
  252. Subject: [PATCH 4/5] build.vc19: Add missing daemon/accesstoken.* to
  253.  nfsd.vcxproj.filters
  254.  
  255. Add missing daemon/accesstoken.* to nfsd.vcxproj.filters
  256.  
  257. Reported-by: Dan Shelton <dan.f.shelton@gmail.com>
  258. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  259. ---
  260. build.vc19/nfsd/nfsd.vcxproj.filters | 6 ++++++
  261.  1 file changed, 6 insertions(+)
  262.  
  263. diff --git a/build.vc19/nfsd/nfsd.vcxproj.filters b/build.vc19/nfsd/nfsd.vcxproj.filters
  264. index 439daec..d3cdf3e 100644
  265. --- a/build.vc19/nfsd/nfsd.vcxproj.filters
  266. +++ b/build.vc19/nfsd/nfsd.vcxproj.filters
  267. @@ -132,6 +132,9 @@
  268.      <ClCompile Include="..\..\daemon\volume.c">
  269.        <Filter>Source Files</Filter>
  270.      </ClCompile>
  271. +    <ClCompile Include="..\..\daemon\accesstoken.c">
  272. +      <Filter>Source Files</Filter>
  273. +    </ClCompile>
  274.    </ItemGroup>
  275.    <ItemGroup>
  276.      <ClInclude Include="..\..\daemon\cpvparser1.h">
  277. @@ -200,5 +203,8 @@
  278.      <ClInclude Include="..\..\include\nfs_ea.h">
  279.        <Filter>Header Files</Filter>
  280.      </ClInclude>
  281. +    <ClInclude Include="..\..\daemon\accesstoken.h">
  282. +      <Filter>Header Files</Filter>
  283. +    </ClInclude>
  284.    </ItemGroup>
  285.  </Project>
  286. \ No newline at end of file
  287. --
  288. 2.45.1
  289.  
  290. From 2b619f439552df6c5b4cd5f00848287af2cfc56a Mon Sep 17 00:00:00 2001
  291. From: Roland Mainz <roland.mainz@nrubsig.org>
  292. Date: Wed, 4 Sep 2024 14:02:55 +0200
  293. Subject: [PATCH 5/5] cygwin: Document workaround for VS19 "link.exe" crash on
  294.  SMB/NFS filesystems
  295.  
  296. Document workaround for VS19 "link.exe" crash on SMB/NFS filesystems.
  297.  
  298. See also
  299. https://developercommunity.visualstudio.com/t/Visual-Studio-linkexe-crashes-on-networ/10735424
  300. ("Visual Studio link.exe crashes on network filesystem").
  301.  
  302. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  303. ---
  304. cygwin/README.txt | 11 +++++++++++
  305.  1 file changed, 11 insertions(+)
  306.  
  307. diff --git a/cygwin/README.txt b/cygwin/README.txt
  308. index eb26dd3..1e34fdb 100644
  309. --- a/cygwin/README.txt
  310. +++ b/cygwin/README.txt
  311. @@ -26,6 +26,17 @@ cd ms-nfs41-client
  312.  cd cygwin
  313.  make installdest
  314.  
  315. +# Note that $ make installdest # can fail on SMB/NFSv4.1 filesystems
  316. +# with a "link.exe" crash.
  317. +# Workaround is to disable incremental linking before building, e.g. do
  318. +# ---- snip ----
  319. +cd ms-nfs41-client
  320. +sed -i -E 's/<LinkIncremental>true<\/LinkIncremental>/<LinkIncremental>false<\/LinkIncremental>/g' $(find build.vc19 -name \*.vcxproj)
  321. +# ---- snip ----
  322. +# This Visual Studio bug is tracked as
  323. +# https://developercommunity.visualstudio.com/t/Visual-Studio-linkexe-crashes-on-networ/10735424
  324. +# ("Visual Studio link.exe crashes on network filesystem").
  325. +
  326.  
  327.  #### Install the software (requires mintty.exe running as "Adminstrator"):
  328.  cd ms-nfs41-client/destdir/cygdrive/c/cygwin64/sbin
  329. --
  330. 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