Gnus development mailing list
 help / color / mirror / Atom feed
* {PATCH] minor gpg.el fix for MS Windows
@ 2002-04-30 15:11 Dmitry Bely
  2002-04-30 15:24 ` Florian Weimer
  2002-04-30 15:47 ` Kai Großjohann
  0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Bely @ 2002-04-30 15:11 UTC (permalink / raw)
  Cc: Florian Weimer

Index: gpg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/contrib/gpg.el,v
retrieving revision 1.18
diff -u -r1.18 gpg.el
--- gpg.el	2002/01/25 18:00:44	1.18
+++ gpg.el	2002/04/30 15:11:55
@@ -218,7 +218,9 @@
   :group 'gpg-options)
 
 (defcustom gpg-temp-directory 
-  (expand-file-name "~/tmp")
+  (if (memq system-type '(windows-nt cygwin32 win32 w32 mswindows))
+      (temp-directory)
+    (expand-file-name "~/tmp"))
   "Directory for temporary files.
 If you are running Emacs 20, this directory must have mode 0700."
   :tag "Temp directory"

Hope to hear from you soon,
Dmitry



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: {PATCH] minor gpg.el fix for MS Windows
  2002-04-30 15:11 {PATCH] minor gpg.el fix for MS Windows Dmitry Bely
@ 2002-04-30 15:24 ` Florian Weimer
  2002-04-30 16:45   ` Dmitry Bely
  2002-04-30 15:47 ` Kai Großjohann
  1 sibling, 1 reply; 7+ messages in thread
From: Florian Weimer @ 2002-04-30 15:24 UTC (permalink / raw)


Dmitry Bely <dbely@mail.ru> 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"))
>    "Directory for temporary files.
>  If you are running Emacs 20, this directory must have mode 0700."
>    :tag "Temp directory"

I'm not sure if this is correct.  Is 'temp-directory' really available
on Windows?  It's not documented in the Lisp manual.

In addition, what about multi-user versions of Windows?  Is this a
shared directory?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: {PATCH] minor gpg.el fix for MS Windows
  2002-04-30 15:11 {PATCH] minor gpg.el fix for MS Windows Dmitry Bely
  2002-04-30 15:24 ` Florian Weimer
@ 2002-04-30 15:47 ` Kai Großjohann
  2002-04-30 16:33   ` Dmitry Bely
  1 sibling, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2002-04-30 15:47 UTC (permalink / raw)
  Cc: ding, Florian Weimer

Dmitry Bely <dbely@mail.ru> 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'."
  (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?

kai
-- 
Silence is foo!



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: {PATCH] minor gpg.el fix for MS Windows
  2002-04-30 15:47 ` Kai Großjohann
@ 2002-04-30 16:33   ` Dmitry Bely
  2002-04-30 16:48     ` Kai Großjohann
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Bely @ 2002-04-30 16:33 UTC (permalink / raw)
  Cc: ding, Florian Weimer

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: {PATCH] minor gpg.el fix for MS Windows
  2002-04-30 15:24 ` Florian Weimer
@ 2002-04-30 16:45   ` Dmitry Bely
  2002-04-30 16:50     ` Dmitry Bely
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Bely @ 2002-04-30 16:45 UTC (permalink / raw)


Florian Weimer <fw@deneb.enyo.de> writes:

> Dmitry Bely <dbely@mail.ru> 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"))
>>    "Directory for temporary files.
>>  If you are running Emacs 20, this directory must have mode 0700."
>>    :tag "Temp directory"
>
> I'm not sure if this is correct.  Is 'temp-directory' really available
> on Windows?  It's not documented in the Lisp manual.

Kai already explained that it exists only in XEmacs (no matter Unix or
Windows). Sorry.

> In addition, what about multi-user versions of Windows?  Is this a
> shared directory?

Yes, sure. Every user in WinNT and above has its own temp directory, which
is not readable by anybody else. TEMP environment variable points to that
directory and (temp-directory) in XEmacs/NT returns just that. Probably
"temporary-file-directory" variable in Emacs/NT behaves the same way.

Hope to hear from you soon,
Dmitry



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: {PATCH] minor gpg.el fix for MS Windows
  2002-04-30 16:33   ` Dmitry Bely
@ 2002-04-30 16:48     ` Kai Großjohann
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Großjohann @ 2002-04-30 16:48 UTC (permalink / raw)
  Cc: ding, Florian Weimer

Dmitry Bely <dbely@mail.ru> writes:

> 1. I don't know about Emacs, but in XEmacs (temp-directory) does all this
> job itself.

Look again: if temp-directory is fboundp, we call it.  If the
variable temporary-file-directory is bound, it's taken (modern
Emacsen).  The rest is just fallback.

kai
-- 
Silence is foo!



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: {PATCH] minor gpg.el fix for MS Windows
  2002-04-30 16:45   ` Dmitry Bely
@ 2002-04-30 16:50     ` Dmitry Bely
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Bely @ 2002-04-30 16:50 UTC (permalink / raw)


Dmitry Bely <dbely@mail.ru> writes:

>> In addition, what about multi-user versions of Windows?  Is this a
>> shared directory?
>
> Yes, sure.

Sorry once again. Read this as "No way!!!" :-)

> Every user in WinNT and above has its own temp directory,

Hope to hear from you soon,
Dmitry



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-04-30 16:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-30 15:11 {PATCH] minor gpg.el fix for MS Windows 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
2002-04-30 16:48     ` Kai Großjohann

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).