fix: recurse checkIsEmptyDir with correct path and nested emptiness detection#2102
fix: recurse checkIsEmptyDir with correct path and nested emptiness detection#2102carterpewpew wants to merge 1 commit intokubernetes:mainfrom
Conversation
|
Welcome @carterpewpew! |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: carterpewpew The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
When traversing subdirectories, join the parent path with the child name so checks run against the real tree instead of the process CWD. Propagate non-empty nested directories so directories with only nested files are not treated as empty. This affects isConfigFile for directory bind mounts and configMap handling. Tests: add fixture case for deep nested file, plus hermetic tempdir cases. Signed-off-by: Jathavedhan M <jathavedhan.m@ibm.com>
5e74482 to
e6eb58a
Compare
What type of PR is this?
/kind bug
What this PR does / why we need it:
checkIsEmptyDir(used byisConfigFile) had two recursion bugs:filepath.Join(parent, child),andThis change fixes both, so nested non-empty directories are correctly classified as non-empty and are not skipped due to bad recursion paths. Tests added for nested directory root classification in
isConfigFile, fixture-based nested directory checks, and hermetic tempdir nested empty/non-empty cases.Which issue(s) this PR fixes:
Special notes for your reviewer: