I ask this question because I'd like to be able to unpack an archive that may also contain the very program that is calling 7zip to unpack the archive. Linux/UNIX allows a file to be deleted or renamed while it's in use, but does not allow it to be opened for writing.
The answer is yes and no.
With the extract command for 7zip there should not be a temp file created. This does happen on Windows though when using Windows Explorer drag and drop (taken from documentation at http://www.7-zip.org/faq.html, ctl-f search for temp).
You are on Linux though.
To be 100% sure that this does not happen on Linux I created and then extracted a large archive and ran the program through strace:
strace -a88 -- 7z e byob.7z 2>&1
I only saw the existing files in the current working directory unlinked before overwrite and the only files accessed were files in the current working directory.
Please test for yourself to verify that I did not miss something.
I hope that this helps you.
Your question is about executable (or script)
file1, calling a mechanism that creates a new
file1 (in the same place).
From what I understand about file-systems on Unix, this calls for a clobber of
file1 while it is open (for execution). The way this happens is, the clobber causes original
file1 to be unlinked but since it is open it does not really get removed. It however no longer occupies the name
file1 in that directory. The new
file1 is created in a separate location (using the correct name). When the older
file1 completes execution and exits, it is deleted. You should be left with the new
file1 existing though.
Caveat: This is largely guesswork based on my partial knowledge. Maybe someone here with more file-systems concepts will affirm or correct it. Meanwhile, I suggest you take this answer only as a theoretical one and not base your solutions on it without further experimental verification.