GNU bug report logs - #3911
get-free-disk-space race condition on default-directory test

Previous Next

Package: emacs;

Reported by: Kevin Ryde <user42 <at> zip.com.au>

Date: Thu, 23 Jul 2009 22:25:05 UTC

Severity: normal

Tags: patch

Merged with 2631

Done: Kevin Ryde <user42 <at> zip.com.au>

Bug is archived. No further changes may be made.

Full log


Message #15 received at 3911 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Kevin Ryde <user42 <at> zip.com.au>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 3911 <at> debbugs.gnu.org
Subject: Re: get-free-disk-space when default-directory doesn't exist
Date: Tue, 18 Aug 2009 10:23:08 +1000
[Message part 1 (text/plain, inline)]
Chong Yidong <cyd <at> stupidchicken.com> writes:
>
> You're right; it's probably better to fall back on / instead of ~.

I think the test for file-remote-p is covered by the first line of the
func so it's not needed in the dir condition bit, per below.


I still think "/" might as well be used unconditionally though.  The
reason I'm still banging on about that is that there's probably 3 or 4
other places in emacs which also don't care about the current directory
when spawning a program.  They would make use of the same idiom,
whatever it might best be.  (I arrived at this first when some of my own
code bombed in a non-existent default-directory.  I've seen it in other
people's code too.)


[files.el.disk-space-noremote.diff (text/x-diff, inline)]
*** files.el	18 Aug 2009 08:51:19 +1000	1.1068
--- files.el	18 Aug 2009 10:12:22 +1000	
***************
*** 5400,5407 ****
  		     ;; not exist (Bug#2631, Bug#3911).
  		     (let ((default-directory default-directory))
  		       (setq dir (expand-file-name dir))
! 		       (unless (and (not (file-remote-p default-directory))
! 				    (file-directory-p default-directory)
  				    (file-readable-p default-directory))
  			 (setq default-directory "/"))
  		       (eq (call-process directory-free-space-program
--- 5400,5406 ----
  		     ;; not exist (Bug#2631, Bug#3911).
  		     (let ((default-directory default-directory))
  		       (setq dir (expand-file-name dir))
! 		       (unless (and (file-directory-p default-directory)
  				    (file-readable-p default-directory))
  			 (setq default-directory "/"))
  		       (eq (call-process directory-free-space-program

This bug report was last modified 14 years and 83 days ago.

Previous Next


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