Re: Patches for windows paths

Pascal Jaeger <[email protected]> Thu, 19 Mar 2026 17:25:19 +0100
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <ca9a977d-be85-47af-8b2c-76afdd246094@Canary>
--69bc236f_41a7c4c9_2668
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi,

I don=E2=80=99t think it=E2=80=99s necessary to put the setupvariables(ve=
rbose) behind an ifdef. It only changes what is printed out when calling =
the function. I think that is easy enough to reason about. I don=E2=80=99=
t know why it was called with 0 on Linux in the first place. I thought it=
 was a mistake.

The back2slash=5Fstr macro resolves to nothing on non windows systems any=
way, so no need to put it behind another ifdef either.

Regarding unsetenv the situation is a bit complicated. Apparently msvcrt =
and ucrt don=E2=80=99t have it, but older msys-2.0 does. MS says to use p=
utenv with an empty variable to unset an environment variable.
=E2=80=9E You can remove a variable from the environment by specifying an=
 empty value=5Fstring, or in other words, by specifying only varname=3D.
=5B1=5D=5B2=5D

=46WIW GNU knows unsetenv is missing on mingw and msvc. =5B3=5D

You=E2=80=99re right, in order not to risk breaking things, this should b=
e behind an ifdef and we should use unsetenv on linux as before.

Not sure I understood your approach though, but if it=E2=80=99s better th=
an I am all for using it instead of mine.

Regards
Pascal

=5B1=5D https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference=
/putenv=3Fview=3Dmsvc-170
=5B2=5D https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference=
/putenv-wputenv=3Fview=3Dmsvc-170
=5B3=5D https://www.gnu.org/software/gnulib/manual/html=5Fnode/unsetenv.h=
tml

