git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [PATCH 1/1] mingw: handle absolute paths in expand_user_path()

From
JMJoseph Moisan <joseph.moisan@jci.com>
Date
Nov 9, 2018, 02:05 UTC
Message-ID
<DM5P132MB0143B9D5FAF40A3999131517E7C60@DM5P132MB0143.NAMP132.PROD.OUTLOOK.COM>
In-Reply-To
<xmqqr2fwa0ew.fsf@gitster-ct.c.googlers.com>

Can someone please tell me how to unsubscribe from this email. I am no longer interested in receiving these emails, and cannot find how to unsubscribe. Thank you in advance.

Joseph Moisan | Software Engineer
Building Technologies and Solutions
Tel: +1-978-731-8950
Joseph.Moisan@JCI.com
-----Original Message-----
From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On Behalf Of Junio C Hamano
Sent: Wednesday, November 7, 2018 7:17 PM
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>; Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>; git@vger.kernel.org
Subject: Re: [PATCH 1/1] mingw: handle absolute paths in expand_user_path()
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
Show 14 quoted lines
>> The cute thing is: your absolute paths would not be moved because we 
>> are talking about Windows. Therefore your absolute paths would not 
>> start with a forward slash.
>
> Ah, sorry, I must have misunderstood a comment in your cover letter:
>
>     The reason is this: something like this (make paths specified e.g. via 
>     http.sslCAInfo relative to the runtime prefix) is potentially useful
>     also in the non-Windows context, as long as Git was built with the
>     runtime prefix feature.
>
> ... so I thought you meant to add this code for POSIX systems as well.
>
> My mistake. :(
Well, I do not think you should feel so bad about it, as you are not alone.
It wasn't clear to me either that it was to introduce a new syntax that users would not have otherwise used before (i.e. avoids negatively affecting existing settings---because the users would have used a path that begins with a backslash if they meant "full path down from the top of the current drive") to mean a new thing (i.e. "relative to the runtime prefix") that the patch wanted to do.
If that is the motivation, then it does make sense to extend this function, and possibly rename it, like this patch does, as we would want this new syntax available in anywhere we take a pathname to an untracked thing. And for such a pathname, we should be consistently using expand_user_path() *anyway* even without this new "now we know how to spell 'relative to the runtime prefix'" feature.
So I agree with the patch that the issue it wants to address is worth addressing, and the function to enhance is this one.
I am still unsure about the solution, though.

I suspect that any build that uses runtime prefix would want access to this feature, regardless of the platform. The new syntax that is "a pathname that begins with a slash is not an absolute path but is relative to the runtime prefix" cannot avoid ambiguity with users' existing settings on platforms other than Windows, which means this feature cannot be made platform neutral in its posted form. The documentation must say "On windows, the way to spell runtime prefix relative paths is this; on macs, you must spell it differently like this." etc. Which is rather unfortunate.

Perhaps we need to make an effort to find a syntax that is universally unambiguous and use it consistently across platforms?
I am tempted to say "//<token>/<the remainder>" might also be such a way, even in the POSIX world, but am not brave enough to do so, as I suspect that may have a fallout in the Windows world X-<.
An earlier suggestion by Duy in [*1*] to pretend as if we take $VARIABLE and define special variables might be a better direction.
Are there security implications if we started allowing references to environment varibables in strings we pass expand_user_path()?  If we cannot convince ourselves that it is safe to allow access to any and all environment variables, then we probably can start by specific "pseudo variables" under our control, like GIT_EXEC_PATH and GIT_INSTALL_ROOT, that do not even have to be tied to environment variables, perhaps with further restriction to allow it only at the beginning of the string, or something like that, if necessary.
[References]
*1* <CACsJy8DmyU_Kn4yytu_PQdpppXO8wLcuuzQ-fjwnyjA0ntB2Dw@mail.gmail.com>
Previous: Johannes SchindelinNext: Jeff King
Message 13 of 53 in “mingw: handle absolute paths in expand_user_path()”
  1. 0/1 mingw: handle absolute paths in expand_user_path()Johannes Schindelin via GitGitGadget, Nov 6, 2018
  2. 1/1 mingw: handle absolute paths in expand_user_path()Johannes Schindelin via GitGitGadget, Nov 6, 2018
  3. Ramsay JonesNov 6, 2018
  4. Ramsay JonesNov 6, 2018
  5. Duy NguyenNov 6, 2018
  6. Junio C HamanoNov 7, 2018
  7. Johannes SchindelinNov 7, 2018
  8. Ramsay JonesNov 7, 2018
  9. Junio C HamanoNov 8, 2018
  10. Johannes SchindelinNov 8, 2018
  11. Junio C HamanoNov 8, 2018
  12. Johannes SchindelinNov 8, 2018
  13. Joseph MoisanNov 9, 2018
  14. Jeff KingNov 9, 2018
  15. Duy NguyenNov 6, 2018
  16. Johannes SchindelinNov 7, 2018
  17. Johannes SixtNov 6, 2018
  18. Johannes SchindelinNov 7, 2018
  19. Johannes SixtNov 7, 2018
  20. Jeff KingNov 7, 2018
  21. Johannes SixtNov 7, 2018
  22. Jeff KingNov 7, 2018
  23. Junio C HamanoNov 8, 2018
  24. Jeff KingNov 8, 2018
  25. Junio C HamanoNov 8, 2018
  26. Johannes SchindelinNov 8, 2018
  27. Duy NguyenNov 8, 2018
  28. Johannes SchindelinNov 8, 2018
  29. Eric SunshineNov 8, 2018
  30. Jeff KingNov 9, 2018
  31. Duy NguyenNov 9, 2018
  32. Junio C HamanoNov 12, 2018
  33. Junio C HamanoNov 8, 2018
  34. Johannes SchindelinNov 8, 2018
  35. 0/2 mingw: handle absolute paths in expand_user_path()Johannes Schindelin via GitGitGadget, Jul 1, 2021
  36. 1/2 tests: exercise the RUNTIME_PREFIX featureJohannes Schindelin via GitGitGadget, Jul 1, 2021
  37. 2/2 expand_user_path(): support specifying paths relative to the runtime prefixJohannes Schindelin via GitGitGadget, Jul 1, 2021
  38. Junio C HamanoJul 1, 2021
  39. 0/5 mingw: handle absolute paths in expand_user_path()Johannes Schindelin via GitGitGadget, Jul 24, 2021
  40. 1/5 tests: exercise the RUNTIME_PREFIX featureJohannes Schindelin via GitGitGadget, Jul 24, 2021
  41. 3/5 expand_user_path(): clarify the role of the `real_home` parameterJohannes Schindelin via GitGitGadget, Jul 24, 2021
  42. 4/5 Use a better name for the function interpolating pathsJohannes Schindelin via GitGitGadget, Jul 24, 2021
  43. Junio C HamanoJul 26, 2021
  44. Fabian StelzerJul 27, 2021
  45. Junio C HamanoJul 27, 2021
  46. Junio C HamanoJul 28, 2021
  47. Junio C HamanoJul 28, 2021
  48. Junio C HamanoJul 28, 2021
  49. Fabian StelzerJul 28, 2021
  50. Junio C HamanoJul 28, 2021
  51. 2/5 expand_user_path(): remove stale part of the commentJohannes Schindelin via GitGitGadget, Jul 24, 2021
  52. 5/5 interpolate_path(): allow specifying paths relative to the runtime prefixJohannes Schindelin via GitGitGadget, Jul 24, 2021
  53. Junio C HamanoJul 26, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.