Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests fail on MSYS2 #127

Closed
neheb opened this issue Jun 15, 2022 · 5 comments · Fixed by #660
Closed

tests fail on MSYS2 #127

neheb opened this issue Jun 15, 2022 · 5 comments · Fixed by #660
Labels
bug Something isn't working
Milestone

Comments

@neheb
Copy link

neheb commented Jun 15, 2022

sshot-17

No real idea what's happening.

@neheb
Copy link
Author

neheb commented Jun 16, 2022

Another problem related to the french locale test:

--- test3outputB	2022-06-14 18:37:06.559941900 -0700
+++ testtry	2022-06-14 18:37:06.594847800 -0700
@@ -87,8 +87,9 @@
 Capture group count = 0
 Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P 
   Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z 
-  ª µ º À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â 
-  ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ 
+  ƒ Š Œ Ž š œ ž Ÿ ª ² ³ µ ¹ º À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö 
+  Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý 
+  þ ÿ 
 Subject length lower bound = 1
 
 # All remaining tests are in the french locale, so set the default.
@@ -147,7 +148,7 @@
 /[[:alpha:]][[:lower:]][[:upper:]]/IB
 ------------------------------------------------------------------
         Bra
-        [A-Za-z\x83\x8a\x8c\x8e\x9a\x9c\x9e\x9f\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\xff]
+        [A-Za-z\x83\x8a\x8c\x8e\x9a\x9c\x9e\x9f\xaa\xb2\xb3\xb5\xb9\xba\xc0-\xd6\xd8-\xf6\xf8-\xff]
         [a-z\x83\x9a\x9c\x9e\xaa\xb5\xba\xdf-\xf6\xf8-\xff]
         [A-Z\x8a\x8c\x8e\x9f\xc0-\xd6\xd8-\xde]
         Ket
@@ -155,9 +156,9 @@
 ------------------------------------------------------------------
 Capture group count = 0
 Starting code units: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
-  a b c d e f g h i j k l m n o p q r s t u v w x y z ª µ º À Á Â Ã Ä Å Æ Ç 
-  È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í 
-  î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ 
+  a b c d e f g h i j k l m n o p q r s t u v w x y z ƒ Š Œ Ž š œ ž Ÿ ª ² ³ 
+  µ ¹ º À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â 
+  ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ 
 Subject length lower bound = 3
 
 # End of testinput3 

French locale is available.

@zherczeg
Copy link
Collaborator

I suspect the directories are simplified somehow, so the test pass regardless of the current working directory. This simplification is probably not done.

@neheb
Copy link
Author

neheb commented Jun 16, 2022

if you're referring to the first example, MSYS2 emulates a POSIX environment. The path looks like

C:\msys2\home\x\

The code filters it to

C:\msys2\

which is wrong.

@NWilson NWilson added the bug Something isn't working label Dec 8, 2024
@NWilson NWilson self-assigned this Jan 8, 2025
@NWilson NWilson added this to the 10.46 milestone Jan 8, 2025
@NWilson NWilson removed their assignment Jan 8, 2025
NWilson added a commit that referenced this issue Jan 9, 2025
Also fix a few minor portability issues.

- The unix "MSYS" environment has an usual (but sane) French locale,
  requiring a test update
- pcre2grep needs a fix to use the WIN32 when both WIN32 and sys/stat.h
  are available

Fixes #127
NWilson added a commit that referenced this issue Jan 9, 2025
Also fix a few minor portability issues.

- The unix "MSYS" environment has an usual (but sane) French locale,
  requiring a test update
- pcre2grep needs a fix to use the WIN32 when both WIN32 and sys/stat.h
  are available

Fixes #127
@NWilson
Copy link
Member

NWilson commented Jan 9, 2025

@neheb Thank you Rosen for reporting this. I have investigated, and opened a PR with the fix (#660).

The issue is to do with the way Windows handles wildcard expansion. When you run command *.txt in CMD or Batch scripts, the glob is not expanded by the shell as it is on Unix: applications are expected to do this themselves (using the same FindNextFile Win32 function that is used for directory traversal).

pcre2grep does already have code to do this on Windows - however, it uses #ifdef to check first for the sys/stat.h header, and then checks for whether WIN32 is defined. On MSYS, this resulted in the Unix codepath being taken, since Unix headers are available in addition to Win32 headers.

The fix is a one-liner to ensure that the Win32 implementation is used (for the UCRT64 and other MinGW-x64 environments). The "MSYS" environment of MSYS2 (which is cygwin-like, and produces applications that are linked to the cygwin runtime) still uses the Cygwin-emulated Unix environment.

@neheb
Copy link
Author

neheb commented Jan 10, 2025

cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants