From unknown Sat Aug 16 18:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18232: 24.3.92; Filename completion changes the current working directory Resent-From: Harald Hanche-Olsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Aug 2014 19:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18232 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 18232@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14076142018452 (code B ref -1); Sat, 09 Aug 2014 19:57:01 +0000 Received: (at submit) by debbugs.gnu.org; 9 Aug 2014 19:56:41 +0000 Received: from localhost ([127.0.0.1]:36733 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGCkq-0002CG-Vp for submit@debbugs.gnu.org; Sat, 09 Aug 2014 15:56:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46687) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGCkp-0002C2-31 for submit@debbugs.gnu.org; Sat, 09 Aug 2014 15:56:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGCka-00030C-MA for submit@debbugs.gnu.org; Sat, 09 Aug 2014 15:56:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:39782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGCka-000302-JU for submit@debbugs.gnu.org; Sat, 09 Aug 2014 15:56:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGCkU-0004C1-Dh for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2014 15:56:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGCkO-0002tt-8S for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2014 15:56:18 -0400 Received: from hylle06.itea.ntnu.no ([129.241.56.235]:50469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGCkO-0002lF-0y for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2014 15:56:12 -0400 Received: from localhost (localhost [127.0.0.1]) by hylle06.itea.ntnu.no (Postfix) with ESMTP id 6666D66B1FA for ; Sat, 9 Aug 2014 21:56:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at hylle06.itea.ntnu.no Received: from localhost (unknown [IPv6:2001:4662:4ffa:0:f92f:2a2:7f41:310c]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hanche) by hylle06.itea.ntnu.no (Postfix) with ESMTPSA id 1010766B1B6; Sat, 9 Aug 2014 21:56:02 +0200 (CEST) Date: Sat, 09 Aug 2014 21:56:01 +0200 (CEST) Message-Id: <20140809.215601.1788203728960933692.hanche@math.ntnu.no> From: Harald Hanche-Olsen X-URL: http://www.math.ntnu.no/~hanche/ X-Mailer: Mew version 6.6 on Emacs 24.3.92 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) C-x C-f (find-file) with filename completion changes the current working directory (cwd) of emacs. This is annoying for the following reason: If you temporarily mount a filesystem and then visit a file in that filesystem, you cannot unmount the filesystem because it is now the cwd of a running process. The obvious workaround is to first visit a file not in this filesystem, but that is annoying and should be unnecessary. I have narrowed the cause down to filename completion: Starting with emacs -Q: - Find the PID of the running emacs process. - In a root shell, run =E2=80=9Clsof -p PID | grep cwd=E2=80=9D. - Evaluate (read-file-name-default "Filename: ") and don't hit RETURN - Navigate to some other directory, and cause filename completion to happen. For example, type =E2=80=9C/tmp/=E2=80=9D and follow up with T= AB. - Run the lsof command again, and note that the current working directory has changed. In GNU Emacs 24.3.92.2 (x86_64-apple-darwin13.3.0, NS apple-appkit-1265.2= 1) of 2014-08-08 on airy Windowing system distributor `Apple', version 10.3.1265 Configured using: `configure --with-ns' Important settings: value of $LC_CTYPE: en_US.UTF-8 value of $LANG: C locale-coding-system: utf-8-unix From unknown Sat Aug 16 18:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18232: 24.3.92; Filename completion changes the current working directory Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Aug 2014 02:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18232 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Harald Hanche-Olsen Cc: 18232@debbugs.gnu.org Received: via spool by 18232-submit@debbugs.gnu.org id=B18232.140763875231090 (code B ref 18232); Sun, 10 Aug 2014 02:46:01 +0000 Received: (at 18232) by debbugs.gnu.org; 10 Aug 2014 02:45:52 +0000 Received: from localhost ([127.0.0.1]:36908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGJ8q-00085O-7N for submit@debbugs.gnu.org; Sat, 09 Aug 2014 22:45:52 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:47187 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGJ8m-00085F-SG for 18232@debbugs.gnu.org; Sat, 09 Aug 2014 22:45:49 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1XGJ8m-00074d-63; Sat, 09 Aug 2014 22:45:48 -0400 From: Glenn Morris References: <20140809.215601.1788203728960933692.hanche@math.ntnu.no> X-Spook: kilo class World Trade Center military Operation Iraqi X-Ran: NysFY0}`n3XPicI.O[g`]kNqGjM7-vcM.V,7*EPu (Harald Hanche-Olsen's message of "Sat, 09 Aug 2014 21:56:01 +0200 (CEST)") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) Harald Hanche-Olsen wrote: > Starting with emacs -Q: > > - Find the PID of the running emacs process. > - In a root shell, run "lsof -p PID | grep cwd". > - Evaluate (read-file-name-default "Filename: ") and don't hit RETURN > - Navigate to some other directory, and cause filename completion to > happen. For example, type "/tmp/" and follow up with TAB. > - Run the lsof command again, and note that the current working > directory has changed. I can't reproduce that on GNU/Linux. In general, if you visit files and then unmount the hosting filesystems, you are going to have problems. > In GNU Emacs 24.3.92.2 (x86_64-apple-darwin13.3.0, NS apple-appkit-1265.21) From unknown Sat Aug 16 18:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18232: 24.3.92; Filename completion changes the current working directory Resent-From: Harald Hanche-Olsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Aug 2014 08:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18232 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: rgm@gnu.org Cc: 18232@debbugs.gnu.org Received: via spool by 18232-submit@debbugs.gnu.org id=B18232.140765780130417 (code B ref 18232); Sun, 10 Aug 2014 08:04:02 +0000 Received: (at 18232) by debbugs.gnu.org; 10 Aug 2014 08:03:21 +0000 Received: from localhost ([127.0.0.1]:36938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGO65-0007uW-45 for submit@debbugs.gnu.org; Sun, 10 Aug 2014 04:03:21 -0400 Received: from hylle06.itea.ntnu.no ([129.241.56.235]:58175) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGO62-0007uN-Fv for 18232@debbugs.gnu.org; Sun, 10 Aug 2014 04:03:19 -0400 Received: from localhost (localhost [127.0.0.1]) by hylle06.itea.ntnu.no (Postfix) with ESMTP id 0314F66B421; Sun, 10 Aug 2014 10:03:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at hylle06.itea.ntnu.no Received: from localhost (187.211.251.212.customer.cdi.no [212.251.211.187]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hanche) by hylle06.itea.ntnu.no (Postfix) with ESMTPSA id 8582A66B415; Sun, 10 Aug 2014 10:03:16 +0200 (CEST) Date: Sun, 10 Aug 2014 10:03:15 +0200 (CEST) Message-Id: <20140810.100315.1655250097160453652.hanche@math.ntnu.no> From: Harald Hanche-Olsen In-Reply-To: References: <20140809.215601.1788203728960933692.hanche@math.ntnu.no> X-URL: http://www.math.ntnu.no/~hanche/ X-Mailer: Mew version 6.6 on Emacs 24.3.92 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -3.0 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.0 (---) [Glenn Morris (2014-08-10 02:45:48 UTC)] > I can't reproduce that on GNU/Linux. So it's OS X specific, then. I suspected it might be; thanks for checking it out. > In general, if you visit files and then unmount the hosting > filesystems, you are going to have problems. Only if you unmount before saving your changes. Why would you do that? (I do this several times a week, typically to edit a file on some web server. I mount the filesystems using sshfs. It is not practical to leave them mounted, as this is a laptop and moves about a lot.) – Harald From unknown Sat Aug 16 18:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18232: 24.3.92; Filename completion changes the current working directory Resent-From: Jan =?UTF-8?Q?Dj=C3=A4rv?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Aug 2014 13:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18232 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Harald Hanche-Olsen Cc: Glenn Morris , 18232@debbugs.gnu.org, Paul Eggert Received: via spool by 18232-submit@debbugs.gnu.org id=B18232.140767577131378 (code B ref 18232); Sun, 10 Aug 2014 13:03:01 +0000 Received: (at 18232) by debbugs.gnu.org; 10 Aug 2014 13:02:51 +0000 Received: from localhost ([127.0.0.1]:37109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGSlt-0008A0-Rs for submit@debbugs.gnu.org; Sun, 10 Aug 2014 09:02:50 -0400 Received: from mailfe03.swip.net ([212.247.154.65]:42227 helo=swip.net) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGSlq-00089j-7B for 18232@debbugs.gnu.org; Sun, 10 Aug 2014 09:02:47 -0400 X-T2-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50 Received: from hosdjarv.se (account mj138573@tele2.se [46.59.42.57] verified) by mailfe03.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 355672592; Sun, 10 Aug 2014 15:02:39 +0200 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) From: Jan =?UTF-8?Q?Dj=C3=A4rv?= In-Reply-To: <20140810.100315.1655250097160453652.hanche@math.ntnu.no> Date: Sun, 10 Aug 2014 15:02:38 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <5E6FDA1E-7EB7-49AB-9DF6-AC5CD36423E1@swipnet.se> References: <20140809.215601.1788203728960933692.hanche@math.ntnu.no> <20140810.100315.1655250097160453652.hanche@math.ntnu.no> X-Mailer: Apple Mail (2.1878.6) X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hello. 10 aug 2014 kl. 10:03 skrev Harald Hanche-Olsen : > [Glenn Morris (2014-08-10 02:45:48 UTC)] >=20 >> I can't reproduce that on GNU/Linux. >=20 > So it's OS X specific, then. >=20 > I suspected it might be; thanks for checking it out. It is a bug introduced by bringing in GNULib. The GNULib in Emacs makes = wrong assumptions, from lib/save-cwd.h: /* Gnulib needs to save and restore the current working directory to fully emulate functions like fstatat. But Emacs doesn't care what the current working directory is; it always uses absolute file names. This module replaces the Gnulib module by omitting the code that Emacs does not need. */ Given that fchdir is called many times per file when completing, no = wonder the current working directory gets screwed up. This bug needs to be fixed in the GNULib code, by really use restore_cwd = as it was intended and not make false assumptions and take shortcuts = like this: SAVE_CWD_INLINE int restore_cwd (struct saved_cwd const *cwd) { return = 0; } Jan D. >> In general, if you visit files and then unmount the hosting >> filesystems, you are going to have problems. >=20 > Only if you unmount before saving your changes. > Why would you do that? >=20 > (I do this several times a week, typically to edit a file on some web > server. I mount the filesystems using sshfs. It is not practical to > leave them mounted, as this is a laptop and moves about a lot.) >=20 > =96 Harald >=20 >=20 From unknown Sat Aug 16 18:48:48 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Harald Hanche-Olsen Subject: bug#18232: closed (Re: bug#18232: 24.3.92; Filename completion changes the current working directory) Message-ID: References: <53E7DF3F.2070007@cs.ucla.edu> <20140809.215601.1788203728960933692.hanche@math.ntnu.no> X-Gnu-PR-Message: they-closed 18232 X-Gnu-PR-Package: emacs Reply-To: 18232@debbugs.gnu.org Date: Sun, 10 Aug 2014 21:09:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1407704942-26795-1" This is a multi-part message in MIME format... ------------=_1407704942-26795-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #18232: 24.3.92; Filename completion changes the current working directory which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 18232@debbugs.gnu.org. --=20 18232: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18232 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1407704942-26795-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 18232-done) by debbugs.gnu.org; 10 Aug 2014 21:08:35 +0000 Received: from localhost ([127.0.0.1]:38056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGaLy-0006xS-Dr for submit@debbugs.gnu.org; Sun, 10 Aug 2014 17:08:35 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:48565) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGaLu-0006xC-GX for 18232-done@debbugs.gnu.org; Sun, 10 Aug 2014 17:08:31 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 713E139E8018; Sun, 10 Aug 2014 14:08:24 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KHyysZIlzyzO; Sun, 10 Aug 2014 14:08:15 -0700 (PDT) Received: from [192.168.1.9] (pool-71-177-17-123.lsanca.dsl-w.verizon.net [71.177.17.123]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id ADDFA39E8012; Sun, 10 Aug 2014 14:08:15 -0700 (PDT) Message-ID: <53E7DF3F.2070007@cs.ucla.edu> Date: Sun, 10 Aug 2014 14:08:15 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: =?UTF-8?B?SmFuIERqw6Rydg==?= , Harald Hanche-Olsen Subject: Re: bug#18232: 24.3.92; Filename completion changes the current working directory References: <20140809.215601.1788203728960933692.hanche@math.ntnu.no> <20140810.100315.1655250097160453652.hanche@math.ntnu.no> <5E6FDA1E-7EB7-49AB-9DF6-AC5CD36423E1@swipnet.se> In-Reply-To: <5E6FDA1E-7EB7-49AB-9DF6-AC5CD36423E1@swipnet.se> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 18232-done Cc: Glenn Morris , 18232-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.0 (---) Jan Djärv wrote: > This bug needs to be fixed in the GNULib code, by really use restore_cwd as it was intended Just to clarify, the bug is Emacs's little substitute for Gnulib, not in Gnulib itself. Perhaps at some point Emacs should just use Gnulib here, but for now it's safer to migrate a bit more of Gnulib into Emacs to avoid this regression. I reproduced the problem on Fedora 20 by building an Emacs that was crippled to not use readlinkat etc., and installed a patch that worked for me as emacs-24 bzr 117437 (simplified in 117438). ------------=_1407704942-26795-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 9 Aug 2014 19:56:41 +0000 Received: from localhost ([127.0.0.1]:36733 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGCkq-0002CG-Vp for submit@debbugs.gnu.org; Sat, 09 Aug 2014 15:56:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46687) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGCkp-0002C2-31 for submit@debbugs.gnu.org; Sat, 09 Aug 2014 15:56:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGCka-00030C-MA for submit@debbugs.gnu.org; Sat, 09 Aug 2014 15:56:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:39782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGCka-000302-JU for submit@debbugs.gnu.org; Sat, 09 Aug 2014 15:56:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGCkU-0004C1-Dh for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2014 15:56:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGCkO-0002tt-8S for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2014 15:56:18 -0400 Received: from hylle06.itea.ntnu.no ([129.241.56.235]:50469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGCkO-0002lF-0y for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2014 15:56:12 -0400 Received: from localhost (localhost [127.0.0.1]) by hylle06.itea.ntnu.no (Postfix) with ESMTP id 6666D66B1FA for ; Sat, 9 Aug 2014 21:56:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at hylle06.itea.ntnu.no Received: from localhost (unknown [IPv6:2001:4662:4ffa:0:f92f:2a2:7f41:310c]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hanche) by hylle06.itea.ntnu.no (Postfix) with ESMTPSA id 1010766B1B6; Sat, 9 Aug 2014 21:56:02 +0200 (CEST) Date: Sat, 09 Aug 2014 21:56:01 +0200 (CEST) Message-Id: <20140809.215601.1788203728960933692.hanche@math.ntnu.no> To: bug-gnu-emacs@gnu.org Subject: 24.3.92; Filename completion changes the current working directory From: Harald Hanche-Olsen X-URL: http://www.math.ntnu.no/~hanche/ X-Mailer: Mew version 6.6 on Emacs 24.3.92 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) C-x C-f (find-file) with filename completion changes the current working directory (cwd) of emacs. This is annoying for the following reason: If you temporarily mount a filesystem and then visit a file in that filesystem, you cannot unmount the filesystem because it is now the cwd of a running process. The obvious workaround is to first visit a file not in this filesystem, but that is annoying and should be unnecessary. I have narrowed the cause down to filename completion: Starting with emacs -Q: - Find the PID of the running emacs process. - In a root shell, run =E2=80=9Clsof -p PID | grep cwd=E2=80=9D. - Evaluate (read-file-name-default "Filename: ") and don't hit RETURN - Navigate to some other directory, and cause filename completion to happen. For example, type =E2=80=9C/tmp/=E2=80=9D and follow up with T= AB. - Run the lsof command again, and note that the current working directory has changed. In GNU Emacs 24.3.92.2 (x86_64-apple-darwin13.3.0, NS apple-appkit-1265.2= 1) of 2014-08-08 on airy Windowing system distributor `Apple', version 10.3.1265 Configured using: `configure --with-ns' Important settings: value of $LC_CTYPE: en_US.UTF-8 value of $LANG: C locale-coding-system: utf-8-unix ------------=_1407704942-26795-1-- From unknown Sat Aug 16 18:48:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18232: 24.3.92; Filename completion changes the current working directory Resent-From: Jan =?UTF-8?Q?Dj=C3=A4rv?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Aug 2014 05:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18232 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Paul Eggert Cc: Glenn Morris , Harald Hanche-Olsen , 18232-done@debbugs.gnu.org Received: via spool by 18232-done@debbugs.gnu.org id=D18232.140773361521839 (code D ref 18232); Mon, 11 Aug 2014 05:07:02 +0000 Received: (at 18232-done) by debbugs.gnu.org; 11 Aug 2014 05:06:55 +0000 Received: from localhost ([127.0.0.1]:38317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGhos-0005gA-R9 for submit@debbugs.gnu.org; Mon, 11 Aug 2014 01:06:55 -0400 Received: from mailfe04.swip.net ([212.247.154.97]:48578 helo=swip.net) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGhoo-0005fv-Eq for 18232-done@debbugs.gnu.org; Mon, 11 Aug 2014 01:06:51 -0400 X-T2-Spam-Status: No, hits=0.0 required=5.0 Received: from hosdjarv.se (account mj138573@tele2.se [46.59.42.57] verified) by mailfe04.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 521409134; Mon, 11 Aug 2014 07:06:43 +0200 Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) From: Jan =?UTF-8?Q?Dj=C3=A4rv?= In-Reply-To: <53E7DF3F.2070007@cs.ucla.edu> Date: Mon, 11 Aug 2014 07:06:42 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <962B76A8-A169-4F13-ADAA-D23BEB73988E@swipnet.se> References: <20140809.215601.1788203728960933692.hanche@math.ntnu.no> <20140810.100315.1655250097160453652.hanche@math.ntnu.no> <5E6FDA1E-7EB7-49AB-9DF6-AC5CD36423E1@swipnet.se> <53E7DF3F.2070007@cs.ucla.edu> X-Mailer: Apple Mail (2.1878.6) X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 10 aug 2014 kl. 23:08 skrev Paul Eggert : > Jan Dj=E4rv wrote: >> This bug needs to be fixed in the GNULib code, by really use = restore_cwd as it was intended >=20 > Just to clarify, the bug is Emacs's little substitute for Gnulib, not = in Gnulib itself. Perhaps at some point Emacs should just use Gnulib = here, but for now it's safer to migrate a bit more of Gnulib into Emacs = to avoid this regression. I reproduced the problem on Fedora 20 by = building an Emacs that was crippled to not use readlinkat etc., and = installed a patch that worked for me as emacs-24 bzr 117437 (simplified = in 117438). Confirmed OK on OSX as well. Jan D.