Skip to content

fs.Dir.deleteTree has no upper bound on retries #15465

Description

@squeek502

Zig Version

0.11.0-dev.2777+b95cdf0ae

Steps to Reproduce and Observed Behavior

This was meant to be a follow-up issue of #13073 (comment)

This should have a default and user-configurable upper bound of tries for deletion.
Otherwise, one can not detect other buggy processes continuously inserting directories or files.

As I understand it, the CI has been running into infinite loops on Windows due to DELETE_PENDING when file handles don't get closed (#15450, #15460).

Here's a minimal reproduction:

const std = @import("std");

test {
    var tmp = std.testing.tmpDir(.{});
    defer tmp.cleanup(); // infinite loop while retrying to delete the tmp dir

    var file = try tmp.dir.createFile("neverclose", .{});
    _ = file;
}

Expected Behavior

deleteTree should error with something like error.TooManyRetries after some user-configurable amount of retries.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions