[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Prevent running applications from crashing
From: |
Peter Bex |
Subject: |
Re: [Chicken-hackers] [PATCH] Prevent running applications from crashing when reinstalling |
Date: |
Thu, 4 Oct 2012 21:23:06 +0200 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Oct 04, 2012 at 08:27:43PM +0200, Felix wrote:
> Here a suggestion which ought to work better:
>
> diff --git a/setup-api.scm b/setup-api.scm
> index 50ab484..0f54b9c 100644
> --- a/setup-api.scm
> +++ b/setup-api.scm
> @@ -509,6 +509,9 @@
> (directory from)))
> (else
> (ensure-directory to)
> + (when (and (file-exists? to)
> + (not (directory? to)))
> + (remove-file* to))
> (run (,*copy-command*
> ,(shellpath from)
> ,(shellpath to))))))
This doesn't fix things like setup-api where "from" is a .so-file
and "to" is a directory. This will still cause a crash for those eggs.
I'm not sure whether we can expect people to just pass a proper copy
command, or if we need to handle this case properly.
This is probably more thorough:
diff --git a/setup-api.scm b/setup-api.scm
index 50ab484..fed6b67 100644
--- a/setup-api.scm
+++ b/setup-api.scm
@@ -509,9 +509,13 @@
(directory from)))
(else
(ensure-directory to)
- (run (,*copy-command*
- ,(shellpath from)
- ,(shellpath to))))))
+ (let ((to-file (if (directory? to)
+ (make-pathname to (pathname-strip-directory
from))
+ to)))
+ (remove-file* to-file)
+ (run (,*copy-command*
+ ,(shellpath from)
+ ,(shellpath to-file)))))))
to))
(define (path-prefix? pref path)
> Since all that file-handling mess in setup-api.scm confuses me, I
> can't say that I'm absolutely sure that this handles all cases (We
> need a new setup API - one that is so simple and straightforward that
> it just can not be used wrongly).
I agree, but this will take quite a while. In the meanwhile, this might
be a nice fix.
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