Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNIX remove_dir_all(): Try recursing first on the slow path #94446

Merged
merged 3 commits into from
Mar 5, 2022

Commits on Mar 4, 2022

  1. remove_dir_all(): try recursing first instead of trying to unlink()

    This only affects the `slow` code path, if there is no `dirent.d_type` or if
    the type is `DT_UNKNOWN`.
    
    POSIX specifies that calling `unlink()` or `unlinkat(..., 0)` on a directory can
    succeed:
    > "The _path_ argument shall not name a directory unless the process has
    > appropriate privileges and the implementation supports using _unlink()_ on
    > directories."
    This however can cause orphaned directories requiring an fsck e.g. on Illumos
    UFS, so we have to avoid that in the common case. We now just try to recurse
    into it first and unlink() if we can't open it as a directory.
    hkratz committed Mar 4, 2022
    Configuration menu
    Copy the full SHA
    e427333 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    41b4423 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    735f60c View commit details
    Browse the repository at this point in the history