mz560: fix handling of ignoreList - #582
Conversation
|
if you need further proof that unittests are useless.... well at least the wrong tests let me research into why they are wrong, uncovering a larger issue in the code in the process, so helpful? |
57c4c91 to
0511060
Compare
|
AI summary review OverviewFixes a long-standing bug where functions accepting a What Changed
Code QualityGood:
Concerns / Suggestions:
Correctness
VerdictApprove with minor fixes. The |
|
now that we verified the panic doesn't pull, the redundant code can be removed |
0hlov3
left a comment
There was a problem hiding this comment.
Using the local wl in CheckCleanedPathAgainstProvidedIgnoreList and removing the unused exact-match helpers makes sense.
One blocker: this introduces a regression for VOLUME (and anything calling AddToIgnoreList after the snapshotter is created).
s.ignorelist is captured once at construction:
snapshot.NewSnapshotter(..., util.IgnoreList())
But VOLUME later appends to the global ignore list. Since slices are copied by header, s.ignorelist becomes stale.
Before this PR the walk still consulted the live global list; now it only uses s.ignorelist, so paths added later (e.g. /data) may incorrectly end up in layers.
Suggested fix: fetch the ignore list at snapshot time instead of storing it once, e.g. call util.IgnoreList() inside TakeSnapshot / scanFullFilesystem, or pass a getter function.
What do you think?
|
weird this should have been caught by Oh, volumes only affect the output image, not the build context Also a single global is anyways not sufficient, as we do build multistage builds. current behaviour (main) is to ignore files immediately, target behaviour (buildkit) is to do so in downstream images only. hmmmm even if I address the "regression" here, behaviour would still change note that in main, for whatever reason, There seems to be an entire treasure trove of buggy behaviour around |
IsInProvidedIgnoreList only matched a path exactly, silently ignoring PrefixMatchOnly=true entries and failing to catch files nested under an ignored directory. The intent of the function was to manage the list of ignores, not to check whether a path should be ignored. Replace all call sites with CheckCleanedPathAgainstProvidedIgnoreList, which correctly covers both exact and descendant paths and honours PrefixMatchOnly semantics. Remove the now-unused IsInProvidedIgnoreList.
…ignore list The function was shadowing the wl parameter by ranging over the global ignorelist instead, making all callers effectively ignore the list they passed in.
In preparation for #560
Description
The handling of
ignoreListswas a bit confused. There is a global variableutil.ignoreListthat gets initialized on bootup and is basically used for most tasks, but even functions that accept a ignorelist as a parameter would just at some depth fall back to read the global variable instead, clearly a bug. Fixing that bug however uncovered another incosistency. There are two functions to check whether a given path is in the ignoreList or not.IsInProvidedIgnoreListchecks whether that path is in the ignoreList literally, it is used for managing the list, as in check whether for my specific path an entry already exists or not.CheckCleanedPathAgainstProvidedIgnoreListchecks whether a given path should be ignored based on the ignoreList, this is different to the above, as/dev/sda1should be ignored if there is an entry for/dev.The code did use the former function when the latter should be used, there is no single code section where we have to manage the ignoreList so the former function can be dropped altogether.