[Bug]: flatpak-builder is happy to delete the current directory
Checklist
- [X] I agree to follow the Code of Conduct that this project adheres to.
- [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.
flatpak-builder version
flatpak-builder 1.2.2
Flatpak version
Flatpak 1.12.7
How to reproduce
- Start in the source directory of the project you're working on
- Try to remember how to run
flatpak-builder. Something about--force-clean --user --installor so, I think? - See the
--helpoutput mentions that you need to give mandatoryDIRECTORYandMANIFESToptions. - Perhaps having used Docker a couple of times, try giving
.for theDIRECTORYargument.
Expected Behavior
A nice message from flatpak-builder saying "refusing to delete the current directory".
Actual Behavior
flatpak-builder did exactly what I told it to. --force-clean . is pretty clear, no?
So maybe this isn't a bug, but it's a big (and destructive) enough trap that's easy enough to fall into that it ought to be forbidden. Maybe it makes sense to build in the current directory, but I can't imagine any situation in which it's reasonable to delete the current directory. flatpak-builder --force-clean . should refuse to operate.
There's precedent for this: even rm -rf prevents you from shooting yourself in the foot in this particular way:
rm: refusing to remove '.' or '..' directory: skipping '.'
Additional Information
Fortunately, I take automated hourly snapshots of my ~/src. Combined with some git show output that happened to be in the terminal backlog I was able to piece everything back together. This time. :sweat_smile: