From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 09 15:56:41 2014 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 09 22:45:52 2014 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 To: 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> 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-Debbugs-Envelope-To: 18232 Cc: 18232@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: -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 debbugs-submit-bounces@debbugs.gnu.org Sun Aug 10 04:03:21 2014 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> To: rgm@gnu.org Subject: Re: bug#18232: 24.3.92; Filename completion changes the current working directory 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-Debbugs-Envelope-To: 18232 Cc: 18232@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 (---) [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 debbugs-submit-bounces@debbugs.gnu.org Sun Aug 10 09:02:50 2014 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\)) Subject: Re: bug#18232: 24.3.92; Filename completion changes the current working directory From: =?windows-1252?Q?Jan_Dj=E4rv?= 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> To: Harald Hanche-Olsen X-Mailer: Apple Mail (2.1878.6) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 18232 Cc: Glenn Morris , 18232@debbugs.gnu.org, Paul Eggert 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 debbugs-submit-bounces@debbugs.gnu.org Sun Aug 10 17:08:35 2014 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). From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 11 01:06:55 2014 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\)) Subject: Re: bug#18232: 24.3.92; Filename completion changes the current working directory From: =?iso-8859-1?Q?Jan_Dj=E4rv?= 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> To: Paul Eggert X-Mailer: Apple Mail (2.1878.6) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 18232-done Cc: Glenn Morris , Harald Hanche-Olsen , 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: -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. From unknown Sat Jun 21 10:41:06 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 08 Sep 2014 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator