From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#976: 23.0.60; incorrect code for filesets-get-filelist Date: Tue, 16 Sep 2008 13:44:16 -0700 Message-ID: <002c01c9183c$fc7e2680$0200a8c0@us.oracle.com> References: <002901c915bf$811df210$0200a8c0@us.oracle.com> Reply-To: Drew Adams , 976@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_002D_01C91802.501F4E80" X-Trace: ger.gmane.org 1221599290 7566 80.91.229.12 (16 Sep 2008 21:08:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Sep 2008 21:08:10 +0000 (UTC) To: <976@emacsbugs.donarmstrong.com>, Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 16 23:09:05 2008 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 1Kfhn1-0005t5-Om for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Sep 2008 23:08:52 +0200 Original-Received: from localhost ([127.0.0.1]:35308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kfhlz-0006jr-N2 for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Sep 2008 17:07:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kfhlu-0006j4-O3 for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 17:07:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kfhlt-0006iP-Kw for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 17:07:41 -0400 Original-Received: from [199.232.76.173] (port=50844 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kfhlt-0006iE-AR for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 17:07:41 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:57791) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kfhlr-0002r8-Ki for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 17:07:40 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8GL7Y6g004815; Tue, 16 Sep 2008 14:07:35 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m8GKo68a030087; Tue, 16 Sep 2008 13:50:06 -0700 X-Loop: don@donarmstrong.com Resent-From: "Drew Adams" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 16 Sep 2008 20:50:05 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 976 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 976-submit@emacsbugs.donarmstrong.com id=B976.122159783727967 (code B ref 976); Tue, 16 Sep 2008 20:50:05 +0000 Original-Received: (at 976) by emacsbugs.donarmstrong.com; 16 Sep 2008 20:43:57 +0000 Original-Received: from rgminet01.oracle.com (rgminet01.oracle.com [148.87.113.118]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8GKhrLH027961 for <976@emacsbugs.donarmstrong.com>; Tue, 16 Sep 2008 13:43:54 -0700 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id m8GKhfNE020907; Tue, 16 Sep 2008 14:43:41 -0600 Original-Received: from acsmt704.oracle.com (acsmt704.oracle.com [141.146.40.82]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id m8GKhdF1003548; Tue, 16 Sep 2008 14:43:39 -0600 Original-Received: from dradamslap1 (/141.144.58.96) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 16 Sep 2008 20:43:38 +0000 X-Mailer: Microsoft Office Outlook 11 In-reply-to: <002901c915bf$811df210$0200a8c0@us.oracle.com> Thread-Index: AckVv4Ci1hEH5okgSQ2EUXtBuurWggCetBEg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Tue, 16 Sep 2008 17:07:41 -0400 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:20572 gmane.emacs.pretest.bugs:23055 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_002D_01C91802.501F4E80 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit The attached code might help you in fixing this - if not, ignore it. I haven't tested all of the code that calls `filesets-get-filelist', but the version of `filesets-get-filelist' attached seems to DTRT, AFAICT. The problem with the original code, and with the suggestion I sent earlier, is that `filesets-get-filelist' does not DTRT for type :tree. The original code is completely broken - does nothing here. In my previously suggested code, `filesets-get-filelist' does the same thing for type :tree as for type :pattern - it returns only the files in the directory, not also the files in its subdirectories. See attached file for proposed new definition (with new function filesets-files-under). HTH > From: Drew Adams Sent: Saturday, September 13, 2008 9:41 AM > The part that treats a :tree of the code defining > `filesets-get-filelist' is not correct and never could have been > correct. And it does not correspond to the (correct) code from the > filesets author. One wonders if the GNU Emacs code was ever tested. > > This is the `case' clause that treats :tree in the definition > of `filesets-get-filelist': > > ((:tree) > (let ((dir (nth 0 entry)) > (patt (nth 1 entry))) > (filesets-directory-files dir patt ':files t))) > > But `entry' here is a complete fileset, which is of the form > ("my-fs" (:tree "/some/directory" "^.+\.suffix$")) > > The above code thus tries to use "my-fs" as the directory, whereas it > should use "/some/directory". > > This is the (correct) code in the latest version from the author > (http://members.a1.net/t.link/CompEmacsFilesets.html). (The comment is > from the author.) > > ((:tree) > ;;well, the way trees are handled is a mess +++ > (let* ((dirpatt (if (consp (nth 1 entry)) > (filesets-entry-get-tree entry) > entry)) > (dir (nth 0 dirpatt)) > (patt (nth 1 dirpatt))) > (filesets-list-dir dir patt ':files t))) > > However, I think the following would be sufficient: > > ((:tree) > (let* ((dirpatt (filesets-entry-get-tree entry)) > (dir (nth 0 dirpatt)) > (patt (nth 1 dirpatt))) > (filesets-directory-files dir patt ':files t))) > > I don't see why the author's more complex treatment would ever be > needed, since in order for the :tree clause of the `case' to be > reached (consp (nth 1 entry)) must be a cons, AFAICT. > > At any rate, either the author's code or what I suggest immediately > above is needed. There is no way that the current GNU Emacs code can > work with a :tree fileset. > > > In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600) > of 2008-09-03 on LENNART-69DE564 > Windowing system distributor `Microsoft Corp.', version 5.1.2600 > configured using `configure --with-gcc (3.4) --no-opt > --cflags -Ic:/g/include > -fno-crossjumping' > > > > > > > ------=_NextPart_000_002D_01C91802.501F4E80 Content-Type: application/octet-stream; name="throw.el" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="throw.el" (defun filesets-get-filelist (entry &optional mode event)=0A= "Get all files for fileset ENTRY.=0A= Assume MODE (see `filesets-entry-mode'), if provided."=0A= (let* ((mode (or mode (filesets-entry-mode entry)))=0A= (fl (case mode=0A= ((:files) (filesets-entry-get-files entry))=0A= ((:file) (list (filesets-entry-get-file entry)))=0A= ((:ingroup)=0A= (let ((entry (expand-file-name=0A= (if (stringp entry)=0A= entry=0A= (filesets-entry-get-master entry)))))=0A= (cons entry (filesets-ingroup-cache-get entry))))=0A= ((:tree)=0A= (let* ((dirpatt (filesets-entry-get-tree entry))=0A= (dir (nth 0 dirpatt))=0A= (patt (nth 1 dirpatt))=0A= (depth (or (filesets-entry-get-tree-max-level = entry)=0A= filesets-tree-max-level)))=0A= (filesets-files-under 0 depth entry dir patt)))=0A= ((:pattern)=0A= (let ((dirpatt (filesets-entry-get-pattern entry)))=0A= (if dirpatt=0A= (let ((dir (filesets-entry-get-pattern--dir = dirpatt))=0A= (patt (filesets-entry-get-pattern--pattern = dirpatt)))=0A= (filesets-directory-files dir patt ':files t))=0A= (filesets-error 'error "Filesets: malformed entry: "=0A= entry)))))))=0A= (filesets-filter-list=0A= fl (lambda (file) (not (filesets-filetype-property file event))))))=0A= =0A= (defun filesets-files-under (level depth entry dir patt &optional = absolutep)=0A= "Files under DIR that match PATT.=0A= LEVEL is the current level under DIR.=0A= DEPTH is the maximal tree scanning depth for ENTRY.=0A= ENTRY is a fileset.=0A= DIR is a directory.=0A= PATT is a regexp that included file names must match.=0A= ABSOLUTEP non-nil means use absolute file names."=0A= (and (or (=3D depth 0) (< level depth))=0A= (let* ((dir (file-name-as-directory dir))=0A= (files-here (filesets-directory-files=0A= dir patt nil absolutep=0A= (filesets-entry-get-filter-dirs-flag entry)))=0A= (subdirs (filesets-filter-dir-names files-here))=0A= (files=0A= (filesets-filter-dir-names=0A= (apply #'append=0A= files-here=0A= (mapcar=0A= (lambda (subdir)=0A= (let* ((subdir (file-name-as-directory subdir))=0A= (full-subdir (concat dir subdir)))=0A= (filesets-files-under (+ level 1) depth entry=0A= full-subdir patt)))=0A= subdirs))=0A= t)))=0A= files)))=0A= ------=_NextPart_000_002D_01C91802.501F4E80--