--
Sent from Canary (https://canarymail.io)

> On Donnerstag, M=C3=A4rz 19, 2026 at 09:10, Jason Hood <jadoxa=40yahoo.=
com.au (mailto:jadoxa=40yahoo.com.au)> wrote:
> On 18/03/2026 17:48, Shigio YAMAGUCHI wrote:
> > =5Blibutil/getdbpath.c=5D
> > 133 setupvariables(verbose); <=3D=3D=3D
>
> Why is this not already present=3F gtagsexist has it, why not this=3F
> Even so, it ends up being ignored in global, since it gets called
> with 0 (before options are processed).
>
> > =5Bglobal/global.c=5D
> >
> > 954 putenv(=22GTAGSLIBPATH=3D=22); <=3D=3D=3D
>
> Not sure why that's necessary, my old MinGW has unsetenv.
>
> > > having to use GNU Global on windows on my work computer and I notic=
ed that GTAGSOBJDIRPRE=46IX does not work for windows.
> I took a slightly different approach, converting back2slash from
> global.c into a function in path.c (and moving STRCMP to path.h
> as PATHCMP). I duplicate the variables and convert them once (and
> use =22c:/usr/obj=22 as default). Rather than stripping a colon I
> assume the drive is present and generate a new path without it
> (D:/path -> /D/path).
>
> --
> Jason.

--69bc236f_41a7c4c9_2668
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<html xmlns=3D=22http://www.w3.org/1999/xhtml=22><head> <title></title> <=
meta name=3D=22viewport=22 content=3D=22width=3Ddevice-width, initial-sca=
le=3D1.0, user-scalable=3Dno=22> </head> <body style=3D=22font-family:Hel=
vetica;color:=23000000;font-size:16px;=22><img id=3D=223C5DD=4673EDDDCCA9=
507E02=468=46214C7=460=22 alt=3D=22=22 width=3D=220px=22 src=3D=22https:/=
/receipts.canarymail.io/track/567622EA92=46846AE37D933E714200E8B=5F3C5DD=46=
73EDDDCCA9507E02=468=46214C7=460.png=22 height=3D=220px=22><div id=3D=22C=
anaryBody=22 dir=3D=22auto=22> <div> Hi,</div><div><br></div><div>I don=E2=
=80=99t think it=E2=80=99s necessary to put the setupvariables(verbose) b=
ehind an ifdef. It only changes what is printed out when calling the func=
tion. I think that is easy enough to reason about. I don=E2=80=99t know w=
hy it was called with 0 on Linux in the first place. I thought it was a m=
istake.</div><div><br></div><div>The back2slash=5Fstr macro resolves to n=
othing on non windows systems anyway, so no need to put it behind another=
 ifdef either.=C2=A0</div><div><br></div><div>Regarding unsetenv the situ=
ation is a bit complicated. Apparently msvcrt and ucrt don=E2=80=99t have=
 it, but older msys-2.0 does. MS says to use putenv with an empty variabl=
e to unset an environment variable.</div><div><font color=3D=22=23ffffff=22=
>=E2=80=9E<span style=3D=22-webkit-tap-highlight-color: rgba(26, 26, 26, =
0.3); caret-color: rgb(255, 255, 255); font-family: &quot;Segoe UI&quot;,=
 &quot;Segoe UI Variable Text&quot;, -apple-system, BlinkMacSystem=46ont,=
 &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; -webkit-text-s=
ize-adjust: 100%; background-color: rgb(31, 31, 31);=22></span><span styl=
e=3D=22-webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); caret-color: r=
gb(255, 255, 255); font-family: &quot;Segoe UI&quot;, &quot;Segoe UI Vari=
able Text&quot;, -apple-system, BlinkMacSystem=46ont, &quot;Helvetica Neu=
e&quot;, Helvetica, Arial, sans-serif; -webkit-text-size-adjust: 100%; ba=
ckground-color: rgb(31, 31, 31);=22>=C2=A0You can remove a variable from =
the environment by specifying an empty=C2=A0</span><em style=3D=22-webkit=
-tap-highlight-color: rgba(26, 26, 26, 0.3); box-sizing: inherit; outline=
-color: inherit; caret-color: rgb(255, 255, 255); font-family: &quot;Sego=
e UI&quot;, &quot;Segoe UI Variable Text&quot;, -apple-system, BlinkMacSy=
stem=46ont, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; -we=
bkit-text-size-adjust: 100%;=22><code style=3D=22box-sizing: inherit; out=
line-color: inherit; font-family: S=46Mono-Regular, Consolas, &quot;Liber=
ation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; direction=
: ltr; overflow-wrap: break-word; border-radius: 3px; padding: 0.1em 0.2e=
m;=22>value=5Fstring</code></em><span style=3D=22-webkit-tap-highlight-co=
lor: rgba(26, 26, 26, 0.3); caret-color: rgb(255, 255, 255); font-family:=
 &quot;Segoe UI&quot;, &quot;Segoe UI Variable Text&quot;, -apple-system,=
 BlinkMacSystem=46ont, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans=
