Portable mktemp calls in the tests

Timur I. Bakeyev timur at freebsd.org
Fri Dec 22 05:46:24 UTC 2017


On Fri, Dec 22, 2017 at 5:55 AM, Martin Schwenke <martin at meltin.net> wrote:

> On Fri, 22 Dec 2017 05:43:31 +0100, "Timur I. Bakeyev"
> <timur at freebsd.org> wrote:
>
> > Thanks for the positive feedback!
> >
> > On Fri, Dec 22, 2017 at 5:05 AM, Martin Schwenke <martin at meltin.net>
> wrote:
>
> Oh, sorry!  I missed the --suffix part.  Instead of changing all of the
> lines that use this variable I would suggest simply adding an extra
> line (after the changed line) that says:
>
>   tmpeditor="${tmpeditor}.sh"
>

Sounds smarter way of doing it :)

Note there's another problem!  Where a template is used (and,
> therefore, non-option arguments are present) TMPDIR is *not* used (at
> least in GNU coreutils).  Therefore, the above will create the file in
> the current directory!  The obvious solution is to do something like:
>
>   tmpeditor=$(mktemp "$STpath/bin/samba-tool-editor-XXXXXXXX")
>   tmpeditor="${tempeditor}.sh"
>

I've tested it, but seems to forgot to properly add it everywhere...

Seems, construction like:

TMPDIR=/var/tmp mktemp -t blah-xxxxx

Note '-t' flag ^

Works both for FreeBSD and Linux(at least, Debian) as intended. Creation of
directories
with extra '-d' also works.

So, let me re-send updated patch.

With best regards,
Timur Bakeyev.


More information about the samba-technical mailing list