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

Re: [PATCH v2] cvsserver: avoid precedence problem between ! and %s

From
MOMatthew Ogilvie <mmogilvi+git@zoho.com>
Date
May 23, 2025, 04:47 UTC
Message-ID
<aC_90R3ohRRBVIV7@comcast.net>
In-Reply-To
<xmqqtt5c5viq.fsf@gitster.g>
On Thu, May 22, 2025 at 11:51:25AM -0700, Junio C Hamano wrote:
Show 31 quoted lines
> Todd Zullinger <tmz@pobox.com> writes:
> 
> > Just for curiosity, the only commit found with escapeRefName
> > is when it was added:
> >
> >     $ git log -G '\bescapeRefName\b' -- git-cvsserver.perl
> >     commit 51a7e6dbc9
> >     Author: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
> >     Date:   Sat Oct 13 23:42:26 2012 -0600
> >
> > 	cvsserver: define a tag name character escape mechanism
> > 	
> > 	CVS tags are officially only allowed to use [-_0-9A-Za-f].  Git
> > 	refs commonly uses other characters, especially [./].  Such characters
> > 	need to be escaped from CVS in order to be referenced.
> > 	
> > 	This just defines functions to escape/unescape names.  The functions
> > 	are not used yet.
> > 	
> > 	Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
> > 	Signed-off-by: Junio C Hamano <gitster@pobox.com>
> >
> > A subsequent commit, 658b57ad52 (cvsserver: add misc commit
> > lookup, file meta data, and file listing functions,
> > 2012-10-13), made use of unescapeRefName; escapeRefName
> > seems to have _never_ been used.
> 
> OK, so we can safely remove it, it seems ;-)  I wonder what, if any,
> the unescaping side is unescaping, if we are not doing the escaping.
> 
> Thanks for digging.
FYI:

One intent is that the user might do the escaping manually, if they need to refer to a git refspec that is not legal in CVS. For example, "cvs update -r pu_-s-mo_-s-experiment1" instead of "cvs update -r pu/mo/experiment1". To some extent the function could be considered a form of documentation of how you would do this manually.

Also, the fact escapeRefName() isn't called suggests that there might be other bugs. There is a test case in t9402 that tests arguments "-r heads/b1" with a comment that "This is not really legal CVS, but it seems to work anyway". I haven't fully tracked it down, but I suspect that might end up putting a literal "heads/b1" in the CVS sandbox's "CVS/Entries" file. If so, that is invalid, because Entries uses slash for its own field separator. If we added more tests immediately after it *without* a different "-r" (which is very high priority when resolving which version to update to), they would likely fail. It might make sense to put an escapeRefName(unescapeRefName()) nested call somewhere to protect against things like this test case...

However, despite writing and (incompletely) testing this code, I have never *really* used it, and probably never will. So I'm not in a hurry to try to test or fix it further...

(For that matter, has anyone ever heard of anyone actually using git-cvsserver at all? I think I would be surprised if there was anyone using it, especially so many years after CVS stopped being maintained at all.)

        - Matthew Ogilvie
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 21 in “cvsserver: avoid precedence problem between ! and %s”
  1. cvsserver: avoid precedence problem between ! and %sOndřej Pohořelský via GitGitGadget, May 21, 2025
  2. Kristoffer HaugsbakkMay 21, 2025
  3. cvsserver: avoid precedence problem between ! and %sOndřej Pohořelský via GitGitGadget, May 21, 2025
  4. Junio C HamanoMay 21, 2025
  5. Junio C HamanoMay 21, 2025
  6. Junio C HamanoMay 21, 2025
  7. Ondrej PohorelskyMay 22, 2025
  8. Junio C HamanoMay 22, 2025
  9. Jeff KingMay 22, 2025
  10. Todd ZullingerMay 22, 2025
  11. Junio C HamanoMay 22, 2025
  12. Matthew OgilvieMay 23, 2025
  13. Junio C HamanoMay 23, 2025
  14. Ondrej PohorelskyMay 26, 2025
  15. Junio C HamanoMay 27, 2025
  16. cvsserver: avoid precedence problem between ! and %sOndřej Pohořelský via GitGitGadget, May 22, 2025
  17. cvsserver: remove unused escapeRefName functionOndřej Pohořelský via GitGitGadget, May 26, 2025
  18. Junio C HamanoMay 27, 2025
  19. Junio C HamanoMay 21, 2025
  20. brian m. carlsonMay 21, 2025
  21. Ondrej PohorelskyMay 22, 2025

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.