Re: Patches for windows paths
Shigio YAMAGUCHI <[email protected]> Sat, 21 Mar 2026 15:46:49 +0900
| Newsgroups | gmane.comp.gnu.global.bugs |
|---|---|
| Message-ID | <CADJmJYpUoOh772tkb68odNKY5NO3NKbQ=uNWr4XTgP52bxiThA@mail.gmail.com> |
--0000000000002d1dc9064d832bbc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, > 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. I don't understand the approach either, but since Jason always releases Windows versions of Global, I'd like to follow his patch. Actually, I don't have a Windows machine, so I can't test it. Thank you both! On Fri, Mar 20, 2026 at 1:25=E2=80=AFAM Pascal Jaeger <pascal.jaeger@leimst= ift.de> wrote: > 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=99t know why it wa= s called > with 0 on Linux in the first place. I thought it was a mistake. > > The back2slash_str macro resolves to nothing on non windows systems > anyway, 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_string*, or in other words, by specifying only *varname*=3D. > [1][2] > > FWIW GNU knows unsetenv is missing on mingw and msvc. [3] > > 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 > > > [1] > https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv= ?view=3Dmsvc-170 > <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv= ?view=3Dmsvc-170> > [2] > https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv= -wputenv?view=3Dmsvc-170 > <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv= -wputenv?view=3Dmsvc-170> > [3] https://www.gnu.org/software/gnulib/manual/html_node/unsetenv.html > > -- > Sent from Canary <https://canarymail.io> > > On Donnerstag, M=C3=A4rz 19, 2026 at 09:10, Jason Hood <[email protected].= au> > wrote: > On 18/03/2026 17:48, Shigio YAMAGUCHI wrote: > > [libutil/getdbpath.c] > 133 setupvariables(verbose); <=3D=3D=3D > > > Why is this not already present? gtagsexist has it, why not this? > Even so, it ends up being ignored in global, since it gets called > with 0 (before options are processed). > > [global/global.c] > > 954 putenv("GTAGSLIBPATH=3D"); <=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 noticed tha= t > GTAGSOBJDIRPREFIX 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 "c:/usr/obj" 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. > > --=20 Shigio YAMAGUCHI <[email protected]> PGP fingerprint: 26F6 31B4 3D62 4A92 7E6F 1C33 969C 3BE3 89DD A6EB --0000000000002d1dc9064d832bbc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hi, <br>> Not sure I understood your approach though, b= ut if it=E2=80=99s better than I am all<br>> for using it instead of min= e.<br><br>I don't understand the approach either, but since Jason alway= s releases <br>Windows versions of Global, I'd like to follow his patch= . Actually, I don't <br>have a Windows machine, so I can't test it.= <br><br>Thank you both!<br></div><br><div class=3D"gmail_quote gmail_quote_= container"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Mar 20, 2026 at 1:= 25=E2=80=AFAM Pascal Jaeger <<a href=3D"mailto:[email protected]= e">[email protected]</a>> wrote:<br></div><blockquote class=3D"= gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20= 4,204,204);padding-left:1ex"> <div style=3D"font-family:Helvetica;color:= rgb(0,0,0);font-size:16px"><img id=3D"m_39480450384038622383C5DDF73EDDDCCA9= 507E02F8F214C7F0" alt=3D"" width=3D"0px" src=3D"https://receipts.canarymail= .io/track/567622EA92F846AE37D933E714200E8B_3C5DDF73EDDDCCA9507E02F8F214C7F0= .png" height=3D"0px"><div id=3D"m_3948045038403862238CanaryBody" dir=3D"aut= o"> <div> Hi,</div><div><br></div><div>I don=E2=80=99t think it=E2=80=99s n= ecessary to put the setupvariables(verbose) behind an ifdef. It only change= s what is printed out when calling the function. I think that is easy enoug= h to reason about. I don=E2=80=99t know why it was called with 0 on Linux i= n the first place. I thought it was a mistake.</div><div><br></div><div>The= back2slash_str macro resolves to nothing 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 situation is a bit complicated. Apparently msvcr= t 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.</div><div><f= ont color=3D"#ffffff">=E2=80=9E<span style=3D"font-family:"Segoe UI&qu= ot;,"Segoe UI Variable Text",-apple-system,BlinkMacSystemFont,&qu= ot;Helvetica Neue",Helvetica,Arial,sans-serif;background-color:rgb(31,= 31,31)"></span><span style=3D"font-family:"Segoe UI","Segoe = UI Variable Text",-apple-system,BlinkMacSystemFont,"Helvetica Neu= e",Helvetica,Arial,sans-serif;background-color:rgb(31,31,31)">=C2=A0Yo= u can remove a variable from the environment by specifying an empty=C2=A0</= span><em style=3D"box-sizing:inherit;outline-color:inherit;font-family:&quo= t;Segoe UI","Segoe UI Variable Text",-apple-system,BlinkMacS= ystemFont,"Helvetica Neue",Helvetica,Arial,sans-serif"><code styl= e=3D"box-sizing:inherit;outline-color:inherit;font-family:SFMono-Regular,Co= nsolas,"Liberation Mono",Menlo,Courier,monospace;font-size:13.6px= ;direction:ltr;border-radius:3px;padding:0.1em 0.2em">value_string</code></= em><span style=3D"font-family:"Segoe UI","Segoe UI Variable = Text",-apple-system,BlinkMacSystemFont,"Helvetica Neue",Helv= etica,Arial,sans-serif;background-color:rgb(31,31,31)">, or in other words,= by specifying only=C2=A0</span><em style=3D"box-sizing:inherit;outline-col= or:inherit;font-family:"Segoe UI","Segoe UI Variable Text&qu= ot;,-apple-system,BlinkMacSystemFont,"Helvetica Neue",Helvetica,A= rial,sans-serif"><code style=3D"box-sizing:inherit;outline-color:inherit;fo= nt-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier= ,monospace;font-size:13.6px;direction:ltr;border-radius:3px;padding:0.1em 0= .2em">varname</code></em><span style=3D"font-family:"Segoe UI",&q= uot;Segoe UI Variable Text",-apple-system,BlinkMacSystemFont,"Hel= vetica Neue",Helvetica,Arial,sans-serif;background-color:rgb(31,31,31)= ">=3D.</span></font></div><div>[1][2]</div><div><br></div><div>FWIW GNU kno= ws unsetenv is missing on mingw and msvc. [3]</div><div><br></div><div>You= =E2=80=99re right, in order not to risk breaking things, this should be beh= ind an ifdef and we should use unsetenv on linux as before. =C2=A0</div><di= v><br></div><div>Not sure I understood your approach 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> <div><br></div><div><br></div= ><div>[1]<a href=3D"https://learn.microsoft.com/en-us/cpp/c-runtime-library= /reference/putenv?view=3Dmsvc-170" target=3D"_blank">=C2=A0https://learn.mi= crosoft.com/en-us/cpp/c-runtime-library/reference/putenv?view=3Dmsvc-170</a= ></div><div>[2]<a href=3D"https://learn.microsoft.com/en-us/cpp/c-runtime-l= ibrary/reference/putenv-wputenv?view=3Dmsvc-170" target=3D"_blank">=C2=A0ht= tps://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-wput= env?view=3Dmsvc-170</a></div><div>[3]=C2=A0<a href=3D"https://www.gnu.org/s= oftware/gnulib/manual/html_node/unsetenv.html" target=3D"_blank">https://ww= w.gnu.org/software/gnulib/manual/html_node/unsetenv.html</a></div><div><br>= </div> </div> <div id=3D"m_3948045038403862238CanarySig"> <div> <div style= =3D"font-family:Helvetica">--<br>Sent from <a href=3D"https://canarymail.io= " target=3D"_blank">Canary</a></div> <div><br></div> </div> </div> <div id= =3D"m_3948045038403862238CanaryDropbox"> </div> <blockquote id=3D"m_3948045= 038403862238CanaryBlockquote"> <div> <div>On Donnerstag, M=C3=A4rz 19, 2026= at 09:10, Jason Hood <<a href=3D"mailto:[email protected]" target=3D"= _blank">[email protected]</a>> wrote:<br></div> <div>On 18/03/2026 17:= 48, Shigio YAMAGUCHI wrote: <br><blockquote type=3D"cite">[libutil/getdbpat= h.c] <br>133 setupvariables(verbose); <=3D=3D=3D <br></blockquote> <br>W= hy is this not already present? gtagsexist has it, why not this? <br>Even s= o, it ends up being ignored in global, since it gets called <br>with 0 (bef= ore options are processed). <br> <br><blockquote type=3D"cite">[global/glob= al.c] <br> <br>954 putenv("GTAGSLIBPATH=3D"); <=3D=3D=3D <br><= /blockquote> <br>Not sure why that's necessary, my old MinGW has unsete= nv. <br> <br><blockquote type=3D"cite"><blockquote type=3D"cite">having to = use GNU Global on windows on my work computer and I noticed that GTAGSOBJDI= RPREFIX does not work for windows. <br></blockquote></blockquote>I took a s= lightly different approach, converting back2slash from <br>global.c into a = function in path.c (and moving STRCMP to path.h <br>as PATHCMP). I duplicat= e the variables and convert them once (and <br>use "c:/usr/obj" a= s default). Rather than stripping a colon I <br>assume the drive is present= and generate a new path without it <br>(D:/path -> /D/path). <br> <br>-= - <br>Jason.<br></div> </div> </blockquote> </div></blockquote></div><div><= br clear=3D"all"></div><div><br></div><span class=3D"gmail_signature_prefix= ">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><div dir=3D"ltr"= ><div><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><= div dir=3D"ltr">Shigio YAMAGUCHI <<a href=3D"mailto:[email protected]" targ= et=3D"_blank">[email protected]</a>></div><div dir=3D"ltr"><div dir=3D"ltr"= >PGP fingerprint:=C2=A0</div><div dir=3D"ltr">26F6 31B4 3D62 4A92 7E6F =C2= =A01C33 969C 3BE3 89DD A6EB</div></div></div></div></div></div></div></div>= </div> --0000000000002d1dc9064d832bbc--