bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#976: 23.0.60; incorrect code for filesets-get-filelist


From: Mauro Aranda
Subject: bug#976: 23.0.60; incorrect code for filesets-get-filelist
Date: Fri, 20 Nov 2020 12:39:16 -0300

tags 976 patch
quit

"Drew Adams" <drew.adams@oracle.com> writes:

> Sorry for the added noise, but it's probably better for the default behavior to
> use absolute filenames. The attached code does that.
>
>
>> From: Drew Adams Sent: Tuesday, September 16, 2008 1:44 PM
>> 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'
>> >  

Hi Drew,

It's been a long time, but your fix looks right to me, and of course
you're right that the current code is broken.  I created a :tree fileset
for testing: without your fix I get wrong-type-argument errors, while
with your fix it works just fine.

I've recreated your fix below, added a commit message and formatted it
with `git format-patch'.  Could you please take a look and see if it
is OK to push it? Or maybe you would like to provide a different commit
message for your change?

Thanks.

Attachment: 0001-Fix-finding-filelist-for-tree-fileset-Bug-976.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]