Portable mktemp calls in the tests

Martin Schwenke martin at meltin.net
Fri Dec 22 05:55:28 UTC 2017


I'm walking home so can't check right now, but...

Is -t deprecated in Linux? My memory of the source code tells me it is but 
I'm not sure how clear the documentation is.

Isn't it amazing how the simplest changes are really hard when you start 
taking about portability? :-\

peace & happiness,
martin



On 22 December 2017 16:47:00 "Timur I. Bakeyev" <timur at freebsd.org> wrote:

> 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