chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH 3/4] Remove ##sys#expand-home-path.


From: Florian Zumbiehl
Subject: Re: [Chicken-hackers] [PATCH 3/4] Remove ##sys#expand-home-path.
Date: Mon, 18 Mar 2013 19:46:41 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

Hi,

> If we keep the ~-expansion, any safe code that use the filesystem API
> will have to resort to tricks like 
> 
>   (operation (if (absolute-pathname? the-path)
>                  the-path
>                  (make-pathname (current-directory) the-path)))
> 
> to guard against input that would cause unintended expansions.  In the
> end, we'd have just the opposite of convenience (obviously, _if_ you
> _remember_ to use the trick to avoid expansions).

Thank you for demonstrating how that kind of API also tends to breed broken
workarounds due to cognitive overload.

Your code has a potential race condition, as your CWD can be renamed and a
different directory placed at the old name in between current-directory and
the subsequent pathname resolution performed by operation, so the semantics
would differ from a non-expanding operation.

Given that there is qs for shell quoting, why not have something similarly
short for (partial) shell expansion, so it's reasonably easy for
interactive use?

Regards, Florian



reply via email to

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