Page MenuHome GnuPG

Windows (Semi-hosted environment): filename and network access
Open, WishlistPublic

Description

  • Filename

We have a regression by / -> \ with make_filename.

In rG962058f70486: Allow tilde expansion for the foo-program options., the tilde expansion support is added for the argument handling.

This change breaks use of semi-hosted environment. Namely, using Wine emulation for testing Windows binaries on GNU/Linux host.
Specifically, in the tests by gpgscm, initial setup fails because gpg-connect-agent cannot spawn gpg-agent any more.

Apparently, replacing / by \ changes the semantics (gpgrt_access function fails for \home\gniibe\build\mingw-i686\gnupg\agent\gpg-agent.exe).

  • Network access

Dirmngr check_inet_support doesn't work well on semi-hosted environment.

Event Timeline

gniibe renamed this task from Windows (Semi-hosted environment): Regression by / -> \ by make_filename to Windows (Semi-hosted environment): Regression by / -> \ with make_filename.Jun 3 2024, 7:02 AM
gniibe created this task.

The executable is on Z: drive (Z:\home\gniibe\build\mingw-i686\gnupg\agent\gpg-agent.exe) in the emulated environment.
Perhaps, when the path is absolute path with /, it is interpreted as on the drive Z:.

Recall that on windows you have a current working directory per drive. Thus only LETTER:\foo is a full patch - or an UNC (\\SERVER\foo).

gniibe renamed this task from Windows (Semi-hosted environment): Regression by / -> \ with make_filename to Windows (Semi-hosted environment): filename and network access.Jun 5 2024, 6:27 AM
gniibe updated the task description. (Show Details)

For my testing environment, I have this patch for now.

diff --git a/common/stringhelp.c b/common/stringhelp.c
index 9a2265258..f5f94f66f 100644
--- a/common/stringhelp.c
+++ b/common/stringhelp.c
@@ -68,7 +68,7 @@
 static inline char *
 change_slashes (char *name)
 {
-#ifdef HAVE_DOSISH_SYSTEM
+#if 0
   char *p;
 
   if (strchr (name, '\\'))
diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c
index 270717215..7f17c7dff 100644
--- a/dirmngr/dns-stuff.c
+++ b/dirmngr/dns-stuff.c
@@ -2429,7 +2429,7 @@ check_inet_support (int *r_v4, int *r_v6)
 
   *r_v4 = *r_v6 = 0;
 
-#ifdef HAVE_W32_SYSTEM
+#if 0
   {
     gpg_error_t err;
     int ret;

Then, it works well.

gniibe triaged this task as Wishlist priority.Jun 7 2024, 7:22 AM

Since it is only me, let us set the "Wishlist" priority on this task.

For now, I'm using this to avoid failure of make check (invoking gpg-agent by gpg-connect-agent).

diff --git a/common/stringhelp.c b/common/stringhelp.c
index 9a2265258..6596c65cd 100644
--- a/common/stringhelp.c
+++ b/common/stringhelp.c
@@ -70,6 +70,22 @@ change_slashes (char *name)
 {
 #ifdef HAVE_DOSISH_SYSTEM
   char *p;
+  /* 0: don't know yet, 1: it's under wine, -1: no */
+  static int semihosted_by_wine;
+
+  /* Under wine, no change.  */
+  if (!semihosted_by_wine)
+    {
+      HMODULE hntdll = GetModuleHandle ("ntdll.dll");
+      if (hntdll
+          && GetProcAddress (hntdll, "wine_get_version"))
+        semihosted_by_wine = 1;
+      else
+        semihosted_by_wine = -1;
+    }
+
+  if (semihosted_by_wine > 0)
+    return name;
 
   if (strchr (name, '\\'))
     {