Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Random file creation in zsh shell.



On Fri, Jun 16, 2023 at 11:36 PM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> On Sat, Jun 17, 2023 at 4:04 AM LitHack <lithack0@xxxxxxxxx> wrote:
> >
> > There is a way to create a random file in zsh shell by which we could hide any of our data in it.
>
> Is it expected for `=true < =()` to leave a temporary file behind?

When an =(...) temp file is created, the parent shell assigns removal
to the child job, which is supposed to happen when the job exits.  In
the case of a shell function or builtin, this works as expected.  In
the case of an external command or a subshell that performs a "tail
call optimization" like your "( exec true )" example, the thread
that's meant to remove the temp file is replaced by a new process and
the exit-handler that would remove the file is lost.

I've spent quite a while on and off in the past prodding at the code
in exec.c to try to convince it that when there is a temp file present
it should skip the execve() and instead fork()/wait() to be able to
remove the file at the end, but have never got it to work without
breaking something else.




Messages sorted by: Reverse Date, Date, Thread, Author