bugmake - Bugs: bug #63215, --shuffle=random doesn't properly...

 
 

bug #63215: --shuffle=random doesn't properly initialize config.seed

Submitter:  James Hilliard <jameshilliard>
Submitted:  Fri 14 Oct 2022 10:50:44 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  4.4 Operating System:  POSIX-Based
Fixed Release:  4.4 Triage Status:  Small Effort
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 18 Oct 2022 01:55:48 PM UTC, comment #3: 

I've already incorporated it, with some slight differences.  Thanks!

Paul D. Smith <psmith>
Group administrator
Sun 16 Oct 2022 03:53:17 PM UTC, comment #2: 


comment #1:

> Using 0 here still gives a random shuffle because 0 means "generate a new random number".  However you're right that this is not correct because it doesn't allow us to recreate the random value.
>
> Thanks for the note!


Should I send my suggested change as a patch to the mailing list or is a different approach preferred?

James Hilliard <jameshilliard>
Sat 15 Oct 2022 10:11:51 PM UTC, comment #1: 

Using 0 here still gives a random shuffle because 0 means "generate a new random number".  However you're right that this is not correct because it doesn't allow us to recreate the random value.

Thanks for the note!

Paul D. Smith <psmith>
Group administrator
Fri 14 Oct 2022 10:50:44 PM UTC, original submission:  

When using submake it seems the seed isn't getting set properly as MAKEFLAGS just gets passed "--shuffle=0" when the toplevel make is invoked with "--shuffle=random".

I think we need to do something like this so that we initialize the seed before it gets passed to MAKEFLAGS:
diff --git a/src/shuffle.c b/src/shuffle.c
index 4cfdc943..471c56b1 100644
--- a/src/shuffle.c
+++ b/src/shuffle.c
@@ -82,7 +82,11 @@ shuffle_set_mode (const char *cmdarg)
     }
   else
     {
-      if (strcasecmp (cmdarg, "random") != 0)
+      if (strcasecmp (cmdarg, "random") == 0)
+        {
+          config.seed = make_rand ();
+        }
+      else
         {
           /* Assume explicit seed.  */
           const char *err;

James Hilliard <jameshilliard>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-18 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.4
        Triage StatusNone Small Effort

    Back to the top

    Powered by Savane 3.13-da57.
    Corresponding source code