Skip to content

Revert "libstore: replace unlink() with std::filesystem::remove()"#15344

Merged
Ericson2314 merged 1 commit intomasterfrom
no-filesystem-remove
Feb 26, 2026
Merged

Revert "libstore: replace unlink() with std::filesystem::remove()"#15344
Ericson2314 merged 1 commit intomasterfrom
no-filesystem-remove

Conversation

@Ericson2314
Copy link
Member

This reverts commit b8caabe.

std::filesystem::remove will actually do a rmdir for directories. Per https://en.cppreference.com/w/cpp/filesystem/remove.html :

The file or empty directory identified by the path p is deleted as if
by the POSIX remove. Symlinks are not followed (symlink is removed,
not its target).

See
https://pubs.opengroup.org/onlinepubs/9699919799/functions/remove.html

This is a behavior change that we can't be sure is fine, so let's revert for now. We can do an unlink wrapper later to avoid the .string().


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

This reverts commit b8caabe.

`std::filesystem::remove` will actually do a `rmdir` for directories.
Per https://en.cppreference.com/w/cpp/filesystem/remove.html :

> The file or empty directory identified by the path p is deleted as if
> by the POSIX remove. Symlinks are not followed (symlink is removed,
> not its target).

See
https://pubs.opengroup.org/onlinepubs/9699919799/functions/remove.html

This is a behavior change that we can't be sure is fine, so let's revert
for now. We can do an unlink wrapper later to avoid the `.string()`.
@github-actions github-actions bot added new-cli Relating to the "nix" command store Issues and pull requests concerning the Nix store labels Feb 26, 2026
@Ericson2314 Ericson2314 added this pull request to the merge queue Feb 26, 2026
Merged via the queue into master with commit 6481e75 Feb 26, 2026
19 checks passed
@Ericson2314 Ericson2314 deleted the no-filesystem-remove branch February 26, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-cli Relating to the "nix" command store Issues and pull requests concerning the Nix store

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants