From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: disk-usage Date: Tue, 26 Feb 2019 12:59:53 +0100 Message-ID: <87ftsarc92.fsf@gmx.de> References: <87imxgmacr.fsf@ambrevar.xyz> <874l8z7cmi.fsf@gmx.de> <874l8zr0cs.fsf@ambrevar.xyz> <87zhqr5x81.fsf@gmx.de> <8736ojqyj1.fsf@ambrevar.xyz> <87mumqkhkm.fsf@ambrevar.xyz> <87bm31nm5w.fsf@ambrevar.xyz> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="193182"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Emacs developers To: Pierre Neidhardt Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 26 13:13:54 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gybcQ-000o9E-0P for ged-emacs-devel@m.gmane.org; Tue, 26 Feb 2019 13:13:54 +0100 Original-Received: from localhost ([127.0.0.1]:53943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gybcO-0004DA-UU for ged-emacs-devel@m.gmane.org; Tue, 26 Feb 2019 07:13:52 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gybP9-0003dS-Qd for emacs-devel@gnu.org; Tue, 26 Feb 2019 07:00:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gybP3-00030G-OA for emacs-devel@gnu.org; Tue, 26 Feb 2019 07:00:11 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:42341) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gybP1-0002sh-5o for emacs-devel@gnu.org; Tue, 26 Feb 2019 07:00:05 -0500 Original-Received: from detlef.gmx.de ([212.86.58.136]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LwaQZ-1h4Yqq0N2d-018Mfb; Tue, 26 Feb 2019 12:59:55 +0100 In-Reply-To: <87bm31nm5w.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Sun, 24 Feb 2019 18:14:51 +0100") X-Provags-ID: V03:K1:8pij03KZV1muFx+vnVuQazU6Zq/GZLtpkWxgXj5ukSWaoPAd773 ODs/rN1WacoMNn2q3SsozBNonDDCrHPGvueXBFJABqYdTJRHfi4ZExofOA8Fl0SDyjI5jxq GGF02OO1JQh+8UugciVidq6r7wgax2n4b93U6OQDuSljyz0uZ+DMoEIyc2nIlrEbbqAkTn/ wf1Xl5hvTlkcagztdt3+g== X-UI-Out-Filterresults: notjunk:1;V03:K0:9BxFXBxxH5g=:8n9Z0PhiDced6KDU4+7f9f yWaM+yE5mT9jAh68Vq+CZdPMNqc5sbvS6MW3yCq7IeZtftK26CKUvsUIazgtxUpYCD4W2tc4g SnIyeRNKT5bT08Ouamr32bFgTjhmT6BJb28qzr/lCM/9pjVa2ynlU6CtrazQNbRk/IGIGD8uU LYCuvnSVW7KYyQqZz5e836rPrgm1hfDhSUjpADx5gvPv6INQUDNzRRQR04ySM98Dxn9nhQCoo 8wipwXnfg9gfItZGnfWGzEdV7/mHuQDZmoCB5WvmnE37tl4H1Xeh1rNKvnm1P/AqSkoRFTARM TyMnJI4wO4UkJPKKMYuFeB5cGXpZmkyJNO6LFfqqodoc1d4vbaLxyzBtnmcnGvgkpF59Sq+B3 GTax+toZ1lZw2POtu63PD7uP4NXoI5K9w5Lz8ii/OKa4QRYGEhaS2tm1umS3XOObsIVmj1mc3 3lKr9p9MKKDCOxL7EhcpXx2nwa4MFQyEmEk6Rfu0wnkNN2Mtyy6ygTsELKKkBIi6AZxTWq/0F AbXQsFDmSugzcf1amLffc9LNj98qw/bbr5dEz/e9wBOARs69pxHr9m1OdB3cAnUKkY69TGlKA PWC9OzksVFNkvKOeXfXmZsl3H7iP77epnDX5wXCDwJj5m/lU6/p6ApjiEjUDVKBc8FrQ/48Tq fXcU7aZffybEeNFCrKWwRwbRGH5lEdNHpdMYwFCMux9yeJUglMztPDrS1gnr+WWpWuqOM1Bza T2bOtKrS6dBkKgOVlLSusvlVdsX4XokNVYgOnhYOs5j+m4dvLsnXlw7vVdEuFK3TQoQAf7QF X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.19 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233629 Archived-At: --=-=-= Content-Type: text/plain Pierre Neidhardt writes: Hi Pierre, > I've released 1.2.0. Thanks. I needed to apply the following patch to make it work on remote systems. In my local environment, I could test it on "/sudo::"; it makes a difference because "/root" is readable only for user "root". --=-=-= Content-Type: text/x-patch Content-Disposition: inline *** /home/albinus/.emacs.d/elpa/disk-usage-1.2.0/disk-usage.el.~1~ 2019-02-26 11:50:08.976859553 +0100 --- /home/albinus/.emacs.d/elpa/disk-usage-1.2.0/disk-usage.el 2019-02-26 12:21:11.661869542 +0100 *************** *** 290,298 **** "This is the equivalent of running the shell command $ find . -type f -exec du -sb {} +" (setq directory (or directory default-directory)) ! (let ((pair-strings (split-string (with-temp-buffer (process-file disk-usage--find-command nil '(t nil) nil ! directory "-type" "f" "-exec" disk-usage--du-command --- 290,299 ---- "This is the equivalent of running the shell command $ find . -type f -exec du -sb {} +" (setq directory (or directory default-directory)) ! (let* ((default-directory directory) ! (pair-strings (split-string (with-temp-buffer (process-file disk-usage--find-command nil '(t nil) nil ! (file-local-name directory) "-type" "f" "-exec" disk-usage--du-command *************** *** 301,307 **** "\n" 'omit-nulls))) (cl-loop for pair-string in pair-strings for pair = (split-string pair-string "\t") ! for name = (cadr pair) for attributes = (file-attributes name) when (cl-loop for filter in disk-usage-filters always (funcall filter name attributes)) --- 302,308 ---- "\n" 'omit-nulls))) (cl-loop for pair-string in pair-strings for pair = (split-string pair-string "\t") ! for name = (concat (file-remote-p directory) (cadr pair)) for attributes = (file-attributes name) when (cl-loop for filter in disk-usage-filters always (funcall filter name attributes)) *************** *** 351,357 **** (with-output-to-string (process-file disk-usage--du-command nil '(t nil) nil ! disk-usage--du-args path)) (buffer-string)))))) (defun disk-usage--sort-by-size (a b) --- 352,358 ---- (with-output-to-string (process-file disk-usage--du-command nil '(t nil) nil ! disk-usage--du-args (file-local-name path))) (buffer-string)))))) (defun disk-usage--sort-by-size (a b) --=-=-= Content-Type: text/plain There are further things to be improved: * In `disk-usage--list-recursively', you make a loop over for attributes = (file-attributes name) This is slow, at least on remote systems, because you apply `file-attributes' on every file on a possibly large list. Maybe you could call `directory-files-and-attributes' per directory, instead. * As said before, the commands you apply might vary on different hosts. For example, on my QNAP NAS server, getting du info on "/tmp" with "find /tmp -type f -exec du -sb \{\} \+" does not work. It must be "find /tmp -type f | xargs du -sb" instead. So the commands must be configurable per host. See for example, how `grep-host-defaults-alist' is computed via `grep-compute-defaults' in grep.el. Best regards, Michael. --=-=-=--