Re: [Chicken-hackers] Remove old variant of find-files
Christian Kellermann scripsit: > There is one discrepancy left as we do follow symlinks by default > and the docs say the opposite. Which way is the better behaviour? > I will change either the default or the docs then. I agree with other posters: the default should be not to follow symlinks, as both GNU and BSD find do. There are in fact three options: -P Never follow symlinks -L Always follow symlinks -H Follow symlinks that are passed to us, but not ones we discover It would be sensible to support all three of these. -- John Cowanco...@ccil.org I amar prestar aen, han mathon ne nen,http://www.ccil.org/~cowan han mathon ne chae, a han noston ne 'wilith. --Galadriel, LOTR:FOTR ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
Re: [Chicken-hackers] Remove old variant of find-files
From: Peter Bex Subject: Re: [Chicken-hackers] Remove old variant of find-files Date: Thu, 22 Sep 2011 10:45:08 +0200 > On Thu, Sep 22, 2011 at 10:38:50AM +0200, Moritz Heidkamp wrote: >> >> Christian Kellermann writes: >> > this is a simple patch to remove the deprecated variant of find-files. >> > As it is now the old variant is always choosen when calling find-files >> > with just 1 argument. >> >> Looks good to me! I don't really get that "we want `cons' inlined" >> comment in the original version. Why doesn't direct passing of cons lead >> to inlining? > > Don't understand that one either. Otherwise any redefinition of "cons" would influence the behaviour of "find-files". cheers, felix ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
Re: [Chicken-hackers] Remove old variant of find-files
* Peter Bex [110922 10:45]: > On Thu, Sep 22, 2011 at 10:38:50AM +0200, Moritz Heidkamp wrote: > > I'm not entirely sure what would be a sensible default myself. FWIW the > > GNU find program doesn't follow symlinks by default. > > I think that's safer since symlinks can create cycles which might cause > an endless loop. If in doubt, choose the safe option, to make it harder > to accidentally shoot yourself in the foot :) > (or do we have cycle detection?) So if you apply this patch I would add a tiny change afterwards that switches the default behaviour. Provided we agree on this (I am also for not following symlinks). -- Who can (make) the muddy water (clear)? Let it be still, and it will gradually become clear. Who can secure the condition of rest? Let movement go on, and the condition of rest will gradually arise. -- Lao Tse. ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
Re: [Chicken-hackers] Remove old variant of find-files
On Thu, Sep 22, 2011 at 10:38:50AM +0200, Moritz Heidkamp wrote: > > Christian Kellermann writes: > > this is a simple patch to remove the deprecated variant of find-files. > > As it is now the old variant is always choosen when calling find-files > > with just 1 argument. > > Looks good to me! I don't really get that "we want `cons' inlined" > comment in the original version. Why doesn't direct passing of cons lead > to inlining? Don't understand that one either. > > There is one discrepancy left as we do follow symlinks by default > > and the docs say the opposite. Which way is the better behaviour? > > I will change either the default or the docs then. > > I'm not entirely sure what would be a sensible default myself. FWIW the > GNU find program doesn't follow symlinks by default. I think that's safer since symlinks can create cycles which might cause an endless loop. If in doubt, choose the safe option, to make it harder to accidentally shoot yourself in the foot :) (or do we have cycle detection?) Cheers, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
Re: [Chicken-hackers] Remove old variant of find-files
Christian Kellermann writes: > this is a simple patch to remove the deprecated variant of find-files. > As it is now the old variant is always choosen when calling find-files > with just 1 argument. Looks good to me! I don't really get that "we want `cons' inlined" comment in the original version. Why doesn't direct passing of cons lead to inlining? > There is one discrepancy left as we do follow symlinks by default > and the docs say the opposite. Which way is the better behaviour? > I will change either the default or the docs then. I'm not entirely sure what would be a sensible default myself. FWIW the GNU find program doesn't follow symlinks by default. Moritz ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers
[Chicken-hackers] Remove old variant of find-files
Hi, this is a simple patch to remove the deprecated variant of find-files. As it is now the old variant is always choosen when calling find-files with just 1 argument. There is one discrepancy left as we do follow symlinks by default and the docs say the opposite. Which way is the better behaviour? I will change either the default or the docs then. Cheers, Christian -- Who can (make) the muddy water (clear)? Let it be still, and it will gradually become clear. Who can secure the condition of rest? Let movement go on, and the condition of rest will gradually arise. -- Lao Tse. >From a03d5bdaebe91f35a5e71ca19aecc2feae958451 Mon Sep 17 00:00:00 2001 From: Christian Kellermann Date: Thu, 22 Sep 2011 09:57:26 +0200 Subject: [PATCH] Remove deprecated find-files variant. Deprecated since 4.6.0. --- posix-common.scm | 25 +++-- 1 files changed, 7 insertions(+), 18 deletions(-) diff --git a/posix-common.scm b/posix-common.scm index 4b4e217..827e8a9 100644 --- a/posix-common.scm +++ b/posix-common.scm @@ -417,24 +417,13 @@ EOF ((pproc f) (loop rest (action f r))) (else (loop rest r)) ) ) ) ) ) ) ) -(define (find-files dir . args) - (cond ((or (null? args) (not (keyword? (car args -;; old signature - DEPRECATED -(let-optionals args ((pred (lambda _ #t)) - (action (lambda (x y) (cons x y))) ; we want `cons' inlined - (id '()) - (limit #f) ) - (##sys#find-files dir pred action id limit #t #f 'find-files))) - (else -(apply - (lambda (#!key (test (lambda _ #t)) -(action (lambda (x y) (cons x y))) ; s.a. -(seed '()) -(limit #f) -(dotfiles #f) -(follow-symlinks #t)) - (##sys#find-files dir test action seed limit follow-symlinks dotfiles 'find-files)) - args +(define (find-files dir #!key (test (lambda _ #t)) + (action (lambda (x y) (cons x y))) + (seed '()) + (limit #f) + (dotfiles #f) + (follow-symlinks #t)) + (##sys#find-files dir test action seed limit follow-symlinks dotfiles 'find-files)) ;;; umask -- 1.7.2.5 ___ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers