From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#6995: 24.0.50; get-free-disk-space doesn't return available space in dired Date: Mon, 13 Sep 2010 15:22:17 +0200 Organization: ThierryVolpiatto Message-ID: <87pqwh3hiu.fsf@tux.homenetwork> References: <87d3sp5olh.fsf@tux.homenetwork> <83aanm5dyk.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1284385260 816 80.91.229.12 (13 Sep 2010 13:41:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 13 Sep 2010 13:41:00 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 13 15:40:58 2010 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.69) (envelope-from ) id 1Ov9HG-0006e4-1X for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Sep 2010 15:40:58 +0200 Original-Received: from localhost ([127.0.0.1]:37297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ov9HF-0007SB-D2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Sep 2010 09:40:57 -0400 Original-Received: from [140.186.70.92] (port=58421 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ov9Gp-00079K-1L for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2010 09:40:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ov9Gl-0004VD-Mg for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2010 09:40:30 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42036) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ov9Gl-0004V3-Jf for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2010 09:40:27 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Ov8zu-00043W-EY; Mon, 13 Sep 2010 09:23:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87d3sp5olh.fsf@tux.homenetwork> Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Sep 2010 13:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6995 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.128438414815581 (code B ref -1); Mon, 13 Sep 2010 13:23:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Sep 2010 13:22:28 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ov8zM-00043G-1K for submit@debbugs.gnu.org; Mon, 13 Sep 2010 09:22:28 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ov8zJ-000439-KP for submit@debbugs.gnu.org; Mon, 13 Sep 2010 09:22:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ov91M-0002D3-Pz for submit@debbugs.gnu.org; Mon, 13 Sep 2010 09:24:37 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:58338) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ov91M-0002Cz-Nh for submit@debbugs.gnu.org; Mon, 13 Sep 2010 09:24:32 -0400 Original-Received: from [140.186.70.92] (port=42691 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ov91L-0000Io-Gv for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2010 09:24:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ov91K-0002CV-A7 for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2010 09:24:31 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:51809) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ov91J-0002CE-SN for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2010 09:24:30 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ov91E-0000GP-3R for bug-gnu-emacs@gnu.org; Mon, 13 Sep 2010 15:24:24 +0200 Original-Received: from 72.211.85-79.rev.gaoland.net ([79.85.211.72]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Sep 2010 15:24:24 +0200 Original-Received: from thierry.volpiatto by 72.211.85-79.rev.gaoland.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Sep 2010 15:24:24 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 57 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 72.211.85-79.rev.gaoland.net User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:R4qm1JA6CVl4JivCyVLoVM3p+nM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 13 Sep 2010 09:23:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org 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:40129 Archived-At: Stefan Monnier writes: >> How about dropping the use of `df', at least on GNU/Linux? It's IMO >> ridiculous to invoke an external program for a single system call. I >> know that this system call is notoriously non-portable, and that doing >> in Emacs all that system-dependent stuff that `df' does is not a good >> idea. But at least on the most popular free system (and perhaps on a >> few compatible ones) we could do it right without all that labor, and >> gain stability and reliability that depending on `df' will never >> achieve. > > That would make a lot of sense, yes, I agree too, but waiting such a change, you should rewrite `get-free-disk-space' as it can't work correctly on the output of df. ,---- | ;; Usual format is as follows: | ;; Filesystem ... Used Available Capacity ... | ;; /dev/sda6 ...48106535 35481255 10669850 ... | (goto-char (point-min)) | (when (re-search-forward " +Avail[^ \n]*" `---- But usual format is not the same on all locales: Here it is: ,---- | Sys. de fichiers 1024-blocs Utilisé Dispo. Capacité Monté sur | /dev/sda7 48947688 21618816 24842416 47% /home `---- So (re-search-forward " +Avail[^ \n]*" is not portable here. I use this simplified version of get-free-disk-space if it can help: ,---- | (defun get-free-disk-space (dir) | (let* ((data (with-temp-buffer | (call-process directory-free-space-program | nil t nil | directory-free-space-args | dir) | (split-string (buffer-string) "\n" t))) | (values (cdr (split-string (second data))))) | (nth 2 values))) `---- Tough the version on 23.2 work also. Note that the value of "total used in directory" is always wrong. How do you get this value? -- A+ Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997