From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: owner@emacsbugs.donarmstrong.com (Emacs bug Tracking System) Newsgroups: gmane.emacs.bugs Subject: bug#3911: marked as done (23.1.50; get-free-disk-space relative to non-existent default-directory) Date: Sun, 16 Aug 2009 00:40:17 +0000 Message-ID: References: <871vnclhoz.fsf@cyd.mit.edu> <87tz13jb3p.fsf@blah.blah> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_1250383217-19781-0" X-Trace: ger.gmane.org 1250383655 32525 80.91.229.12 (16 Aug 2009 00:47:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Aug 2009 00:47:35 +0000 (UTC) To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 16 02:47:28 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1McTuB-0006m4-8Q for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Aug 2009 02:47:27 +0200 Original-Received: from localhost ([127.0.0.1]:46963 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1McTuA-0002c8-F2 for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Aug 2009 20:47:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1McTtj-0002UW-C9 for bug-gnu-emacs@gnu.org; Sat, 15 Aug 2009 20:46:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1McTtd-0002TY-RT for bug-gnu-emacs@gnu.org; Sat, 15 Aug 2009 20:46:58 -0400 Original-Received: from [199.232.76.173] (port=49165 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1McTtd-0002TK-G5 for bug-gnu-emacs@gnu.org; Sat, 15 Aug 2009 20:46:53 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:41811) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1McTtc-0004jD-Ki for bug-gnu-emacs@gnu.org; Sat, 15 Aug 2009 20:46:53 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7G0knTf020783; Sat, 15 Aug 2009 17:46:50 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n7G0eHne019806; Sat, 15 Aug 2009 17:40:17 -0700 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: closed 3911 X-Emacs-PR-Package: emacs X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:30251 Archived-At: This is a multi-part message in MIME format... ------------=_1250383217-19781-0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Your message dated Sat, 15 Aug 2009 20:34:52 -0400 with message-id <871vnclhoz.fsf@cyd.mit.edu> and subject line Re: get-free-disk-space when default-directory doesn't exi= st has caused the Emacs bug report #3911, regarding 23.1.50; get-free-disk-space relative to non-existent default-dir= ectory 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.) --=20 3911: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3D3911 Emacs Bug Tracking System Contact owner@emacsbugs.donarmstrong.com with problems ------------=_1250383217-19781-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by emacsbugs.donarmstrong.com; 23 Jul 2009 22:21:30 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.5 required=4.0 tests=AWL,FOURLA autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6NMLOj5007682 for ; Thu, 23 Jul 2009 15:21:25 -0700 Received: from mx10.gnu.org ([199.232.76.166]:52480) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1MU6fD-0006qE-BM for emacs-pretest-bug@gnu.org; Thu, 23 Jul 2009 18:21:23 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1MU6f9-00061L-77 for emacs-pretest-bug@gnu.org; Thu, 23 Jul 2009 18:21:21 -0400 Received: from mailout1-1.pacific.net.au ([61.8.2.208]:43106 helo=mailout1.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MU6f8-00060X-BN for emacs-pretest-bug@gnu.org; Thu, 23 Jul 2009 18:21:19 -0400 Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout1.pacific.net.au (Postfix) with ESMTP id 2BE124FD5DA for ; Fri, 24 Jul 2009 08:21:10 +1000 (EST) Received: from blah.blah (ppp280A.dyn.pacific.net.au [61.8.40.10]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id 6A7CB27428 for ; Fri, 24 Jul 2009 08:21:03 +1000 (EST) Received: from gg by blah.blah with local (Exim 4.69) (envelope-from ) id 1MU6do-0002Ax-0S for emacs-pretest-bug@gnu.org; Fri, 24 Jul 2009 08:19:56 +1000 From: Kevin Ryde To: emacs-pretest-bug@gnu.org Subject: 23.1.50; get-free-disk-space relative to non-existent default-directory Date: Fri, 24 Jul 2009 08:19:54 +1000 Message-ID: <87tz13jb3p.fsf@blah.blah> User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) --=-=-= 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 * files.el (get-free-disk-space): Absolutize the dir before changing default-directory, so as not to answer about a different directory. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=files.el.disk-space-absolutize.diff *** 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)) --=-=-= 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 --=-=-=-- ------------=_1250383217-19781-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 3911-done) by emacsbugs.donarmstrong.com; 16 Aug 2009 00:33:55 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.6 required=4.0 tests=AWL autolearn=unavailable version=3.2.5-bugs.debian.org_2005_01_02 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7G0XrPo018728; Sat, 15 Aug 2009 17:33:54 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id 69DA657E21C; Sat, 15 Aug 2009 20:34:52 -0400 (EDT) From: Chong Yidong To: Kevin Ryde Cc: 2631-done@emacsbugs.donarmstrong.com, 3911-done@emacsbugs.donarmstrong.com Subject: Re: get-free-disk-space when default-directory doesn't exist Date: Sat, 15 Aug 2009 20:34:52 -0400 Message-ID: <871vnclhoz.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-CrossAssassin-Score: 2 > What is it that's not good about "/"? It doesn't have to be readable > or anything I don't think, just somewhere capable of a chdir()... If > both default-directory and home directory both don't exist > get-free-disk-space still gets an error You're right; it's probably better to fall back on / instead of ~. I've just checked in your suggested change. > (let ((default-directory "/no/such/dir")) > (get-free-disk-space ".")) > => 3705637 I checked in your suggestion to do expand-file-name before changing the default-directory, as well. Thanks. ------------=_1250383217-19781-0--