Subject: bug#2631: get-free-disk-space when
default-directory doesn't exist



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



Privacy