bugmake - Bugs: bug #66050, add option --shuffle=nosort

 
 

bug #66050: add option --shuffle=nosort

Submitter:  Tzvetelin Katchov <katchov>
Submitted:  Wed 31 Jul 2024 07:51:44 PM UTC
   
 
Severity:  3 - Normal Priority:  5 - Normal
Item Group:  Enhancement Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Component Version:  None
Operating System:  None Fixed Release:  None
Triage Status:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Mon 05 Aug 2024 04:07:57 AM UTC, comment #3: 

I am not a fan having the --shuffle argument modify the behavior of $(wildcard ...) as they are completely disjoint facilities that have nothing to do with each other.  IMO it will be confusing.

The result of wildcard has swung back and forth between sorted and not sorted over time.  If there is a need to have an unsorted variation I think we will have to do something different like add a new function or similar.

But, I don't really understand what the benefit of having an unsorted result from the wildcard function would be.  The order in which files are returned from readdir() is famously undefined, so really they COULD be returned in sorted order or any other order the system chooses.  Since the order is totally arbitrary, I don't understand what the goal or purpose of preferring that order is?

I feel like you have a deeper requirement that is not obvious from this enhancement request, and it would probably be more fruitful to discuss that deeper requirement directly rather than discussing downstream changes like this.  We can discuss here, or probably more easily on the -email is unavailable- mailing list.

Paul D. Smith <psmith>
Group administrator
Sun 04 Aug 2024 11:28:46 PM UTC, comment #2: 


> Are you suggesting a way to always build prerequisites
> in an order sorted by their name?


The opposite: build WILDCARD prerequisites
in an order NOT sorted by their name.

$ touch {a..z}

# Current:
$ make -E "all: *; @echo $^"
a b c d e f g h i j k l m n o p q r s t u v w x y z

# Proposed enhancement with GLOB_NOSORT on ext4 fs:
$ make -E "all: *; @echo $^"
k g j t y l c i f a s e o u b r v z h n x p m q w d

Tzvetelin Katchov <katchov>
Sun 04 Aug 2024 06:46:17 PM UTC, comment #1: 

I'm sorry but I don't understand this issue.  Can you clarify?

I don't know what the --shuffle option has to do with sorting: shuffled prerequisites are never sorted (that would go against the entire concept).  Are you suggesting a way to always build prerequisites in an order sorted by their name?  I don't see why that would be something people would want or need in general, but you can get most of that already with the $(sort ...) function.

Paul D. Smith <psmith>
Group administrator
Wed 31 Jul 2024 07:51:44 PM UTC, original submission:  

add option --shuffle=nosort

GNU Make manual:
4.4 Using Wildcard Characters in File Names
If an expression matches multiple files then the results will be
sorted.

4.4.3 The Function wildcard
As with wildcard expansion in rules, the results of the wildcard
function are sorted.

src/read.c:
@@ -3350 +3350 @@
-        switch (glob (name, GLOB_ALTDIRFUNC, NULL, &gl))
+        switch (glob (name, GLOB_ALTDIRFUNC | GLOB_NOSORT, NULL, &gl))


Or manually shuffle by special target .FIRST? Prerequisites of this
special target will be reordered to be made first, i.e. to be build
with priority. It will provide hint to GNU Make how to schedule big
monolith targets in parallel build and provide manual fix for bug
#105: Parallel builds should order by slowest-first.

Tzvetelin Katchov <katchov>

 

Attached Files

This item currently has no attached files.

(Note: upload size limit is set to 4.0MiB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by katchov (Submitted the item)
  •  

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16-a7ba.
    Corresponding source code