pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patch to add tests for non-ASCII group names+misc, 2025-06-14
Posted by Anonymous on Sat 14th Jun 2025 20:32
raw | new post

  1. From e198296876c13c0621a984bf66b27e42bc92c606 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Sat, 14 Jun 2025 20:21:52 +0200
  4. Subject: [PATCH 1/2] daemon: Add workaround "...\isctype.cpp(36) : Assertion
  5.  failed: c >= -1 && c <= 255" assertions in CPV parser
  6.  
  7. Add workaround for
  8. "minkernel\crts\ucrt\src\appcrt\convert\isctype.cpp(36) :
  9. Assertion failed: c >= -1 && c <= 255" assertions in ksh93 compound
  10. variable (CPV) parser when it encounters non-ASCII characters.
  11.  
  12. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  13. ---
  14. daemon/cpvparser1.c | 23 ++++++++++++++++++++---
  15.  1 file changed, 20 insertions(+), 3 deletions(-)
  16.  
  17. diff --git a/daemon/cpvparser1.c b/daemon/cpvparser1.c
  18. index 285fc76..48aa111 100644
  19. --- a/daemon/cpvparser1.c
  20. +++ b/daemon/cpvparser1.c
  21. @@ -2,7 +2,7 @@
  22.  /*
  23.   * MIT License
  24.   *
  25. - * Copyright (c) 2023 Roland Mainz <roland.mainz@nrubsig.org>
  26. + * Copyright (c) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  27.   *
  28.   * Permission is hereby granted, free of charge, to any person obtaining a copy
  29.   * of this software and associated documentation files (the "Software"), to deal
  30. @@ -37,7 +37,7 @@
  31.   *
  32.   * ToDo:
  33.   * - arrays (indexed, sparse indexed and associative)
  34. - * - multibyte characters
  35. + * - multibyte characters (e.g. use |wchar_t| API)
  36.   *
  37.   * Written by Roland Mainz <roland.mainz@nrubsig.org>
  38.   */
  39. @@ -52,7 +52,24 @@
  40.  
  41.  #ifdef _WIN32
  42.  #define strdup(s) _strdup(s)
  43. -#endif
  44. +#ifdef _MSC_VER
  45. +/*
  46. + * Hack to avoid UCRT assertion
  47. + * "minkernel\crts\ucrt\src\appcrt\convert\isctype.cpp(36) :
  48. + * Assertion failed: c >= -1 && c <= 255"
  49. + * This hack works for UTF-8 because UTF-8 and ASCII are identical for code
  50. + * codepoints between 0 and 127 (i.e. UTF-8 is intentionally
  51. + * backwards-compatible to ASCII).
  52. + * Permanent fix would be to switch over to the |wchar_t| API.
  53. + */
  54. +#undef isspace
  55. +#define isspace(c) isspace((((c) >= 0) && ((c) < 127))?(c):0)
  56. +#undef isalpha
  57. +#define isalpha(c) isalpha((((c) >= 0) && ((c) < 127))?(c):0)
  58. +#undef isalnum
  59. +#define isalnum(c) isalnum((((c) >= 0) && ((c) < 127))?(c):0)
  60. +#endif /* _MSC_VER */
  61. +#endif /* _WIN32 */
  62.  
  63.  /* private data! */
  64.  typedef struct cpv_parse_context {
  65. --
  66. 2.45.1
  67.  
  68. From 92e17f7fa7b93251d751883ae24a6e06eb1ca626 Mon Sep 17 00:00:00 2001
  69. From: Roland Mainz <roland.mainz@nrubsig.org>
  70. Date: Sat, 14 Jun 2025 21:19:14 +0200
  71. Subject: [PATCH 2/2] tests: Add test entries for group names with non-ASCII
  72.  characters
  73.  
  74. Add test entries for group names with non-ASCII characters
  75.  
  76. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  77. ---
  78. tests/manual_testing.txt | 21 ++++++++++++++++-----
  79.  1 file changed, 16 insertions(+), 5 deletions(-)
  80.  
  81. diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
  82. index ea82965..c7e83fd 100644
  83. --- a/tests/manual_testing.txt
  84. +++ b/tests/manual_testing.txt
  85. @@ -1,5 +1,5 @@
  86.  #
  87. -# ms-nfs41-client manual testing sequence, 2025-05-10
  88. +# ms-nfs41-client manual testing sequence, 2025-06-14
  89.  #
  90.  # Draft version, needs to be turned into automated tests
  91.  # if possible
  92. @@ -194,6 +194,9 @@ ksh93 -c 'builtin cp ; rm -f x y ; touch x ; cp -p x y && print OK ; true'
  93.  ksh93 -c 'builtin cp ; rm -f x y ; touch x ; /usr/bin/cp -p x y && print OK ; true'
  94.  ksh93 -c 'builtin id ; rm -f x ; touch x ; chown "$(id -u -n):$(id -g -n)" x && print OK'
  95.  ksh93 -c 'builtin id ; rm -f x ; touch x ; chgrp "$(id -g -n)" x && print OK'
  96. +# Extra tests if the cygwingrp*-groups exist on a test system:
  97. +ksh93 -c 'builtin chgrp; rm -f x ; touch x ; chgrp "cygwingrp2" x && print OK'
  98. +ksh93 -c 'builtin chgrp; rm -f x ; touch x ; chgrp "$(printf "cygwingrp_\u00F6\u00E4\u00FC_4")" x && print OK'
  99.  ---- snip ----
  100.  
  101.  
  102. @@ -290,33 +293,41 @@ mkdir //derfwnb4966_ipv6linklocal@2049/nfs4/bigdisk/builds/bash_build1/a2/b2 ||
  103.  
  104.  #
  105.  # Tests for groups
  106. -# (Add groups "cygwingrp1" and "cygwingrp2" to both Linux NFSv4 server
  107. -# and Windows machine, after that $ chgrp cygwingrp2 # should work)
  108. +# (Add groups "cygwingrp1", "cygwingrp2" and "cygwingrp_<oe><ae<ue>_4"
  109. +# to both Linux NFSv4 server and Windows machine, after that
  110. +# $ chgrp cygwingrp2 filename # and
  111. +# $ chgrp $'cygwingrp_\u00F6\u00E4\u00FC_4' filename # should work)
  112.  #
  113.  ---- snip ----
  114.  # "WINHOST1" is the Windows machine,
  115.  # "DERFWNB4966" is the Linux NFSv4 server:
  116.  
  117. -# create two groups on the Windows machine
  118. +# create three groups on the Windows machine
  119.  WINHOST1:~$ net localgroup cygwingrp1 /add
  120.  WINHOST1:~$ net localgroup cygwingrp2 /add
  121. +WINHOST1:~$ powershell -Command 'New-LocalGroup -Name "cygwingrp_$([char]0x00F6)$([char]0x00E4)$([char]0x00FC)_4" -Description "Cygwin test group with non-ASCII chars in name"'
  122.  
  123.  # add user "roland_mainz" to both new groups
  124.  WINHOST1:~$ net localgroup cygwingrp1 roland_mainz /add
  125.  WINHOST1:~$ net localgroup cygwingrp2 roland_mainz /add
  126. +WINHOST1:~$ powershell -Command 'Add-LocalGroupMember -Group "cygwingrp_$([char]0x00F6)$([char]0x00E4)$([char]0x00FC)_4" -Member roland_mainz'
  127.  
  128.  # get gid from both groups
  129.  WINHOST1:~$ getent group cygwingrp1
  130.  cygwingrp1:S-1-5-21-3286904461-661230000-4220857270-1003:197611:
  131.  WINHOST1:~$ getent group cygwingrp2
  132.  cygwingrp2:S-1-5-21-3286904461-661230000-4220857270-1004:197612:
  133. +WINHOST1:~$ getent group $'cygwingrp_\u00F6\u00E4\u00FC_4'
  134. +cygwingrp_<oe><ae<ue>_4:S-1-5-21-1849874161-1103376535-3295315891-1008:197616:
  135.  
  136.  # add the two groups to the Linux NFSv4 server, including the gids
  137. -("197611" and "197612"):
  138. +("197611", "197612" and "197616"):
  139.  root@DERFWNB4966:~# groupadd -g 197611 cygwingrp1
  140.  root@DERFWNB4966:~# groupadd -g 197612 cygwingrp2
  141. +root@DERFWNB4966:~# printf "cygwingrp_\u00F6\u00E4\u00FC_4:x:197616:\n" >>'/etc/group'
  142.  root@DERFWNB4966:~# usermod -a -G cygwingrp1 roland_mainz
  143.  root@DERFWNB4966:~# usermod -a -G cygwingrp2 roland_mainz
  144. +# user "roland_mainz" must be manually added to group "cygwingrp2_<oe><ae<ue>_4"
  145.  ---- snip ---
  146.  
  147.  #
  148. --
  149. 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