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

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

 



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

Attachment: signature.asc
Description: PGP signature


[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