Gnus development mailing list
 help / color / mirror / Atom feed
From: Dmitry Bely <dbely@mail.ru>
Cc: ding@gnus.org, Florian Weimer <fw@deneb.enyo.de>
Subject: Re: {PATCH] minor gpg.el fix for MS Windows
Date: Tue, 30 Apr 2002 20:33:58 +0400	[thread overview]
Message-ID: <elgxgn7t.fsf@mail.ru> (raw)
In-Reply-To: <vafelgxtch1.fsf@INBOX.auto.gnus.tok.lucy.cs.uni-dortmund.de> (Kai.Grossjohann@CS.Uni-Dortmund.DE's message of "Tue, 30 Apr 2002 17:47:38 +0200")

Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Grossjohann) writes:

>>  (defcustom gpg-temp-directory 
>> -  (expand-file-name "~/tmp")
>> +  (if (memq system-type '(windows-nt cygwin32 win32 w32 mswindows))
>> +      (temp-directory)
>> +    (expand-file-name "~/tmp"))
>
> I use the following code to get a temp directory in Tramp:
>
> (defun tramp-temporary-file-directory ()
>   "Return name of directory for temporary files (compat function).
> For Emacs, this is the variable `temporary-file-directory', for XEmacs
> this is the function `temp-directory'."

I did not know that "temp-directory" function does not exist in
Emacs. Sorry.

>   (cond ((boundp 'temporary-file-directory)
>          (symbol-value 'temporary-file-directory))
>         ((fboundp 'temp-directory)
>          (funcall (symbol-function 'temp-directory))) ;pacify byte-compiler
>         ((let ((d (getenv "TEMP"))) (and d (file-directory-p d)))
>          (file-name-as-directory (getenv "TEMP")))
>         ((let ((d (getenv "TMP"))) (and d (file-directory-p d)))
>          (file-name-as-directory (getenv "TMP")))
>         ((let ((d (getenv "TMPDIR"))) (and d (file-directory-p d)))
>          (file-name-as-directory (getenv "TMPDIR")))
>         ((file-exists-p "c:/temp") (file-name-as-directory "c:/temp"))
>         (t (message (concat "Neither `temporary-file-directory' nor "
>                             "`temp-directory' is defined -- using /tmp."))
>            (file-name-as-directory "/tmp"))))
>
> Opinions?

For me it's basically OK but

1. I don't know about Emacs, but in XEmacs (temp-directory) does all this
job itself.
2. For the crypto stuff (gpg.el) such general purpose function is not very
good: for Unix it returns "/tmp" directory by default, which is world
readable. Just imagine what can happen with your top secret mail :-) I
think what's why Florian uses "~/tmp" instead. On the other side, it's OK
for WinNT, because its TEMP environment variable points to the directory
that is unique for every user and is not readable by anybody else. So
something like

(defcustom gpg-temp-directory 
  (if (memq system-type '(windows-nt cygwin32 win32 w32 mswindows))
      (something-like-your-function-above)
    (expand-file-name "~/tmp"))
  ...

IMHO would make sense.

Hope to hear from you soon,
Dmitry





  reply	other threads:[~2002-04-30 16:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-30 15:11 Dmitry Bely
2002-04-30 15:24 ` Florian Weimer
2002-04-30 16:45   ` Dmitry Bely
2002-04-30 16:50     ` Dmitry Bely
2002-04-30 15:47 ` Kai Großjohann
2002-04-30 16:33   ` Dmitry Bely [this message]
2002-04-30 16:48     ` Kai Großjohann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=elgxgn7t.fsf@mail.ru \
    --to=dbely@mail.ru \
    --cc=ding@gnus.org \
    --cc=fw@deneb.enyo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).