flatpak-builder icon indicating copy to clipboard operation
flatpak-builder copied to clipboard

[Bug]: flatpak-builder is happy to delete the current directory

Open allisonkarlitskaya opened this issue 3 years ago • 0 comments

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

  1. Start in the source directory of the project you're working on
  2. Try to remember how to run flatpak-builder. Something about --force-clean --user --install or so, I think?
  3. See the --help output mentions that you need to give mandatory DIRECTORY and MANIFEST options.
  4. Perhaps having used Docker a couple of times, try giving . for the DIRECTORY argument.

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:

allisonkarlitskaya avatar Jun 10 '22 16:06 allisonkarlitskaya