From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x112f.google.com (mail-yw1-x112f.google.com [IPv6:2607:f8b0:4864:20::112f]) by sourceware.org (Postfix) with ESMTPS id E35DA3861863 for ; Thu, 15 Feb 2024 12:30:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E35DA3861863 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E35DA3861863 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::112f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708000211; cv=none; b=leoF7CONpihvTRXoqkXP1GkxxW90HIy9s82EPU9xsTqpGni9yHC4phpcgwGCATi14rmLeeDsszKqAnSrJxw1MTP5AXL7OeIgVCoW2j24Ow/0u9PNTweTOzNDj2wQoQsC/NhZ1WGrDSdxiYFJaittXHdTIw1N0Dxm2MBZHp1thIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708000211; c=relaxed/simple; bh=CqVUeMBpQIMwTxSYJGFJYiwZqbj+7L0yrFty1SSVRIs=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Sf77yj57hPaSfbOaS6Hleg7KbmasjeVNqMiwtQejXtRzAf67gGc6Qd6+AtfRC2HigEZa81YDOCUCPziI8kMqxybCj8GkTJVTeRCmQrhvABSCTwyAbbAZKu5Us6dcyz1gLV1mEFBeoSULmUHy+RPuB0fgOgPkOWs4SjvF3/Zuneo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-607e905eac6so819367b3.0 for ; Thu, 15 Feb 2024 04:30:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708000208; x=1708605008; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=YeZG0y/FYT+yp/UHyR6iH3JylPTGq+wiaxHpnta0ajY=; b=jIP+Uc3fYavbFsj3Mxz9HX5JlmYDvAaSiicvVphSZNovY87QjjHx2IRJijN9Xvc/8s KvM9kxmOvjdED0eIdYCiP1RVwh/9atZDOGY9afgFwaxNc3Difqst3sCA7k/K0BMtfWPN Gslmxg9CHCU104bJMMFYqGWX7Yag2040foEDs/NfjNanI3bCPOlY1tXag3Mmmqbywgoj 8p/Un/zL/O/V8O912fAxIH5Gm6hgenZmrlrhZgyffS+pZLLeJyqADIJNxylAb+yqmmNh bciJIcxAlVjIRmitLVZYhRSxpBP2CHrzDMNZOU9RkPtA5fSJUGtxPi1t3sIaBgN0Ckbx TRdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708000208; x=1708605008; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YeZG0y/FYT+yp/UHyR6iH3JylPTGq+wiaxHpnta0ajY=; b=W7HIViu09HfIv625TD5L3a4D2T2bkcKr4PDXDQTxOC3g8X9yITxCdtgy82cMt04FhZ fHVHGbI76vGMLv80bdkFXMl71IpkGAD1qNEnfbkdWCufiV14haxvIJqdiUI6IKLGmg2g p90OTOqK14j0LUVhODElkAhNj+S4xvD4RPfakff6eoPJLYv5YiWYbQl4H/Shmy+W+KXi E8sd3pNK2sayTR80o1BoQqycRjg/a4pEXcCHtJBmTEy1MaBWVsD++lLKLtlJOGfVuo3l 0qnVWTLEkdU+NHittBfRO1DQDYNlCctLqO2SG6QA9CnaOdoVqHD2ZzvDEdEbj+XfkwYQ /eZg== X-Forwarded-Encrypted: i=1; AJvYcCVZoWp4NSJn++Ck6N7ZQa7AT+zrYumIoSdb3mOP5PiegutlSzcVi1BOCwu/1upB9156DRcdHY3/ZIr2cVjfZTIyMC2Ey9/hVB8B X-Gm-Message-State: AOJu0Yx2+9vl9ycXXxbANWYLZpyqxWmYTjqpwSCI9vqk/SBt86R3ntYp 7SN+yOcrF2O/ZnF10u4vTEpJ6AcCEUhsV91GzKZ7JziskpJRXSv/it55CoKL0mYAvipB7JHlBzu OlDpqUPEHJf7QMFMVwUi7NhcGl37V2VX0 X-Google-Smtp-Source: AGHT+IFTL0lKdg37H/E8KGHK7XhN2IOQadP76kIoBZgFD3XMznsFhI21bOiAog5zKUP1+23cThN1+sMzv+5lE2NO930= X-Received: by 2002:a81:7184:0:b0:607:75e7:80db with SMTP id m126-20020a817184000000b0060775e780dbmr1573430ywc.13.1708000208176; Thu, 15 Feb 2024 04:30:08 -0800 (PST) MIME-Version: 1.0 References: <20240215112719.392617-1-hjl.tools@gmail.com> <87edddc48s.fsf@oldenburg.str.redhat.com> <15d11dbf-1677-4c48-a425-7067dbae1c4c@redhat.com> In-Reply-To: <15d11dbf-1677-4c48-a425-7067dbae1c4c@redhat.com> From: "H.J. Lu" Date: Thu, 15 Feb 2024 04:29:32 -0800 Message-ID: Subject: Re: [PATCH] sort-makefile-lines.py: Allow '_' in name and "^# name" To: "Carlos O'Donell" Cc: Florian Weimer , libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3020.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Feb 15, 2024 at 4:24=E2=80=AFAM Carlos O'Donell = wrote: > > On 2/15/24 07:19, H.J. Lu wrote: > > On Thu, Feb 15, 2024 at 4:16=E2=80=AFAM Florian Weimer 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-l= ines.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 =3D \", "var :=3D \" or "var += =3D \" > >>> # to start the sorted list. > >>> - var =3D re.search(r'^([a-zA-Z0-9-]*) [\+:]?\=3D \\$', lines[= i]) > >>> + var =3D re.search(r'^([a-zA-Z0-9-_]*) [\+:]?\=3D \\$', 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 thi= nk > >> 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-lin= es.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 =3D \", "var :=3D \" or "var +=3D = \" > > # to start the sorted list. > > - var =3D re.search(r'^([a-zA-Z0-9-]*) [\+:]?\=3D \\$', lines[i]= ) > > + var =3D re.search(r'^([-_a-zA-Z0-9]*) [\+:]?\=3D \\$', 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! Done. Thanks. > > if var: > > # Remember the index and the name. > > startmarks.append((i, var.group(1))) > > > >> Thanks, > >> Florian > >> > > > > > > -- > Cheers, > Carlos. > --=20 H.J.