bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15648: 24.2.50; gnutls SSL connection to IMAP server causes emacs to


From: emacs
Subject: bug#15648: 24.2.50; gnutls SSL connection to IMAP server causes emacs to crash completely
Date: Fri, 25 Oct 2013 09:59:06 -0400

Stefan Monnier wrote at about 20:59:06 -0400 on Thursday, October 24, 2013:
 > I didn't mean to say that file-accessible-directory-p is the
 > right answer.  Only that something *like it* should be used.
 > I.e. a function specifically meant to give you some idea about whether
 > that file is known to the OS primitives.

....

 > 
 > You'd first have to define what kind of "canonicalizing" you want to do.
 > I think in the present case what you want is to turn an Elisp file name
 > into a file name understood by OS-level primitives (or nil if that
 > can't be done).  We don't have such a function right now.  So my
 > recommendation is to add such a function.
 > 

I'm surprised that such a function doesn't (yet) exist in Emacs...

But until such a function exists, one might want to consider the
following:

1. Adding expand-file-name will work for any file name that
   cygwin-mount is designed to address (this is by definition)

2. Similarly, adding expand-file-name will likely work for any other
   Magic File handler that works similar to cygwin-mount in terms of
   just converting paths but generally won't work with Magic File
   handlers that work on archives or compressed file formats

3. Adding expand-file-name shouldn't have any ill effect on paths that
   are not Magic files

To take account of the fact that expand-file-name may not give a valid
OS path for all Magic File handlers, I would suggest the following
slight modification to my originally suggested patch.

Basically, this version does 2 things:
1. Pre-expands the file name *if* there is a Magic File handler for that
   file path (this will do nothing if there is no handler for that path)

2. Tests file-exists-p with all Magic File handlers shut off which
   tests to make sure that the OS primitives will work on the actual
   file path that will be passed

--- gnutls.el   2013-03-17 13:52:40.000000000 -0400
+++ gnutls.el.new       2013-10-23 12:47:36.503554500 -0400
@@ -174,7 +174,8 @@
   (let* ((type (or type 'gnutls-x509pki))
          (trustfiles (or trustfiles
                          (delq nil
-                               (mapcar (lambda (f) (and f (file-exists-p f) f))
+                               (mapcar (lambda (f) 
+                                                                               
   (and f 
+                                                                               
     (if (find-file-name-handler f
                                                                                
                    'expand-file-name)
+                                                                               
                (setq f (expand-file-name f)))
+                                                                               
          (let (file-name-handler-alist)
+                                                  (file-exists-p f)) f))
                                        (if (functionp gnutls-trustfiles)
                                            (funcall gnutls-trustfiles)
                                          gnutls-trustfiles)))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]