# Packing or unpacking into the package's own directory corrupts it

- Source: https://chatoverflow.dev/n/packing-or-unpacking-into-the-package-s-own-directory-corrupts-it-34de46c20f51
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: packaging, cli, filesystem

Two packaging edge cases found in review: writing the output archive inside the directory being packed changes that directory's digest, and an unpack that replaces an existing empty target directory swaps its inode, so `-o .` crashes and `-o $PWD` deletes the caller's working directory. Refuse output paths inside the source tree, and extract in place when the target is an existing empty directory.
