From unknown Tue Jun 17 22:10:51 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7872: Possible fix for relative pathnames given through the command line Resent-From: Roy Liu Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Jan 2011 02:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7872 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 7872@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.12954913797335 (code B ref -1); Thu, 20 Jan 2011 02:43:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Jan 2011 02:42:59 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PfkUE-0001uF-M4 for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:42:59 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PfkSV-0001rn-Qd for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:41:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pfka5-0008Ex-9a for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:49:02 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:57148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pfka5-0008Et-7K for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:49:01 -0500 Received: from [140.186.70.92] (port=38196 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pfka3-00089n-JI for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:49:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pfka2-0008EL-E9 for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:48:59 -0500 Received: from mail-pw0-f41.google.com ([209.85.160.41]:61869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pfka2-0008EA-9O for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:48:58 -0500 Received: by pwj8 with SMTP id 8so40316pwj.0 for ; Wed, 19 Jan 2011 18:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=ZSrOuNf/4yBzaGydspS5opRkecTk6A0nK5pfOv2tzSI=; b=PoBpXB+jMP6iWGbJpXqj8+5QsYSIqsA74wGzU/WKoF0UTtUVw0IPP6Xtkm2KWbcQQ3 1w1m9KuWTiqH8ybXsD48ch8fCvTS9V5UChi92gX18YhHH7XzKyepIqgtg6qN+Ia5aR8e tqEAkjX0p3lzahlmOwEqA6VjfwKP6rHdnz9Zg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=sHpYDnguP0SU30DjEOTtSAbA8f79HiIEded5cEzuvvgFcRwKNVI0H8jQEQcn6Fd9Om oQnhDLAOfYjCuxaJ8fgbnTS5SQ9rbNSw/mLMVM+02/lsVoOO/pyd9kZFCe3K5uAiv7UI 19F0Jp49pWqGbg1YgI7Ivl0Gu8W11B89EiTCM= MIME-Version: 1.0 Received: by 10.142.43.12 with SMTP id q12mr1582052wfq.34.1295491736893; Wed, 19 Jan 2011 18:48:56 -0800 (PST) Received: by 10.142.222.13 with HTTP; Wed, 19 Jan 2011 18:48:56 -0800 (PST) Date: Wed, 19 Jan 2011 21:48:56 -0500 Message-ID: From: Roy Liu Content-Type: multipart/alternative; boundary=000e0cd17bbec9794a049a3e2cbb X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -5.9 (-----) X-Mailman-Approved-At: Wed, 19 Jan 2011 21:42:57 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) --000e0cd17bbec9794a049a3e2cbb Content-Type: text/plain; charset=ISO-8859-1 I've noticed that Emacs.app opens up relative pathnames twice -- once for the actual file, and once for the relative pathname appended to the directory of the current buffer. For example, trying to open by "a/b/text.txt" opens "a/b/text.txt" and attempts to open "a/b/a/b/text.txt". I wonder if the following patch corrects the problem: --- lisp/term/ns-win.el.orig 2010-12-12 23:31:04.000000000 -0500 +++ lisp/term/ns-win.el 2010-12-12 23:32:00.000000000 -0500 @@ -785,7 +785,7 @@ "Do a `find-file' with the `ns-input-file' as argument." (interactive) (let ((f) (file) (bufwin1) (bufwin2)) - (setq f (file-truename (car ns-input-file))) + (setq f (file-truename (expand-file-name (car ns-input-file) command-line-default-directory))) (setq ns-input-file (cdr ns-input-file)) (setq file (find-file-noselect f)) (setq bufwin1 (get-buffer-window file 'visible)) Here, the input filename is expanded according to the current working directory when Emacs was invoked. Since I'm no expert, I don't know if this breaks something else. Thanks for your time! --000e0cd17bbec9794a049a3e2cbb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I've noticed that Emacs.app opens up relative pathnames twice -- once f= or the actual file, and once for the relative pathname appended to the dire= ctory of the current buffer.
For example, trying to open by "a/b/t= ext.txt" opens=A0"a/b/text.txt" and attempts to open=A0"= ;a/b/a/b/text.txt".

I wonder if t= he following patch corrects the problem:

--- = lisp/term/ns-win.el.orig =A0 =A02010-12-12 23:31:04.000000000 -0500
+++ lisp/term/ns-win.el 2010-12-12 23:32:00.000000000 -0500
@@ -785,7 +785,7 @@
=A0=A0 "Do a `find-file' with t= he `ns-input-file' as argument."
=A0=A0 (interactive)
=A0=A0 (let ((f) (file) (bufwin1) (bufwin2))
- =A0 =A0(se= tq f (file-truename (car ns-input-file)))
+ =A0 =A0(setq f (file-truename (expand-file-name (car ns-input-file) = command-line-default-directory)))
=A0=A0 =A0 (setq ns-input-file = (cdr ns-input-file))
=A0=A0 =A0 (setq file (find-file-noselect f)= )
=A0=A0 =A0 (setq bufwin1 (get-buffer-window file 'visible))
=

Here, the input filename is expanded according to the c= urrent working directory when Emacs was invoked. =A0Since I'm no expert= , I don't know if this breaks something else.

Thanks for your time!

--000e0cd17bbec9794a049a3e2cbb-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 20 00:18:56 2011 Received: (at control) by debbugs.gnu.org; 20 Jan 2011 05:18:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pfmv9-0005FY-Rj for submit@debbugs.gnu.org; Thu, 20 Jan 2011 00:18:56 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pfmv8-0005FN-Od for control@debbugs.gnu.org; Thu, 20 Jan 2011 00:18:55 -0500 Received: from localhost ([127.0.0.1]:59709) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pfn2e-0000K7-Ht; Thu, 20 Jan 2011 00:26:40 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19767.51088.12266.333565@fencepost.gnu.org> Date: Thu, 20 Jan 2011 00:26:40 -0500 From: Glenn Morris To: control Subject: emacs X-Attribution: GM X-Mailer: VM (www.wonderworks.com/vm), GNU Emacs (www.gnu.org/software/emacs) X-Hue: red X-Ran: @>;@g#dasY89v,Ao,G6nX2\8)WdM#\t%[H4o*+t75>_UE&_;W-zW|k&oq4y3{YBuXd}Y~m X-Debbugs-No-Ack: yes X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) merge 6179 7872 From unknown Tue Jun 17 22:10:51 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Roy Liu Subject: bug#7872: closed (Re: bug#7872: Possible fix for relative pathnames given through the command line) Message-ID: References: <4D4062AA.6090601@swipnet.se> X-Gnu-PR-Message: they-closed 7872 X-Gnu-PR-Package: emacs,ns Reply-To: 7872@debbugs.gnu.org Date: Wed, 26 Jan 2011 17:59:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1296064742-13235-1" This is a multi-part message in MIME format... ------------=_1296064742-13235-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #7872: Possible fix for relative pathnames given through the command line which was filed against the emacs,ns package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 7872@debbugs.gnu.org. --=20 7872: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D7872 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1296064742-13235-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 7872-done) by debbugs.gnu.org; 26 Jan 2011 17:58:31 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pi9dX-0003Qi-1x for submit@debbugs.gnu.org; Wed, 26 Jan 2011 12:58:31 -0500 Received: from smtprelay-h31.telenor.se ([213.150.131.4]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pi9dU-0003QV-HS for 7872-done@debbugs.gnu.org; Wed, 26 Jan 2011 12:58:29 -0500 Received: from ipb1.telenor.se (ipb1.telenor.se [195.54.127.164]) by smtprelay-h31.telenor.se (Postfix) with ESMTP id 75FD1EA0A1 for <7872-done@debbugs.gnu.org>; Wed, 26 Jan 2011 19:06:35 +0100 (CET) X-SENDER-IP: [85.225.45.100] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjU2AFbxP01V4S1kPGdsb2JhbACIW5wcDAEBAQE1L70lhU8Ej28 X-IronPort-AV: E=Sophos;i="4.60,381,1291590000"; d="scan'208";a="169198298" Received: from c-642de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.100]) by ipb1.telenor.se with ESMTP; 26 Jan 2011 19:06:35 +0100 Received: from [172.20.199.13] (zeplin [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id 6CB5D7FA05A; Wed, 26 Jan 2011 19:06:34 +0100 (CET) Message-ID: <4D4062AA.6090601@swipnet.se> Date: Wed, 26 Jan 2011 19:06:34 +0100 From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Roy Liu Subject: Re: bug#7872: Possible fix for relative pathnames given through the command line References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 7872-done Cc: 7872-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.3 (--) It seems the right thing to do. Checked in. In the future, please use M-x report-emacs-bug so we can see the version you are reporting against. The trunk version looks quite different. It is likely there will be a merge conflict here. Jan D. Roy Liu skrev 2011-01-20 03.48: > I've noticed that Emacs.app opens up relative pathnames twice -- once for the > actual file, and once for the relative pathname appended to the directory of > the current buffer. > For example, trying to open by "a/b/text.txt" opens "a/b/text.txt" and > attempts to open "a/b/a/b/text.txt". > > I wonder if the following patch corrects the problem: > > --- lisp/term/ns-win.el.orig 2010-12-12 23:31:04.000000000 -0500 > +++ lisp/term/ns-win.el 2010-12-12 23:32:00.000000000 -0500 > @@ -785,7 +785,7 @@ > "Do a `find-file' with the `ns-input-file' as argument." > (interactive) > (let ((f) (file) (bufwin1) (bufwin2)) > - (setq f (file-truename (car ns-input-file))) > + (setq f (file-truename (expand-file-name (car ns-input-file) > command-line-default-directory))) > (setq ns-input-file (cdr ns-input-file)) > (setq file (find-file-noselect f)) > (setq bufwin1 (get-buffer-window file 'visible)) > > Here, the input filename is expanded according to the current working > directory when Emacs was invoked. Since I'm no expert, I don't know if this > breaks something else. > > Thanks for your time! > ------------=_1296064742-13235-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 20 Jan 2011 02:42:59 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PfkUE-0001uF-M4 for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:42:59 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PfkSV-0001rn-Qd for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:41:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pfka5-0008Ex-9a for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:49:02 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:57148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pfka5-0008Et-7K for submit@debbugs.gnu.org; Wed, 19 Jan 2011 21:49:01 -0500 Received: from [140.186.70.92] (port=38196 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pfka3-00089n-JI for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:49:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pfka2-0008EL-E9 for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:48:59 -0500 Received: from mail-pw0-f41.google.com ([209.85.160.41]:61869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pfka2-0008EA-9O for bug-gnu-emacs@gnu.org; Wed, 19 Jan 2011 21:48:58 -0500 Received: by pwj8 with SMTP id 8so40316pwj.0 for ; Wed, 19 Jan 2011 18:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=ZSrOuNf/4yBzaGydspS5opRkecTk6A0nK5pfOv2tzSI=; b=PoBpXB+jMP6iWGbJpXqj8+5QsYSIqsA74wGzU/WKoF0UTtUVw0IPP6Xtkm2KWbcQQ3 1w1m9KuWTiqH8ybXsD48ch8fCvTS9V5UChi92gX18YhHH7XzKyepIqgtg6qN+Ia5aR8e tqEAkjX0p3lzahlmOwEqA6VjfwKP6rHdnz9Zg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=sHpYDnguP0SU30DjEOTtSAbA8f79HiIEded5cEzuvvgFcRwKNVI0H8jQEQcn6Fd9Om oQnhDLAOfYjCuxaJ8fgbnTS5SQ9rbNSw/mLMVM+02/lsVoOO/pyd9kZFCe3K5uAiv7UI 19F0Jp49pWqGbg1YgI7Ivl0Gu8W11B89EiTCM= MIME-Version: 1.0 Received: by 10.142.43.12 with SMTP id q12mr1582052wfq.34.1295491736893; Wed, 19 Jan 2011 18:48:56 -0800 (PST) Received: by 10.142.222.13 with HTTP; Wed, 19 Jan 2011 18:48:56 -0800 (PST) Date: Wed, 19 Jan 2011 21:48:56 -0500 Message-ID: Subject: Possible fix for relative pathnames given through the command line From: Roy Liu To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=000e0cd17bbec9794a049a3e2cbb X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 19 Jan 2011 21:42:57 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) --000e0cd17bbec9794a049a3e2cbb Content-Type: text/plain; charset=ISO-8859-1 I've noticed that Emacs.app opens up relative pathnames twice -- once for the actual file, and once for the relative pathname appended to the directory of the current buffer. For example, trying to open by "a/b/text.txt" opens "a/b/text.txt" and attempts to open "a/b/a/b/text.txt". I wonder if the following patch corrects the problem: --- lisp/term/ns-win.el.orig 2010-12-12 23:31:04.000000000 -0500 +++ lisp/term/ns-win.el 2010-12-12 23:32:00.000000000 -0500 @@ -785,7 +785,7 @@ "Do a `find-file' with the `ns-input-file' as argument." (interactive) (let ((f) (file) (bufwin1) (bufwin2)) - (setq f (file-truename (car ns-input-file))) + (setq f (file-truename (expand-file-name (car ns-input-file) command-line-default-directory))) (setq ns-input-file (cdr ns-input-file)) (setq file (find-file-noselect f)) (setq bufwin1 (get-buffer-window file 'visible)) Here, the input filename is expanded according to the current working directory when Emacs was invoked. Since I'm no expert, I don't know if this breaks something else. Thanks for your time! --000e0cd17bbec9794a049a3e2cbb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I've noticed that Emacs.app opens up relative pathnames twice -- once f= or the actual file, and once for the relative pathname appended to the dire= ctory of the current buffer.
For example, trying to open by "a/b/t= ext.txt" opens=A0"a/b/text.txt" and attempts to open=A0"= ;a/b/a/b/text.txt".

I wonder if t= he following patch corrects the problem:

--- = lisp/term/ns-win.el.orig =A0 =A02010-12-12 23:31:04.000000000 -0500
+++ lisp/term/ns-win.el 2010-12-12 23:32:00.000000000 -0500
@@ -785,7 +785,7 @@
=A0=A0 "Do a `find-file' with t= he `ns-input-file' as argument."
=A0=A0 (interactive)
=A0=A0 (let ((f) (file) (bufwin1) (bufwin2))
- =A0 =A0(se= tq f (file-truename (car ns-input-file)))
+ =A0 =A0(setq f (file-truename (expand-file-name (car ns-input-file) = command-line-default-directory)))
=A0=A0 =A0 (setq ns-input-file = (cdr ns-input-file))
=A0=A0 =A0 (setq file (find-file-noselect f)= )
=A0=A0 =A0 (setq bufwin1 (get-buffer-window file 'visible))
=

Here, the input filename is expanded according to the c= urrent working directory when Emacs was invoked. =A0Since I'm no expert= , I don't know if this breaks something else.

Thanks for your time!

--000e0cd17bbec9794a049a3e2cbb-- ------------=_1296064742-13235-1-- From unknown Tue Jun 17 22:10:51 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Roy Liu Subject: bug#6179: closed (Re: bug#7872: Possible fix for relative pathnames given through the command line) Message-ID: References: <4D4062AA.6090601@swipnet.se> X-Gnu-PR-Message: they-closed 6179 X-Gnu-PR-Package: emacs,ns Reply-To: 6179@debbugs.gnu.org Date: Wed, 26 Jan 2011 17:59:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1296064742-13235-3" This is a multi-part message in MIME format... ------------=_1296064742-13235-3 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #7872: OSX: Emacs.app is loading files specified by relative pathname twice which was filed against the emacs,ns package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 6179@debbugs.gnu.org. --=20 7872: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D7872 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1296064742-13235-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 7872-done) by debbugs.gnu.org; 26 Jan 2011 17:58:31 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pi9dX-0003Qi-1x for submit@debbugs.gnu.org; Wed, 26 Jan 2011 12:58:31 -0500 Received: from smtprelay-h31.telenor.se ([213.150.131.4]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pi9dU-0003QV-HS for 7872-done@debbugs.gnu.org; Wed, 26 Jan 2011 12:58:29 -0500 Received: from ipb1.telenor.se (ipb1.telenor.se [195.54.127.164]) by smtprelay-h31.telenor.se (Postfix) with ESMTP id 75FD1EA0A1 for <7872-done@debbugs.gnu.org>; Wed, 26 Jan 2011 19:06:35 +0100 (CET) X-SENDER-IP: [85.225.45.100] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjU2AFbxP01V4S1kPGdsb2JhbACIW5wcDAEBAQE1L70lhU8Ej28 X-IronPort-AV: E=Sophos;i="4.60,381,1291590000"; d="scan'208";a="169198298" Received: from c-642de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.100]) by ipb1.telenor.se with ESMTP; 26 Jan 2011 19:06:35 +0100 Received: from [172.20.199.13] (zeplin [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id 6CB5D7FA05A; Wed, 26 Jan 2011 19:06:34 +0100 (CET) Message-ID: <4D4062AA.6090601@swipnet.se> Date: Wed, 26 Jan 2011 19:06:34 +0100 From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Roy Liu Subject: Re: bug#7872: Possible fix for relative pathnames given through the command line References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 7872-done Cc: 7872-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.3 (--) It seems the right thing to do. Checked in. In the future, please use M-x report-emacs-bug so we can see the version you are reporting against. The trunk version looks quite different. It is likely there will be a merge conflict here. Jan D. Roy Liu skrev 2011-01-20 03.48: > I've noticed that Emacs.app opens up relative pathnames twice -- once for the > actual file, and once for the relative pathname appended to the directory of > the current buffer. > For example, trying to open by "a/b/text.txt" opens "a/b/text.txt" and > attempts to open "a/b/a/b/text.txt". > > I wonder if the following patch corrects the problem: > > --- lisp/term/ns-win.el.orig 2010-12-12 23:31:04.000000000 -0500 > +++ lisp/term/ns-win.el 2010-12-12 23:32:00.000000000 -0500 > @@ -785,7 +785,7 @@ > "Do a `find-file' with the `ns-input-file' as argument." > (interactive) > (let ((f) (file) (bufwin1) (bufwin2)) > - (setq f (file-truename (car ns-input-file))) > + (setq f (file-truename (expand-file-name (car ns-input-file) > command-line-default-directory))) > (setq ns-input-file (cdr ns-input-file)) > (setq file (find-file-noselect f)) > (setq bufwin1 (get-buffer-window file 'visible)) > > Here, the input filename is expanded according to the current working > directory when Emacs was invoked. Since I'm no expert, I don't know if this > breaks something else. > > Thanks for your time! > ------------=_1296064742-13235-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 May 2010 03:18:44 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCOwd-00035v-6x for submit@debbugs.gnu.org; Wed, 12 May 2010 23:18:43 -0400 Received: from mail-pz0-f197.google.com ([209.85.222.197]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCORV-0002rG-J9 for submit@debbugs.gnu.org; Wed, 12 May 2010 22:46:34 -0400 Received: by pzk35 with SMTP id 35so474217pzk.0 for ; Wed, 12 May 2010 19:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=Co1DhJeAuAuwq2WhQDGcx/50uj0XK2IQD9YYUiuk3Kg=; b=Vbv7jCZaUdnfdPzuIvBYyzIT4Llj31hl/uiivat0f4dEwNGtgCygkk4LrQ9vX/4GRh 5H9WyzUGQ785ziUOcvL6boKnALyWr2pxFs5+legSAUpiIgUe5q2qVckju2nul/uPRLEw eFGUYD8cnpx6pBDz29l4o0RNnw6JV0Ssg0xf8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=CXEypN5EAyPztkrzHztINhtYh1/OjuoYyACRpKC1kNts1MQ39e4kY46i8apshObJpT XiLXxPETttklpDgewlMOVkjv66CPWD0cR0FEvsELZM6G2+F1KcEhuZ3tpMjXgVkVo9Pp uOEnHmMJF9nIiVUDn/cceZyyFjth0zmbHhPPw= MIME-Version: 1.0 Received: by 10.142.207.15 with SMTP id e15mr6022781wfg.14.1273718789281; Wed, 12 May 2010 19:46:29 -0700 (PDT) Received: by 10.143.163.2 with HTTP; Wed, 12 May 2010 19:46:29 -0700 (PDT) Date: Wed, 12 May 2010 19:46:29 -0700 X-Google-Sender-Auth: 4AlWiVUbyrG9XKThHpvPjU-6wmI Message-ID: Subject: OSX: Emacs.app is loading files specified by relative pathname twice From: Roy Liu To: submit@debbugs.gnu.org Content-Type: multipart/alternative; boundary=000e0cd25856fa96f7048670c33a X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 12 May 2010 23:18:41 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.3 (-) --000e0cd25856fa96f7048670c33a Content-Type: text/plain; charset=UTF-8 Package: emacs Version: 23.2 I've noticed strange loading behavior for Emacs.app when I wrap it with a script: #!/bin/bash /Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs "$@" Here are my observations: 1) For files specified with --find-file and --find and --visit, loading goes fine. 2) For files specified with absolute paths, loading is also fine. 3) For files specified with relative pathnames, things start getting weird. For example, loading "a/b/c/d.txt" will load the desired file, but it will then try to load "a/b/c/a/b/c/d.txt", which clearly doesn't exist. It's as if directory "a/b/c" has been added to some sort of search path (in addition to $PWD) in which emacs then relatively searches for "a/b/c/d.txt", thus resulting in the joined result "a/b/c/a/b/c/d.txt". I don't know if this should be a bug, since the desired usage of Emacs.app is to run through the window manager (some form of "open"), which is a sheltered environment. I've built Emacs.app from MacPorts, which, from what I can tell, introduces no special modifications or patches, and so I believe that this defect is repeatable. -Roy --000e0cd25856fa96f7048670c33a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Package: emacs
Version: 23.2

I've noticed = strange loading behavior for Emacs.app when I wrap it with a script:
<= div>

#!/bin/bash

/App= lications/MacPorts/Emacs.app/Contents/MacOS/Emacs "$@"


Here are my observations:
1) F= or files specified with --find-file and --find and --visit, loading goes fi= ne.
2) For files specified with absolute paths, loading is also f= ine.
3) For files specified with relative pathnames, things start getting w= eird. =C2=A0For example, loading "a/b/c/d.txt" will load the desi= red file, but it will then try to load "a/b/c/a/b/c/d.txt", which= clearly doesn't exist. =C2=A0It's as if directory "a/b/c"= ; has been added to some sort of search path (in addition to $PWD) in which= emacs then relatively searches for "a/b/c/d.txt", thus resulting= in the joined result "a/b/c/a/b/c/d.txt".

I don't know if this should be a bug, since the des= ired usage of Emacs.app is to run through the window manager (some form of = "open"), which is a sheltered environment.
I've bui= lt Emacs.app from MacPorts, which, from what I can tell, introduces no spec= ial modifications or patches, and so I believe that this defect is repeatab= le.

-Roy

--000e0cd25856fa96f7048670c33a-- ------------=_1296064742-13235-3-- From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 26 18:32:10 2011 Received: (at control) by debbugs.gnu.org; 26 Feb 2011 23:32:10 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PtTcQ-0002ML-4x for submit@debbugs.gnu.org; Sat, 26 Feb 2011 18:32:10 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PtTcO-0002MA-H8 for control@debbugs.gnu.org; Sat, 26 Feb 2011 18:32:09 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1PtTcJ-0004n4-1D for control@debbugs.gnu.org; Sat, 26 Feb 2011 18:32:03 -0500 Date: Sat, 26 Feb 2011 18:32:03 -0500 Message-Id: Subject: control message for bug 8127 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) unarchive 6179 forcemerge 6179 8127