builder-main: Prevent deleting state-dir, cwd or their parents with force-clean#668
Merged
builder-main: Prevent deleting state-dir, cwd or their parents with force-clean#668
Conversation
2 tasks
c5b8fb3 to
b8841de
Compare
Deleting the state dir leaves flatpak-builder in an inconsistent hung
state by default as rofiles-fuse tries to recurse indefinitely when
resolving paths.
```
statx(AT_FDCWD, "/home/bbhtt/test/.flatpak-builder/rofiles/rofiles-lLitmd/.flatpak-builder/rofiles/rofiles-lLitmd/.flatpak-builder/rofiles/rofiles-lLitmd/.flatpak-builder/rofiles/rofiles-lLitmd/.flatpak-builder/rofiles/rofiles-lLitmd/.flatpak-builder/rofiles/rofiles-lLitmd/.flatpak-builder/rofiles/rofiles-lLitmd/.flatpak-builder/rofiles/rofiles-lLitmd/.flatpak-builder/rofiles/rofiles-lLitmd/.flatpak-builder/rofiles/rofiles-lLitmd/.flatpak-builder/cache/config", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_ALL, {stx_mask=STATX_BASIC_STATS|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=67, ...}) = 0
[...]
```
This is reproducible when doing
```
flatpak-builder --state-dir ~/foobar ~/foobar --force-clean MANIFEST
```
or
```
flatpak-builder . --force-clean MANIFEST
```
Building in the current directory does not make sense and cwd usually contains the manifest, files referenced in the manifest and other files. Deleting all of them is destructive. Also since state dir defaults to cwd/.flatpak-builder by default, a deletion leads to the hung state described in the previous commit. Fixes #475
b8841de to
77ab2e0
Compare
swick
approved these changes
Sep 12, 2025
Contributor
Author
|
I'm wondering whether to merge this for 1.4.x or wait for 1.5.0. At least the second commit is technically a breaking change, but maybe easily solvable. So maybe it is low impact... I need to update the doc accordingly. |
Contributor
Author
|
After thinking about it for a while, I think it's fine for 1.4.6. I couldn't find a use case which cannot be easily solved by adjusting I updated the doc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #475
I guess the question here is how much mistake should it prevent and how much is this a breaking change.
I think the spinoff state dir deletion case that I found makes sense and wouldn't really be a breaking change as that never worked without hanging. That also automatically solves the builddir being
.case at least when--state-dirdoesn't point to somewhere else.I'm a bit unsure about the blocking the cwd case.