Portable mktemp calls in the tests
Martin Schwenke
martin at meltin.net
Fri Dec 22 04:05:33 UTC 2017
Hi Timur,
On Fri, 22 Dec 2017 02:49:48 +0100, "Timur I. Bakeyev via
samba-technical" <samba-technical at lists.samba.org> wrote:
> Here is another piece of puzzle of making samba autobuild work out of the
> box on FreeBSD.
>
> There are plenty of places in the tests where 'mktemp` is called with
> '--tempdir' or '-p' parameter, which are not recognized on FreeBSD(and,
> possibly other Unix-like platforms).
>
> This call can be safely replaced with the sequence:
>
> $(TMPDIR="$TEST_VAR_DIR" mktemp -d)
First the long-winded rant about poor documentation... :-)
I have a *minor* concern because neither the Linux nor FreeBSD manpages
for mktemp(1) clearly document the general use of TMPDIR. Use of TMPDIR
is documented in the context of the -t option (and, for Linux, the -p
option).
The FreeBSD manpage and Linux info page each have an example that I
would regard as implying general use of TMPDIR to override the use
of /tmp.
That said, it clearly works on most Unix-related platforms. Testing
under Linux shows that mktemp uses TMPDIR in general cases and a glance
at the source code confirms this.
Given that I don't know how to write texinfo documentation, I've opened
a bug (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29807) against the
GNU coreutils package to try to get this documented. I would encourage
you to do the same for FreeBSD's mktemp.
All that said, even though the documentation of mktemp is poor, I think
this is an improvement and would be happy to give it a positive
review.
However, can you please remove the following change (and those related
to it) from the mktemp commit?
-cat >$tmpeditor <<-'EOF'
+cat >${tmpeditor}.sh <<-'EOF'
If you really meant to do that then can you please make that change
in a separate commit? :-)
Thanks...
peace & happiness,
martin
More information about the samba-technical
mailing list