public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>, Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] sort-makefile-lines.py: Allow '_' in name and "^# name"
Date: Thu, 15 Feb 2024 07:24:06 -0500	[thread overview]
Message-ID: <15d11dbf-1677-4c48-a425-7067dbae1c4c@redhat.com> (raw)
In-Reply-To: <CAMe9rOpxhnoN3dxtSYc_qvH-E-3O2e7U2tzjksh0iTX2mRuDVQ@mail.gmail.com>

On 2/15/24 07:19, H.J. Lu wrote:
> On Thu, Feb 15, 2024 at 4:16 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * H. J. Lu:
>>
>>> '_' is used in Makefile variable names and many variables end with
>>> "^# name".  Relax sort-makefile-lines.py to allow '_' in name and
>>> "^# name" as variable end.  This fixes BZ #31385.
>>> ---
>>>  scripts/sort-makefile-lines.py | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/scripts/sort-makefile-lines.py b/scripts/sort-makefile-lines.py
>>> index f65ee40e27..ea02412d67 100755
>>> --- a/scripts/sort-makefile-lines.py
>>> +++ b/scripts/sort-makefile-lines.py
>>> @@ -129,7 +129,7 @@ def sort_makefile_lines():
>>>      for i in range(len(lines)):
>>>          # Look for things like "var = \", "var := \" or "var += \"
>>>          # to start the sorted list.
>>> -        var = re.search(r'^([a-zA-Z0-9-]*) [\+:]?\= \\$', lines[i])
>>> +        var = re.search(r'^([a-zA-Z0-9-_]*) [\+:]?\= \\$', lines[i])
>>>          if var:
>>>              # Remember the index and the name.
>>>              startmarks.append((i, var.group(1)))
>>
>> Please keep the literal - at the end of the bracket expression.  I think
>> it's easier to read even if it may be semantically the same.
> 
> Did you mean like this?
> 
> diff --git a/scripts/sort-makefile-lines.py b/scripts/sort-makefile-lines.py
> index f65ee40e27..d791789671 100755
> --- a/scripts/sort-makefile-lines.py
> +++ b/scripts/sort-makefile-lines.py
> @@ -129,7 +129,7 @@ def sort_makefile_lines():
>      for i in range(len(lines)):
>          # Look for things like "var = \", "var := \" or "var += \"
>          # to start the sorted list.
> -        var = re.search(r'^([a-zA-Z0-9-]*) [\+:]?\= \\$', lines[i])
> +        var = re.search(r'^([-_a-zA-Z0-9]*) [\+:]?\= \\$', lines[i])

Yes, exactly, I agree with Florian here you want to show that the literal '-' and '_'
are not part of a range in the character class. So either start or end is fine with
me.

Looking forward to v2. Thanks for fixing this!

>          if var:
>              # Remember the index and the name.
>              startmarks.append((i, var.group(1)))
> 
>> Thanks,
>> Florian
>>
> 
> 

-- 
Cheers,
Carlos.


  reply	other threads:[~2024-02-15 12:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 11:27 H.J. Lu
2024-02-15 12:16 ` Florian Weimer
2024-02-15 12:19   ` H.J. Lu
2024-02-15 12:24     ` Carlos O'Donell [this message]
2024-02-15 12:29       ` H.J. Lu
2024-02-15 12:25 ` Andreas Schwab

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=15d11dbf-1677-4c48-a425-7067dbae1c4c@redhat.com \
    --to=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).