GNU bug report logs - #18232
24.3.92; Filename completion changes the current working directory

Previous Next

Package: emacs;

Reported by: Harald Hanche-Olsen <hanche <at> math.ntnu.no>

Date: Sat, 9 Aug 2014 19:57:01 UTC

Severity: minor

Found in version 24.3.92

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
Subject: bug#18232: closed (Re: bug#18232: 24.3.92; Filename completion
 changes the current working directory)
Date: Sun, 10 Aug 2014 21:09:02 +0000
[Message part 1 (text/plain, inline)]
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 <at> debbugs.gnu.org.

-- 
18232: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18232
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Jan Djärv <jan.h.d <at> swipnet.se>, 
 Harald Hanche-Olsen <hanche <at> math.ntnu.no>
Cc: Glenn Morris <rgm <at> gnu.org>, 18232-done <at> debbugs.gnu.org
Subject: Re: bug#18232: 24.3.92;
 Filename completion changes the current working directory
Date: Sun, 10 Aug 2014 14:08:15 -0700
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).

[Message part 3 (message/rfc822, inline)]
From: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.92; Filename completion changes the current working directory
Date: Sat, 09 Aug 2014 21:56:01 +0200 (CEST)
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 “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.


In GNU Emacs 24.3.92.2 (x86_64-apple-darwin13.3.0, NS apple-appkit-1265.21)
 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



This bug report was last modified 10 years and 289 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.