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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On 2025-05-21 at 14:58:07, Junio C Hamano wrote:
> > "Ondřej Pohořelský via GitGitGadget" <gitgitgadget@xxxxxxxxx>
> > 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@xxxxxxxxxx






[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux