unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: <emacs@kosowsky.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: tzz@lifelogs.com, emacs@kosowsky.org, 15648@debbugs.gnu.org
Subject: bug#15648: 24.2.50; gnutls SSL connection to IMAP server causes emacs to crash	completely, bug#15648: 24.2.50; gnutls SSL connection to IMAP server causes emacs to crash completely
Date: Wed, 23 Oct 2013 15:49:46 -0400	[thread overview]
Message-ID: <21096.10330.57872.224325@consult.pretender> (raw)
In-Reply-To: <83hac7j2a2.fsf@gnu.org>

Eli Zaretskii wrote at about 21:00:21 +0300 on Wednesday, October 23, 2013:
 > > From: <emacs@kosowsky.org>
 > > Date: Wed, 23 Oct 2013 13:12:56 -0400
 > > Cc: emacs@kosowsky.org, tzz@lifelogs.com, 15648@debbugs.gnu.org
 > > 
 > > 4. This small patch to gnutls.el will fix the problem by expanding the
 > > file name to a full, valid path:
 > 
 > Sorry, but I cannot accept this.  There's absolutely no reason to run
 > the file through expand-file-name at that place.

There is a *great* reason to add expand-file-name *any* time you pass
a file name or path to external C-code that references the file
system.

This is necessary (and should be best or even required practice) since
Emacs by design may include various filehandlers (like cygwin-mount)
that internally translate path names before accessing the file system
while external C-code has no way of knowing that the path names need
transformation. This is particularly important since the Emacs
filehandlers may be turned on and off or changed at will or
dynamically and the C-code can't possibly know that, so it can't
possibly know how and when to perform the required file handling
operations to access the file system.

Thus, I would argue that it is best practice to use expand-file-name
whenever a file path is passed from Emacs lisp to C-code to ensure
that a system valid (absolute) path is ultimately passed to the file
system independent of how Emacs may be translating paths internally.

 > More importantly, there's no reason to believe this is the only
 > place where the same problem could surface.

There is a wonderful reason to so believe since It is the only place
that gnutls-trustfiles is referenced... hence, it is the natural place to
fix it.

It's pretty simple. You really have only 3 choices:

1. Only allow path names in gnutls-trustfiles that are native and
   understandable as-is to the machine.  In particular, this would
   mean deleting the default gnutls-turstfiles cgywin entry since it
   is written relative to cygwin root which is not known to the C-code
   or to the system. Note that making the path hard-wired absolute
   wouldn't work for cygwin since while cygwin root is typically
   C:\cygwin, it need not be.. Of course, deleting the cygwin entry is
   reasonable, if you don't care about supporting cygwin by default

2. Add my patch or a similar to ensure that a valid path is always
   passed to the C-code -- whether one is using cygwin mount or any
   other code that changes how Emacs translates path names.  This
   approach is simple and non-harmful, should always work, and in
   general protects the C-code from being passed a non-valid path.

3. Modify the C-code to include cygwin-mount type functionality so
   that the cygwin root is prepended to cygwin style path names. This
   is probably not an easy or practical solution since it requires
   changing the compiled C-library with calls to various cygwin
   functions and libraries. Also, it would only work for the file
   handler modifications of cygwin-mount and not to other possible
   file handlers -- thus modifying the C-code would be brittle,
   non-general, and non-portable.

Leaving it as-is shouldn't be an acceptable solution since without
cygwin-mount, the cygwin entry is meaningless and is *never* used --
so it's wasteful at best and confusing or crash-inducing at
worst. Even worse, with cygwin-mount, it causes a crash of the entire
Emacs process.

So, this is a BUG in the Emacs code -- it needs to be fixed!
If you don't like my fix, then feel free to find another...

Of course, there is still arguably a bug in the C-code since passing
an invalid path to the gnutls-boot C-code should not cause the entire
Emacs process to crash.

This bug should be easily reproducible by passing a cygwin path to
gnutls-boot under Windows

 > >  > Windows supports Unix-style file names.  The problem is that the file
 > >  > "/usr/ssl/certs/ca-bundle.crt" cannot be found by starting from the
 > >  > root directory of the current drive.
 > > 
 > > The above proposed patch would fix that problem.
 > 
 > Only by sheer luck.

