From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Engster Newsgroups: gmane.emacs.bugs Subject: bug#11981: 24.1.50; url-http-parse-headers should not disable file name handlers since it breaks auth-source Date: Sat, 21 Jul 2012 16:31:18 +0200 Message-ID: <87d33p9oeh.fsf@engster.org> References: <87eho8didj.fsf@engster.org> <87394otg13.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1342881110 31447 80.91.229.3 (21 Jul 2012 14:31:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 21 Jul 2012 14:31:50 +0000 (UTC) Cc: 11981@debbugs.gnu.org, Michael Albinus To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 21 16:31:50 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ssaif-000688-L5 for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Jul 2012 16:31:45 +0200 Original-Received: from localhost ([::1]:58728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ssaie-0002QM-Pv for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Jul 2012 10:31:44 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ssaib-0002QE-GD for bug-gnu-emacs@gnu.org; Sat, 21 Jul 2012 10:31:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ssaia-00018y-9y for bug-gnu-emacs@gnu.org; Sat, 21 Jul 2012 10:31:41 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsaiZ-00018f-NU for bug-gnu-emacs@gnu.org; Sat, 21 Jul 2012 10:31:40 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Ssaok-000859-7E for bug-gnu-emacs@gnu.org; Sat, 21 Jul 2012 10:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Engster Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Jul 2012 14:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11981 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11981-submit@debbugs.gnu.org id=B11981.134288147031049 (code B ref 11981); Sat, 21 Jul 2012 14:38:02 +0000 Original-Received: (at 11981) by debbugs.gnu.org; 21 Jul 2012 14:37:50 +0000 Original-Received: from localhost ([127.0.0.1]:55256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SsaoY-00084k-50 for submit@debbugs.gnu.org; Sat, 21 Jul 2012 10:37:50 -0400 Original-Received: from randomsample.de ([83.169.19.17]:43567) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SsaoV-00084c-RC for 11981@debbugs.gnu.org; Sat, 21 Jul 2012 10:37:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From; bh=w5DnA4JDWvTjlJgXswLkcZgN9v644K7I2Juy5ALInYM=; b=OZrKlx8zgXbhOKtwQjLKmMvcmLFXzrnhCtjvvJZl2WlgnMa87JR4Lzwq43a6yGhw4JslWYZURNIniEIwfb9PQSJNYr6oBNQ2oQdFkuYlvYEjZF5UgmFQFN8kt5NY707b; Original-Received: from dslc-082-083-063-098.pools.arcor-ip.net ([82.83.63.98] helo=spaten) by randomsample.de with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1SsaiF-0008Nd-JS; Sat, 21 Jul 2012 16:31:20 +0200 In-Reply-To: (David Engster's message of "Thu, 19 Jul 2012 14:51:07 +0200") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62242 Archived-At: --=-=-= Content-Type: text/plain David Engster writes: > Stefan Monnier writes: >>>> However, this workaraound assumes that everything that gets afterwards >>>> in the `let'-section does not depend on file name handlers. However, >>>> this is not the case: `url-http-handle-authentication' is called which > >>>> in turn calls the auth-source package. This package however supports >>>> encrypted authinfo files which have to be automatically decrypted >>>> through `auto-encryption-mode'. This, of course, works through file name >>>> handlers. >>> Does it work, if Tramp is disabled instead? >> >> I think I'd first like to better understand bug#6717: why do we take >> a local part of a URL, let it start with / and then pass it to >> file-name-directory? That sounds like a problem in itself. > > I agree. I wonder which call to `file-name-directory' threw the error in > the original report - the most likely candidate is `url-file-directory', > which should simply be rewritten to not use `file-name-directory'. Patch attached. It even fixes another bug along the way: `url-file-(non)directory' would not work on hexified URLs. I'm not 100% sure this also fixes bug #6717; it might be that there's another file-* call lurking somewhere. -David --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=url-util-diff.patch === modified file 'lisp/url/url-util.el' --- lisp/url/url-util.el 2012-07-11 23:13:41 +0000 +++ lisp/url/url-util.el 2012-07-21 14:25:59 +0000 @@ -246,18 +246,24 @@ "Return the directory part of FILE, for a URL." (cond ((null file) "") - ((string-match "\\?" file) - (file-name-directory (substring file 0 (match-beginning 0)))) - (t (file-name-directory file)))) + ((string-match "\\(\\?\\|%3[fF]\\)" file) + (url-file-directory (substring file 0 (match-beginning 0)))) + ((string-match "\\(.*\\(/\\|%2[fF]\\)\\)" file) + (match-string 1 file)) + (t + ""))) ;;;###autoload (defun url-file-nondirectory (file) "Return the nondirectory part of FILE, for a URL." (cond ((null file) "") - ((string-match "\\?" file) - (file-name-nondirectory (substring file 0 (match-beginning 0)))) - (t (file-name-nondirectory file)))) + ((string-match "\\(\\?\\|%3[fF]\\)" file) + (url-file-nondirectory (substring file 0 (match-beginning 0)))) + ((string-match ".*\\(?:/\\|%2[fF]\\)\\(.*\\)" file) + (match-string 1 file)) + (t + ""))) ;;;###autoload (defun url-parse-query-string (query &optional downcase allow-newlines) --=-=-=--