bugQuilt - Bugs: bug #63651, Race condition in quilt test suite

 
 

bug #63651: Race condition in quilt test suite

Submitter:  Ross Burton <rossburton>
Submitted:  Fri 13 Jan 2023 12:50:24 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  khali
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 20 Jan 2023 12:06:42 PM UTC, comment #3: 
Jean Delvare <khali>
Group administrator
Sun 15 Jan 2023 01:06:14 PM UTC, comment #2: 

Known issue. It was discussed over 4 years ago on the quilt-dev list:

https://lists.nongnu.org/archive/html/quilt-dev/2018-01/msg00000.html

Unfortunately we could not find a clean fix. Since then I'm using the workaround I posted in the discussion thread in the SUSE package so that it passes the test suite reliably. I'll attach it to this bug. It's a bit more costly than yours, as it requires running the problematic diff command twice, but I think it's more readable and actually tests the expected behavior more accurately.

I'll commit the workaround to the upstream quilt repository so that we no longer have to carry it as a separate patch in distribution packages.

Jean Delvare <khali>
Group administrator
Fri 13 Jan 2023 04:50:07 PM UTC, comment #1: 

We're hitting this enough in automated QA that it is annoying, so we've this pretty horrible patch:


-        >~ (Files|Binary files) a/test\.bin and b/test\.bin differ
-        > Diff failed on file 'test.bin', aborting
+        >~ (.*[Ff]iles a/test\.bin and b/test\.bin differ|Diff failed on file 'test.bin', aborting)
+        >~ (.*[Ff]iles a/test\.bin and b/test\.bin differ|Diff failed on file 'test.bin', aborting)


Basically, replace the two expected lines with two regexs that each match both of the lines.

Ross Burton <rossburton>
Fri 13 Jan 2023 12:50:24 PM UTC, original submission:  

We had a run of the quilt test suite fail:

[faildiff.test]
[1] $ mkdir patches -- ok
[3] $ quilt new test.diff -- ok
[6] $ cat > test.txt -- ok
[8] $ quilt add test.txt -- ok
[13] $ chmod -r test.txt -- ok
[15] $ quilt refresh -- ok
[18] $ echo 1 -- ok
[21] $ chmod +r test.txt -- ok
[25] $ printf "\\002\\000\\001" > test.bin -- ok
[26] $ quilt add test.bin -- ok
[29] $ printf "\\003\\000\\001" > test.bin -- ok
[30] $ quilt diff -pab --no-index -- failed
Diff failed on file 'test.bin', aborting !~ (Files|Binary files) a/test\.bin and b/test\.bin differ
Binary files a/test.bin and b/test.bin differ != Diff failed on file 'test.bin', aborting

Note how the test read the right lines, but in the wrong order.

This is because there's an inherent race condition in the test logic. run redirects stderr to stdout and expects the lines to be read in the order that they were written, but thanks to buffering that isn't always going to happen.

A race-free solution would probably involve not merging stdout and stderr, and matching on them explicity.

Ross Burton <rossburton>

 

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

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by khali (Posted a comment)
  • -email is unavailable- added by rossburton (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
    2023-01-20 khali StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2023-01-15 khali Attached File- Added test-faildiff-workaround-order-bug.patch, #54228
    2023-01-15 khali StatusNone Confirmed
        Assigned toNone khali

    Back to the top

    Powered by Savane 3.13-54b4.
    Corresponding source code