Really? I can pretty much guarantee it will always fix the problem for
gnutls.el since there is no other reference to gnutls-trustfiles. The
alternative fix is to delete the cygwin entry.






  reply	other threads:[~2013-10-23 19:49 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 18:29 bug#15648: 24.2.50; gnutls SSL connection to IMAP server causes emacs to crash completely emacs
2013-10-18 19:38 ` Glenn Morris
2013-10-20 20:24   ` emacs
2013-10-21 14:22   ` bug#15648: 24.2.50; gnutls SSL connection to IMAP server causes emacs to crash completely, " Ted Zlatanov
2013-10-21 19:30     ` emacs
2013-10-22 13:27       ` Ted Zlatanov
2013-10-22 15:23         ` emacs
2013-10-22 15:41           ` emacs
2013-10-22 19:10             ` emacs
2013-10-22 20:06               ` Ted Zlatanov
2013-10-22 20:22                 ` emacs
2013-10-22 20:34                   ` Eli Zaretskii
2013-10-22 22:27               ` emacs
2013-10-23  2:51                 ` Eli Zaretskii
2013-10-23  4:17                 ` emacs
2013-10-23 14:52                   ` Ted Zlatanov
2013-10-23 17:25                     ` emacs
2013-10-23 18:07                       ` Eli Zaretskii
2013-10-23 18:58                         ` Ted Zlatanov
2013-10-23 23:45                           ` emacs
2013-10-24  0:13                             ` emacs
2013-10-24 10:59                             ` Ted Zlatanov
2013-10-24 14:10                               ` emacs
2013-10-24 15:48                                 ` Ted Zlatanov
2013-10-24 17:02                                   ` emacs
2013-10-24 17:57                                 ` Stefan Monnier
2013-10-24 18:42                                   ` emacs
2013-10-25  0:59                                     ` Stefan Monnier
2013-10-25 13:59                                       ` emacs
2013-10-26  1:52                                         ` Stefan Monnier
2013-10-29  5:13                                           ` emacs
2013-11-03 11:42                                           ` Ted Zlatanov
2013-11-03 15:12                                             ` emacs
2013-11-03 17:32                                               ` Eli Zaretskii
2013-11-03 19:12                                                 ` emacs
2013-11-04 16:28                                                 ` Ted Zlatanov
2013-11-04 16:58                                                   ` Eli Zaretskii
2013-11-11 19:12                                                     ` emacs
2013-11-11 19:42                                                       ` Ted Zlatanov
2013-11-11 20:00                                                         ` emacs
2013-11-11 20:00                                                         ` Achim Gratz
2013-11-11 23:58                                                           ` Ted Zlatanov
2013-11-12  0:45                                                             ` emacs
2013-11-11 20:06                                                       ` Eli Zaretskii
2013-11-11 21:53                                                         ` emacs
2013-11-12  3:56                                                           ` Eli Zaretskii
2013-11-12 15:19                                                             ` emacs
2013-11-12 17:42                                                               ` Eli Zaretskii
     [not found]                                                               ` <<83ppq51pq8.fsf@gnu.org>
2013-11-12 18:08                                                                 ` Drew Adams
2013-11-03 21:37                                             ` Stefan Monnier
2013-10-23 15:16                   ` bug#15648: 24.2.50; gnutls SSL connection to IMAP server causes emacs to crash completely, " Eli Zaretskii
2013-10-23 17:12                     ` emacs
2013-10-23 18:00                       ` Eli Zaretskii
2013-10-23 19:49                         ` emacs [this message]
2013-10-24  2:46                           ` Eli Zaretskii
2013-10-25  3:17                         ` emacs
2013-10-25 14:09                           ` Eli Zaretskii
2013-10-25 15:38                             ` Ted Zlatanov
2013-10-25 18:37                               ` Eli Zaretskii
2013-11-03 17:30                                 ` Eli Zaretskii
2013-11-04 16:44                                 ` Ted Zlatanov
2013-11-04 17:06                                   ` Eli Zaretskii
2013-11-04 18:05                                     ` Ted Zlatanov
2013-11-04 22:14                                       ` emacs
2013-11-05  2:30                                         ` Ted Zlatanov
2013-11-05 23:11                                           ` emacs
2013-11-05 23:16                                             ` Alp Aker
2013-11-05 23:54                                               ` emacs
2013-11-11 15:53                                                 ` Ted Zlatanov
2013-11-11 19:40                                                   ` emacs
2013-11-11 20:11                                                     ` Eli Zaretskii
2013-11-11 21:56                                                       ` emacs
2013-11-12  3:58                                                         ` Eli Zaretskii
2013-11-12 15:23                                                           ` emacs
2013-11-06  3:51                                             ` Eli Zaretskii
2013-11-06  5:45                                               ` emacs
2013-10-22 15:43         ` bug#15648: 24.2.50; gnutls SSL connection to IMAP server causes emacs to crash completely, " Eli Zaretskii
2013-10-22 20:03           ` Ted Zlatanov
2013-10-22 20:35           ` Andy Moreton
2013-10-22 20:45             ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=21096.10330.57872.224325@consult.pretender \
    --to=emacs@kosowsky.org \
    --cc=15648@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=tzz@lifelogs.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).