From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#19140: dir-locals-collect-variables discrepancy in handling non-file buffers Date: Mon, 19 Jan 2015 08:55:43 +0000 Message-ID: <87y4ozrvxs.fsf@violet.siamics.net> References: <87zjbky1kr.fsf@violet.siamics.net> <87egrg9b0q.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1421657776 25404 80.91.229.3 (19 Jan 2015 08:56:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Jan 2015 08:56:16 +0000 (UTC) To: 19140@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 19 09:56:13 2015 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 1YD883-0006a4-Gp for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Jan 2015 09:56:11 +0100 Original-Received: from localhost ([::1]:36145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YD882-00063m-Vo for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Jan 2015 03:56:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YD87y-00063g-Kc for bug-gnu-emacs@gnu.org; Mon, 19 Jan 2015 03:56:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YD87v-0006zP-EY for bug-gnu-emacs@gnu.org; Mon, 19 Jan 2015 03:56:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YD87u-0006zA-WA for bug-gnu-emacs@gnu.org; Mon, 19 Jan 2015 03:56:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YD87u-00049B-GP for bug-gnu-emacs@gnu.org; Mon, 19 Jan 2015 03:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Jan 2015 08:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19140 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 19140-submit@debbugs.gnu.org id=B19140.142165775815929 (code B ref 19140); Mon, 19 Jan 2015 08:56:02 +0000 Original-Received: (at 19140) by debbugs.gnu.org; 19 Jan 2015 08:55:58 +0000 Original-Received: from localhost ([127.0.0.1]:60973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YD87p-00048p-Gx for submit@debbugs.gnu.org; Mon, 19 Jan 2015 03:55:57 -0500 Original-Received: from fely.am-1.org ([78.47.74.50]:50017) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YD87n-00048g-0b for 19140@debbugs.gnu.org; Mon, 19 Jan 2015 03:55:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=OJI6aRPNT7JqtDkAedHuc0E2M+kFNbKD8lN/cyiCBB8=; b=A5y62wflDpCb+w/7Me3XYxC8KEf4JlS9enn0zKO5KShfMpXzMAg9uY7y6nUY8CKTaH6UJB0hodMfB7BBK4r3o1vzFX43Bgak89Ihuhb9gJoeNCsboibh1a7IaSqfGl8by6abolWepdE/VxMmHc8EYYd08Gw5H0aZpxueHdHvTY4=; Original-Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YD87k-0004ky-DC for 19140@debbugs.gnu.org; Mon, 19 Jan 2015 08:55:53 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YD87c-0005fG-OK for 19140@debbugs.gnu.org; Mon, 19 Jan 2015 15:55:44 +0700 Mail-Followup-To: 19140@debbugs.gnu.org In-Reply-To: (Katsumi Yamaoka's message of "Mon, 19 Jan 2015 16:30:05 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:98464 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> Katsumi Yamaoka writes: >>>>> On Tue, 30 Dec 2014 19:45:57 +0000, Ivan Shmakov wrote: [=E2=80=A6] >> * lisp/files.el (dir-locals-collect-variables): Use >> default-directory in place of the file name while working on >> non-file buffers (as hack-dir-local-variables already does.) > After this change, I got to get unknown errors[1] when building > Ma Gnus. To reproduce the same result, try the following in the > Emacs source tree: > % cd lisp/gnus=20 > % emacs -batch -Q --eval FORM=20 > where FORM is: > '(with-temp-buffer (let ((default-directory (expand-file-name "."))) > (insert-file-contents "./auth-source.el") (hack-local-variables)))' > And you will see > (args-out-of-range "/DIR/emacs/lisp/gnus" 21 nil) > or something similar (where 21 is 1+ the number of letters of the dir > name). > The FORM above is what `custom-make-dependencies' does. ACK, thanks. Indeed, this change assumes that the result for (expand-file-name default-directory) ends with a =E2=80=98/=E2=80=99, yet = that=E2=80=99s only the case when default-directory itself ends with a =E2=80=98/=E2=80= =99, which I believe it should; consider, e. g.: (defun cd-absolute (dir) "Change current directory to given absolute file name DIR." ;; Put the name into directory syntax now, ;; because otherwise expand-file-name may give some bad results. (setq dir (file-name-as-directory dir)) =E2=80=A6) The issue at hand could be solved by using the first of the patches MIMEd. However, I believe that such a change may easily mask bugs in the other parts of the code, so the proper solution would probably be a fix to custom-make-dependencies, as per the second patch MIMEd. Could you please check if both indeed resolve the issue at hand? TIA. [=E2=80=A6] --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/lisp/files.el 2015-01-17 19:02:00 +0000 +++ b/lisp/files.el @@ -3604,7 +3604,8 @@ defun dir-locals-collect-variables (class-variables root variables) Return the new variables list." (let* ((file-name (or (buffer-file-name) ;; Handle non-file buffers, too. - (expand-file-name default-directory))) + (file-name-as-directory + (expand-file-name default-directory)))) (sub-file-name (if file-name ;; FIXME: Why not use file-relative-name? (substring file-name (length root))))) --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/lisp/cus-dep.el 2015-01-01 22:26:41 +0000 +++ b/lisp/cus-dep.el 2015-01-19 08:49:23 +0000 @@ -62,7 +62,8 @@ defun custom-make-dependencies () (while (setq subdir (pop command-line-args-left)) (message "Directory %s" subdir) (let ((files (directory-files subdir nil "\\`[^=.].*\\.el\\'")) - (default-directory (expand-file-name subdir)) + (default-directory + (file-name-as-directory (expand-file-name subdir))) (preloaded (concat "\\`\\(\\./+\\)?" (regexp-opt preloaded-file-list t) "\\.el\\'"))) --=-=-=--