Bug 31385 - sort-makefile-lines.py doesn't check variable with _ nor with "^# variable"
Summary: sort-makefile-lines.py doesn't check variable with _ nor with "^# variable"
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: build (show other bugs)
Version: 2.40
: P2 normal
Target Milestone: 2.40
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-15 11:13 UTC by H.J. Lu
Modified: 2024-02-15 23:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2024-02-15 11:13:55 UTC
There are many Makefile variable names with _:

sysdeps/aarch64/Makefile:sysdep_headers += sys/ifunc.h
sysdeps/aarch64/Makefile:sysdep_routines += \
sysdeps/aarch64/Makefile:sysdep_malloc_debug_routines = __mtag_tag_zero_region __mtag_tag_region
...

But sort-makefile-lines.py doesn't include _ in

    # Build a list of all start markers (tuple includes name).
    startmarks = []
    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])
Comment 1 H.J. Lu 2024-02-15 11:19:58 UTC
Also many Makefiles have

sysdep_routines += \
  strcasecmp_l-nonascii \
  strcspn-generic \
  strncase_l-nonascii \
  strpbrk-generic \
  strspn-generic \
  varshift \
# sysdep_routines

But sort-makefile-lines.py expects

  # sysdep_routines
Comment 2 Sourceware Commits 2024-02-15 18:43:29 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6a2512bf1605a4208dd94ef67408488d8acb2409

commit 6a2512bf1605a4208dd94ef67408488d8acb2409
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Feb 15 03:22:55 2024 -0800

    sort-makefile-lines.py: Allow '_' in name and "^# name"
    
    '_' 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.
Comment 3 H.J. Lu 2024-02-15 23:07:24 UTC
Fixed.