[PATCH] configure: fix mktemp call for macOS

classic Classic list List threaded Threaded
6 messages Options
Ralph Seichter-2 Ralph Seichter-2
Reply | Threaded
Open this post in threaded view
|

[PATCH] configure: fix mktemp call for macOS

The mktemp call in configure is incompatible with /usr/bin/mktemp as
shipped with macOS, where it fails due to a missing parameter. I added
the missing template, and the call is now working with both Apple's
and GNU coreutils' mktemp.

Signed-off-by: Ralph Seichter <[hidden email]>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 8b80f0e0..feebafcc 100755
--- a/configure
+++ b/configure
@@ -529,7 +529,7 @@ int main () {
     return 0;
 }
 EOF
-    if ! TEMP_GPG=$(mktemp -d); then
+    if ! TEMP_GPG=$(mktemp -d /tmp/notmuch.XXXXXX); then
         printf 'No.\nCould not make tempdir for testing session-key support.\n'
         errors=$((errors + 1))
     elif ${CC} ${CFLAGS} ${gmime_cflags} _check_session_keys.c ${gmime_ldflags} -o _check_session_keys \
--
2.21.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] configure: fix mktemp call for macOS

Ralph Seichter <[hidden email]> writes:

> The mktemp call in configure is incompatible with /usr/bin/mktemp as
> shipped with macOS, where it fails due to a missing parameter. I added
> the missing template, and the call is now working with both Apple's
> and GNU coreutils' mktemp.
>

I'm hoping Tomi will comment, but I wonder if we should do something
like

TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX")

(borrowed from test/test-lib.sh). This avoids hardcoding the temporary
directory.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Ralph Seichter-2 Ralph Seichter-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] configure: fix mktemp call for macOS

* David Bremner:

> TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX")
>
> (borrowed from test/test-lib.sh). This avoids hardcoding the temporary
> directory.

I had the same thought at first, but I want to ensure that the path
length does not cause trouble anymore.

  > uname -v
  Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64
  > echo $TMPDIR
  /var/folders/m_/w5lk3r_1495dhnl4l0s96pr00000gn/T/

That's my MacBook Pro with macOS 10.14.5 (Mojave). AFAIK, older versions
can have longer names. Also, I am concerned with accumulating clutter.

  > grep clean_tmps_dirs /etc/defaults/periodic.conf
  daily_clean_tmps_dirs="/tmp"

The /tmp directory will, with default settings, be cleaned periodically
by the OS, while $TMPDIR (which is user-specific) will not.

-Ralph
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Tomi Ollila-2 Tomi Ollila-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] configure: fix mktemp call for macOS

On Fri, Jun 14 2019, Ralph Seichter wrote:

> * David Bremner:
>
>> TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX")
>>
>> (borrowed from test/test-lib.sh). This avoids hardcoding the temporary
>> directory.
>
> I had the same thought at first, but I want to ensure that the path
> length does not cause trouble anymore.

Yes. $TMPDIR could be problematic if it makes the full (unix domain
socket?) path be too long.

SO, exact version Ralph made looks good to me.

Tomi


>
>   > uname -v
>   Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64
>   > echo $TMPDIR
>   /var/folders/m_/w5lk3r_1495dhnl4l0s96pr00000gn/T/
>
> That's my MacBook Pro with macOS 10.14.5 (Mojave). AFAIK, older versions
> can have longer names. Also, I am concerned with accumulating clutter.
>
>   > grep clean_tmps_dirs /etc/defaults/periodic.conf
>   daily_clean_tmps_dirs="/tmp"
>
> The /tmp directory will, with default settings, be cleaned periodically
> by the OS, while $TMPDIR (which is user-specific) will not.
>
> -Ralph
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Tomi Ollila-2 Tomi Ollila-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] configure: fix mktemp call for macOS

On Fri, Jun 14 2019, Tomi Ollila wrote:

> On Fri, Jun 14 2019, Ralph Seichter wrote:
>
>> * David Bremner:
>>
>>> TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX")
>>>
>>> (borrowed from test/test-lib.sh). This avoids hardcoding the temporary
>>> directory.
>>
>> I had the same thought at first, but I want to ensure that the path
>> length does not cause trouble anymore.
>
> Yes. $TMPDIR could be problematic if it makes the full (unix domain
> socket?) path be too long.
>
> SO, exact version Ralph made looks good to me.


Revert that. mktemp(1) uses $TMPDIR if defined (and just tested)

>
> Tomi
>
>
>>
>>   > uname -v
>>   Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64
>>   > echo $TMPDIR
>>   /var/folders/m_/w5lk3r_1495dhnl4l0s96pr00000gn/T/
>>
>> That's my MacBook Pro with macOS 10.14.5 (Mojave). AFAIK, older versions
>> can have longer names. Also, I am concerned with accumulating clutter.
>>
>>   > grep clean_tmps_dirs /etc/defaults/periodic.conf
>>   daily_clean_tmps_dirs="/tmp"
>>
>> The /tmp directory will, with default settings, be cleaned periodically
>> by the OS, while $TMPDIR (which is user-specific) will not.
>>
>> -Ralph
>> _______________________________________________
>> notmuch mailing list
>> [hidden email]
>> https://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] configure: fix mktemp call for macOS

In reply to this post by Tomi Ollila-2
On Fri 2019-06-14 20:57:07 +0300, Tomi Ollila wrote:

> Yes. $TMPDIR could be problematic if it makes the full (unix domain
> socket?) path be too long.

Modern, maintained version of GnuPG will only place sockets directly in
the $GNUPGHOME if /run/user/$(id -u) (i.e., $XDG_RUNTIME_DIR) is not
available.

I've just sent a message to gnupg-devel asking for help from upstream
there, this shouldn't be this complicated.  see
id:[hidden email] on [hidden email] ("safe
ephemeral GnuPG homdirs").

          --dkg

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (233 bytes) Download Attachment