-serif; -webkit-text-size-adjust: 100%; background-color: rgb(31, 31, 31)=
;=22>, or in other words, by specifying only=C2=A0</span><em style=3D=22-=
webkit-tap-highlight-color: rgba(26, 26, 26, 0.3); box-sizing: inherit; o=
utline-color: inherit; caret-color: rgb(255, 255, 255); font-family: &quo=
t;Segoe UI&quot;, &quot;Segoe UI Variable Text&quot;, -apple-system, Blin=
kMacSystem=46ont, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-seri=
f; -webkit-text-size-adjust: 100%;=22><code style=3D=22box-sizing: inheri=
t; outline-color: inherit; font-family: S=46Mono-Regular, Consolas, &quot=
;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; dir=
ection: ltr; overflow-wrap: break-word; border-radius: 3px; padding: 0.1e=
m 0.2em;=22>varname</code></em><span style=3D=22-webkit-tap-highlight-col=
or: rgba(26, 26, 26, 0.3); caret-color: rgb(255, 255, 255); font-family: =
&quot;Segoe UI&quot;, &quot;Segoe UI Variable Text&quot;, -apple-system, =
BlinkMacSystem=46ont, &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-=
serif; -webkit-text-size-adjust: 100%; background-color: rgb(31, 31, 31);=
=22>=3D.</span></font></div><div>=5B1=5D=5B2=5D</div><div><br></div><div>=
=46WIW GNU knows unsetenv is missing on mingw and msvc. =5B3=5D</div><div=
><br></div><div>You=E2=80=99re right, in order not to risk breaking thing=
s, this should be behind an ifdef and we should use unsetenv on linux as =
before. =C2=A0</div><div><br></div><div>Not sure I understood your approa=
ch though, but if it=E2=80=99s better than I am all for using it instead =
of mine.=C2=A0</div><div><br></div><div>Regards</div><div>Pascal</div> <d=
iv><br></div><div><br></div><div>=5B1=5D<a href=3D=22https://learn.micros=
oft.com/en-us/cpp/c-runtime-library/reference/putenv=3Fview=3Dmsvc-170=22=
>=C2=A0https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/=
putenv=3Fview=3Dmsvc-170</a></div><div>=5B2=5D<a href=3D=22https://learn.=
microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-wputenv=3Fview=
=3Dmsvc-170=22>=C2=A0https://learn.microsoft.com/en-us/cpp/c-runtime-libr=
ary/reference/putenv-wputenv=3Fview=3Dmsvc-170</a></div><div>=5B3=5D=C2=A0=
<a href=3D=22https://www.gnu.org/software/gnulib/manual/html=5Fnode/unset=
env.html=22>https://www.gnu.org/software/gnulib/manual/html=5Fnode/unsete=
nv.html</a></div><div><br></div> </div> <div id=3D=22CanarySig=22> <div> =
<div style=3D=22font-family:Helvetica;=22>--<br>Sent from <a href=3D=22ht=
tps://canarymail.io=22>Canary</a></div> <div><br></div> </div> </div> <di=
v id=3D=22CanaryDropbox=22> </div> <blockquote id=3D=22CanaryBlockquote=22=
> <div> <div>On Donnerstag, M=C3=A4rz 19, 2026 at 09:10, Jason Hood &lt;<=
a href=3D=22mailto:jadoxa=40yahoo.com.au=22>jadoxa=40yahoo.com.au</a>&gt;=
 wrote:<br></div> <div>On 18/03/2026 17:48, Shigio YAMAGUCHI wrote: <br><=
blockquote type=3D=22cite=22>=5Blibutil/getdbpath.c=5D <br>133 setupvaria=
bles(verbose); &lt;=3D=3D=3D <br></blockquote> <br>Why is this not alread=
y present=3F gtagsexist has it, why not this=3F <br>Even so, it ends up b=
eing ignored in global, since it gets called <br>with 0 (before options a=
re processed). <br> <br><blockquote type=3D=22cite=22>=5Bglobal/global.c=5D=
 <br> <br>954 putenv(=22GTAGSLIBPATH=3D=22); &lt;=3D=3D=3D <br></blockquo=
te> <br>Not sure why that's necessary, my old MinGW has unsetenv. <br> <b=
r><blockquote type=3D=22cite=22><blockquote type=3D=22cite=22>having to u=
se GNU Global on windows on my work computer and I noticed that GTAGSOBJD=
IRPRE=46IX does not work for windows. <br></blockquote></blockquote>I too=
k a slightly different approach, converting back2slash from <br>global.c =
into a function in path.c (and moving STRCMP to path.h <br>as PATHCMP). I=
 duplicate the variables and convert them once (and <br>use =22c:/usr/obj=
=22 as default). Rather than stripping a colon I <br>assume the drive is =
present and generate a new path without it <br>(D:/path -&gt; /D/path). <=
br> <br>-- <br>Jason.<br></div> </div> </blockquote> </body></html>
--69bc236f_41a7c4c9_2668--