unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: owner@emacsbugs.donarmstrong.com (Emacs bug Tracking System)
To: Kevin Ryde <user42@zip.com.au>
Subject: bug#3911: marked as done (get-free-disk-space race condition on default-directory test)
Date: Fri, 02 Oct 2009 00:35:05 +0000	[thread overview]
Message-ID: <handler.3911.D3911.125444317329509.ackdone@emacsbugs.donarmstrong.com> (raw)
In-Reply-To: 87tz13jb3p.fsf@blah.blah

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

Your message dated Fri, 02 Oct 2009 10:24:49 +1000
with message-id <87bpkq7icu.fsf@blah.blah>
and subject line Re: bug#3911: get-free-disk-space when default-directory doesn't exist
has caused the Emacs bug report #3911,
regarding get-free-disk-space race condition on default-directory test
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
3911: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3911
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 5863 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 1039 bytes --]

On a non-existent directory get-free-disk-space returns nil, eg.

    (get-free-disk-space "/no/such/dir")
    => nil

But if it's done by a relative path from a default-directory which
doesn't exist, then the answer is the space in your home directory

    (let ((default-directory "/no/such/dir"))
      (get-free-disk-space "."))
    => 3705637

I hoped the two answers would be the same.

This is with the "df"-running code in get-free-disk-space, ie. no
`file-system-info' function.

Perhaps absolutize per below with an inserted setq, the diff being just
re-indent.

(I still think the use of the home dir there is either complicated and
unnecessary, or complicated and necessary everywhere.  Or maybe better
call-process could not attempt a chdir at all if a caller doesn't care
about the current directory.  But leaving that unchanged as yet.)

2009-07-24  Kevin Ryde  <user42@zip.com.au>

	* files.el (get-free-disk-space): Absolutize the dir before
	changing default-directory, so as not to answer about a different
	directory.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2.1.2: files.el.disk-space-absolutize.diff --]
[-- Type: text/x-diff, Size: 1795 bytes --]

*** files.el	24 Jul 2009 07:35:37 +1000	1.1063
--- files.el	24 Jul 2009 08:07:01 +1000	
***************
*** 5394,5410 ****
        (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))
--- 5394,5413 ----
        (save-match-data
  	(with-temp-buffer
  	  (when (and directory-free-space-program
!                      (progn
!                        ;; absolutize before changing default-directory
!                        (setq dir (expand-file-name dir))
!                        (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))

[-- Attachment #2.1.3: Type: text/plain, Size: 539 bytes --]






In GNU Emacs 23.1.50.4 (i586-pc-linux-gnu, GTK+ Version 2.16.4)
 of 2009-07-24 on blah.blah
configured using `configure  'CFLAGS=-O -g' '--prefix=/down/emacs/b/inst' '--with-x-toolkit=gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t

[-- Attachment #3: Type: message/rfc822, Size: 2217 bytes --]

From: Kevin Ryde <user42@zip.com.au>
To: 3911-done@emacsbugs.donarmstrong.com
Subject: Re: bug#3911: get-free-disk-space when default-directory doesn't exist
Date: Fri, 02 Oct 2009 10:24:49 +1000
Message-ID: <87bpkq7icu.fsf@blah.blah>

Installed by Stefan.

  parent reply	other threads:[~2009-10-02  0:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <871vnclhoz.fsf@cyd.mit.edu>
2009-07-23 22:19 ` bug#3911: 23.1.50; get-free-disk-space relative to non-existent default-directory Kevin Ryde
2009-08-16  0:40   ` bug#3911: marked as done (23.1.50; get-free-disk-space relative to non-existent default-directory) Emacs bug Tracking System
2009-10-02  0:35   ` Emacs bug Tracking System [this message]
2009-08-18  0:23 ` bug#3911: get-free-disk-space when default-directory doesn't exist Kevin Ryde
2009-08-18  1:02   ` Chong Yidong
2009-08-19 21:43     ` Kevin Ryde
2009-08-19 22:03     ` Kevin Ryde
2009-08-22  3:57       ` Stefan Monnier
2009-08-24 23:45         ` Kevin Ryde
2009-08-25 18:29           ` Stefan Monnier
2009-08-29  1:32             ` Kevin Ryde
2009-08-29  3:37               ` Stefan Monnier
2009-09-01  1:37                 ` Kevin Ryde
2009-09-01  6:05                   ` Stefan Monnier
2009-09-07  0:28                     ` Kevin Ryde
     [not found] <87d4cjzf89.fsf@cyd.mit.edu>
2009-03-10 22:24 ` bug#2631: " Kevin Ryde
2009-03-11  2:10   ` Stefan Monnier
2009-03-11  4:23     ` Eli Zaretskii
2009-03-11 21:00     ` Kevin Ryde
2009-03-15  2:40   ` bug#2631: marked as done (get-free-disk-space when default-directory doesn't exist) Emacs bug Tracking System
2009-08-16  0:40   ` bug#2631: marked as done (get-free-disk-space when home dir also " Emacs bug Tracking System
2009-03-17  0:02 ` bug#2631: get-free-disk-space when default-directory doesn't exist Kevin Ryde
2009-03-17  4:05   ` Eli Zaretskii
2009-03-27 23:32     ` Kevin Ryde
2009-03-27 23:17   ` Kevin Ryde
2009-03-27 23:25     ` Processed: " Emacs bug Tracking System

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=handler.3911.D3911.125444317329509.ackdone@emacsbugs.donarmstrong.com \
    --to=owner@emacsbugs.donarmstrong.com \
    --cc=user42@zip.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).