From: Matthew Ogilvie <mmogilvi+git@zoho.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Todd Zullinger" <tmz@pobox.com>, "Jeff King" <peff@peff.net>,
"Ondrej Pohorelsky" <opohorel@redhat.com>,
"Ondřej Pohořelský via GitGitGadget" <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH v2] cvsserver: avoid precedence problem between ! and %s
Date: Thu, 22 May 2025 22:47:13 -0600 [thread overview]
Message-ID: <aC_90R3ohRRBVIV7@comcast.net> (raw)
In-Reply-To: <xmqqtt5c5viq.fsf@gitster.g>
On Thu, May 22, 2025 at 11:51:25AM -0700, Junio C Hamano wrote:
> 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
next prev parent reply other threads:[~2025-05-23 4:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 7:45 [PATCH] cvsserver: avoid precedence problem between ! and %s Ondřej Pohořelský via GitGitGadget
2025-05-21 7:53 ` Kristoffer Haugsbakk
2025-05-21 10:23 ` [PATCH v2] " Ondřej Pohořelský via GitGitGadget
2025-05-21 15:54 ` Junio C Hamano
2025-05-21 16:02 ` Junio C Hamano
2025-05-21 17:03 ` Junio C Hamano
2025-05-22 7:19 ` Ondrej Pohorelsky
2025-05-22 15:55 ` Junio C Hamano
2025-05-22 17:05 ` Jeff King
2025-05-22 17:56 ` Todd Zullinger
2025-05-22 18:51 ` Junio C Hamano
2025-05-23 4:47 ` Matthew Ogilvie [this message]
2025-05-23 15:48 ` Junio C Hamano
2025-05-26 13:56 ` Ondrej Pohorelsky
2025-05-27 15:52 ` Junio C Hamano
2025-05-22 11:26 ` [PATCH v3] " Ondřej Pohořelský via GitGitGadget
2025-05-26 13:48 ` [PATCH v4] cvsserver: remove unused escapeRefName function Ondřej Pohořelský via GitGitGadget
2025-05-27 15:24 ` Junio C Hamano
2025-05-21 14:58 ` [PATCH] cvsserver: avoid precedence problem between ! and %s Junio C Hamano
2025-05-21 21:48 ` brian m. carlson
2025-05-22 7:31 ` Ondrej Pohorelsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aC_90R3ohRRBVIV7@comcast.net \
--to=mmogilvi+git@zoho.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=opohorel@redhat.com \
--cc=peff@peff.net \
--cc=tmz@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).