ouch icon indicating copy to clipboard operation
ouch copied to clipboard

Always use temporary extration path

Open valoq opened this issue 6 months ago • 2 comments

Currently ouch creates a temporary directory (.tmp-ouch-XXXXXX) for extraction in case of most file formats unless the -d option is used to directly specify a output directory. However for some formats, the extraction is done in a temporary directory in /tmp/tmpXXXXX or directly inside the current working directory itself

The use of temporary directories should be aligned to use the same path for all formats and this temporary path should be defined globally instead of inside specific archive format functions

If all extraction were to take place inside a temporary directory within the current working directory before they are renamed to the actual archive directory name, landlock restriction can be made more effective as explained here: https://github.com/ouch-org/ouch/issues/723#issuecomment-3016626507

valoq avatar Jun 29 '25 12:06 valoq

[This line](https://github.com/ouch-org/ouch/tree/main/src](https://github.com/ouch-org/ouch/blob/945ffde551848b7e8c92e6f4de7483b0f339a5de/src/commands/decompress.rs#L216) seems like duplicate code to me anyway. Why is the creation of a temporary directory done separately for rar?

valoq avatar Jun 29 '25 12:06 valoq

I apologize for my absence.

Thanks for suggesting this, @vrmiguel recently suggested (in DMs) getting rid of the smart unpack, that'd help with landlock similar to having a fixed global tempdir.

marcospb19 avatar Nov 21 '25 04:11 marcospb19