Deduplicate matching Xauthority records#439
Conversation
91b91ed to
87a384f
Compare
|
Could a maintainer please approve the remaining workflow to run? Thanks! |
87a384f to
76a11a8
Compare
|
@JPeisach Could you please approve the workflow run? The CI failure was caused by a deprecated actions/upload-artifact@v3 which has been fixed by rebasing onto the latest main. Thanks! |
|
Sorry, queued them up. I'll check on this tomorrow. |
Thanks! I noticed most test failures (286/322) seem pre-existing — they fail with expected "XSERVER-0 START VT=7 SEAT=seat0", likely because the container lacks VT support. |
| continue; | ||
| } | ||
|
|
||
| if (matched) |
There was a problem hiding this comment.
If mode is not XAUTH_WRITE_MODE_REMOVE, this would evaluate to if(false), so this code would never run
There was a problem hiding this comment.
It is false for the first match, then stays true for the rest of the loop. In replace mode, this skips the second and later matching records. I rewrote it using duplicate_record to make that clearer.
| matched = TRUE; | ||
| if (mode == XAUTH_WRITE_MODE_REMOVE) | ||
| { | ||
| matched = TRUE; |
There was a problem hiding this comment.
It was already matched by the top of the condition (after if(record_matches)), so shouldn't it be defined up there?
There was a problem hiding this comment.
Done. The code now saves the previous value in duplicate_record, then sets matching_record_found at the top of the block. This keeps the first match and skips later ones.
Include the authorization name when matching records. Keep the first match when replacing a cookie and discard any duplicates. In remove mode, delete all matches and do not add a record when none exists. Add tests for set, replace, and remove modes.
76a11a8 to
bb4f8bf
Compare
When replacing an Xauthority cookie, keep one matching record and remove duplicate matches. Unrelated records are preserved.
This avoids leaving stale cookies for the current display while keeping manually added Xauthority entries intact.