[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18232: 24.3.92; Filename completion changes the current working dire

From: Jan Djärv
Subject: bug#18232: 24.3.92; Filename completion changes the current working directory
Date: Sun, 10 Aug 2014 15:02:38 +0200


10 aug 2014 kl. 10:03 skrev Harald Hanche-Olsen <address@hidden>:

> [Glenn Morris <address@hidden> (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.

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.
> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]