GNU bug report logs - #2631
get-free-disk-space when home dir also doesn't exist

Previous Next

Package: emacs;

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

Date: Tue, 10 Mar 2009 22:30:03 UTC

Severity: normal

Tags: patch

Merged with 3911

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


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

From: Kevin Ryde <user42 <at> zip.com.au>
To: control <at> debbugs.gnu.org, 2631 <at> debbugs.gnu.org
Subject: Re: bug#2631: get-free-disk-space when default-directory doesn't exist
Date: Sat, 28 Mar 2009 10:17:47 +1100
[Message part 1 (text/plain, inline)]
reopen 2631
retitle 2631 get-free-disk-space when home dir also doesn't exist
tags 2631 +patch
thanks

If both default-directory and home directory both don't exist
get-free-disk-space still gets an error

    (progn
      (setq default-directory "/no/such/dir")
      (setenv "HOME" "/another/no/such/dir")
      (get-free-disk-space "/"))
    => (file-error "Setting current directory" "no such file or directory" "/another/no/such/dir/")

Although plenty of things probably depend on a home dir I don't think
get-free-disk-space needs to be one of them.

Change below is like what's also in the following funcs, I believe for
the same purpose, ie. just to make sure call-process will be happy, when
the program run doesn't care about the current directory.

    Man-init-defvars,
    mail-source-movemail
    message-send-mail-with-sendmail
    sendmail-send-it
    gamegrid-add-score-with-update-game-score-1


[files.el.disk-space-root.diff (text/x-diff, inline)]
*** files.el	28 Mar 2009 09:50:47 +1100	1.1041
--- files.el	28 Mar 2009 09:56:48 +1100	
***************
*** 5336,5352 ****
        (save-match-data
  	(with-temp-buffer
  	  (when (and directory-free-space-program
! 		     (let ((default-directory
! 			     (if (and (not (file-remote-p default-directory))
! 				      (file-directory-p default-directory)
! 				      (file-readable-p default-directory))
! 				 default-directory
! 			       (expand-file-name "~/"))))
! 		       (eq (call-process directory-free-space-program
! 					 nil t nil
! 					 directory-free-space-args
! 					 dir)
! 			   0)))
  	    ;; Usual format is a header line followed by a line of
  	    ;; numbers.
  	    (goto-char (point-min))
--- 5336,5349 ----
        (save-match-data
  	(with-temp-buffer
  	  (when (and directory-free-space-program
! 		     (progn
! 		       (setq dir (expand-file-name dir)) ;; in case relative
! 		       (let ((default-directory "/"))
! 			 (eq (call-process directory-free-space-program
! 					   nil t nil
! 					   directory-free-space-args
! 					   dir)
! 			     0))))
  	    ;; Usual format is a header line followed by a line of
  	    ;; numbers.
  	    (goto-char (point-min))

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

Previous Next


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