chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH] Fix #1079 by ripping out pathname expansion an


From: Peter Bex
Subject: [Chicken-hackers] [PATCH] Fix #1079 by ripping out pathname expansion and putting it into an egg [Was: Re: [PATCH] add pathname-expand]
Date: Sun, 22 Jun 2014 13:43:22 +0200
User-agent: Mutt/1.4.2.3i

On Wed, Nov 13, 2013 at 01:05:55PM +0000, Mario Domenech Goulart wrote:
> Hi Felix and all,
> 
> Getting rid of [pathname expansion] is the simplest approach.
> There are other ones, though.  Here are some of them:
> 
> * move pathname-expand to an egg.  From users standpoint, I think it
>   won't make a big difference between having pathname-expand in the core
>   or in an egg.  It's something new anyway.  Having it as an egg can
>   actually be a win in the end: it would be available to older chickens
>   (although it wouldn't do anything, since pathname expansion is
>   implicit).  But at least applications wouldn't break on an "Unbound
>   variable: pathname-expand" error.  If pathname-expand is in the core,
>   programs that use it will have a hard dependency on CHICKEN 4.9.0.

I have now implemented Felix's "pathname-expand" patch as an egg (see
http://wiki.call-cc.org/eggref/4/pathname-expand).  I've made a few small
modifications:

- The strings "~" and "~~" are also expanded, as are strings with a
   prefix of "~/" and "~~/" (but NOT "~~foo", and "~foo" has the
   existing meaning of expanding too user foo's homedir)
- The homedir is determined whenever it's required.  This allows
   privilege dropping and user switching to work "correctly",
   in that the actual user id determines which homedir you get.
- In case no user is found, we still raise an error, but I've added
   a specific exception subtype so that it can be caught more easily.
- In case the repository path is undefined (can this be?), we raise
   an exception instead of using the current directory.

I think we don't need to detect when it's running in an older CHICKEN,
because in most situations when directories are expanded multiple times,
they will be identical to the strings you get after only one expansion.
By not stubbing out the procedures with no-ops, we nail down the
behaviour more exactly, even in older CHICKENs.

It's an egg, so if you disagree on the specifics, feel free to fix it
and tag a new release.

Attached is an updated version of Florian's patch to remove all implicit
expansion from CHICKEN core.

Cheers,
Peter
-- 
http://www.more-magic.net

Attachment: 0001-Remove-sys-expand-home-path-as-shell-expansion-has-n.patch
Description: Text document


reply via email to

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