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

Re: [RFC] adding zmktemp command




On 3/28/2019 10:36 AM, Oliver Kiddle wrote:
Clinton Bunch wrote:
I'm thinking of adding a zmktemp command either in a new module (e.g.
The advantage I can see to being it's own module, is it could be
backported and separately packed for Long-Term Supported OS. (Mostly
thinking of Enterprise Linux distributions)
I doubt you'd be able to persuade such distributions to include even a
completely new and separate module.

But it also seems like it would be a good fit into the zsh/files module
(mktemp and zf_mktemp instead of zmktemp)
zsh/files would mostly make sense for a mktemp builtin that closely
follows the interface of the normal mktemp Unix utility. If the focus is
to provide a consistent and convenient way to create temporary files,
then following mktemp is perhaps not the best choice. For security
reasons, an interface that returns a file handle is, I think, generally
preferred these days. Perhaps sysopen (in zsh/system) could accept a -t
option instead of a filename.

Oliver

I was planning on adding a -f option to return a fd in a parameter.  The sysopen solution though wouldn't give you the filename which would mean you couldn't pass it to an external program.  I realize that that has some security issues which is why an unpredictable filename is needed.



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