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

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

From
Ondrej Pohorelsky <opohorel@redhat.com>
Date
May 22, 2025, 07:31 UTC
Message-ID
<CA+B51BEqMPPmbaiXCFKXoPvufS7NnT-wxJCW5VgmtP05xUbrcw@mail.gmail.com>
In-Reply-To
<aC5KRBop9m3K5JtE@tapette.crustytoothpaste.net>

Looking at the code, we were not exactly sure how the code should work, so we picked the solution with the least impact that suppresses the warning and doesn't break anything. I'll change the commit to use `!~` instead.

On Wed, May 21, 2025 at 11:49 PM brian m. carlson <sandals@crustytoothpaste.net> wrote:

Show 25 quoted lines
>
> On 2025-05-21 at 14:58:07, Junio C Hamano wrote:
> > "Ondřej Pohořelský via GitGitGadget" <gitgitgadget@gmail.com>
> > writes:
> >
> > > diff --git a/git-cvsserver.perl b/git-cvsserver.perl
> > > index a4e1bad33ca..076c10cb2c2 100755
> > > --- a/git-cvsserver.perl
> > > +++ b/git-cvsserver.perl
> > > @@ -5009,7 +5009,7 @@ sub escapeRefName
> > >      #   = "_-xx-" Where "xx" is the hexadecimal representation of the
> > >      #     desired ASCII character byte. (for anything else)
> > >
> > > -    if(! $refName=~/^[1-9][0-9]*(\.[1-9][0-9]*)*$/)
> > > +    if(! ($refName=~/^[1-9][0-9]*(\.[1-9][0-9]*)*$/))
> >
> > Interesting.  Shouldn't it be using !~ instead if it wants to assert
> > that the refname does not match the pattern?
>
> Yes, it should.  It's likely the reason this is getting a warning is
> that `!` is higher precedence than `=~` and `!~` (see `man perlop`) and
> switching to `!~` is the customary way of writing this.
> --
> brian m. carlson (they/them)
> Toronto, Ontario, CA
-- 
Ondřej Pohořelský

Software Engineer

Red Hat

opohorel@redhat.com
Previous: brian m. carlson
Message 21 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.