chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Make chicken-install create the destinatio


From: lemonboy
Subject: Re: [Chicken-hackers] [PATCH] Make chicken-install create the destination folder
Date: Tue, 26 Apr 2016 15:33:35 +0200

Indeed the unless can be entirely dropped, at first I wanted to add an
informative message but then decided it wouldn't be really useful.
Attached is the (silly) updated patch, if you feel it should handle
the case where the target is an existing file it could be added in
another patch.

On 25 April 2016 at 22:54, Mario Domenech Goulart
<address@hidden> wrote:
> On Mon, 25 Apr 2016 22:30:08 +0200 lemonboy <address@hidden> wrote:
>
>> I was wondering why my fresh chicken5 install was acting up only to
>> discover that when initializing the eggs repository using
>> chicken-install's -i switch I had supplied a non-existing folder; the
>> tool then ends up copying all the files, one over another, in the path
>> specified by the user.
>> Attached is a patch against the chicken-5 branch that fixes the problem.
>>
>> From b3b7cec9a18360bf6c1aa9904076f4c62701613b Mon Sep 17 00:00:00 2001
>> From: LemonBoy <address@hidden>
>> Date: Mon, 25 Apr 2016 22:23:41 +0200
>> Subject: [PATCH] Create the destination folder for the -i command
>> To: address@hidden
>>
>> ---
>>  chicken-install.scm | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/chicken-install.scm b/chicken-install.scm
>> index a9e25ba..9d9fcd9 100644
>> --- a/chicken-install.scm
>> +++ b/chicken-install.scm
>> @@ -230,6 +230,8 @@
>>            (copy (if *windows-shell*
>>                      "copy"
>>                      "cp -r")))
>> +      (unless (directory-exists? dir)
>> +        (create-directory dir))
>>        (print "copying required files to " dir " ...")
>>        (for-each
>>         (lambda (f)
>
> Nice catch.  However, I think it'd be better to just call
> (create-directory dir #t).  It's shorter and handles nested non-existing
> directories.
>
> On the other hand, `create-directory' is a bit broken, in my opinion
> (but that's another issue -- maybe for CHICKEN 5).  It's subject to race
> conditions and will happily succeed if you give it an argument which is
> any filesystem object to which file-exits? return a string (e.g., a
> regular file).  In its defense, this behavior is documented.
>
> All the best.
> Mario
> --
> http://parenteses.org/mario
>
> _______________________________________________
> Chicken-hackers mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Attachment: 0001-Create-the-destination-folder-for-the-i-command.patch
Description: Text Data


reply via email to

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