~ chicken-core (chicken-5) bc03800a86f85469075f58c40ab4ba98ff9b3cab


commit bc03800a86f85469075f58c40ab4ba98ff9b3cab
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Sat Apr 22 15:12:50 2017 +0200
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Sun Apr 23 14:14:07 2017 +1200

    Fix #1169 by deleting the egg-info file before (re)creating it
    
    If the user used "chicken-install" without sudo before, and later they
    use "chicken-install -s" to reinstall the same egg, the egg-info file
    will still exist. This means the shell redirect will simply clobber the
    existing file. Removing it first and then writing it will ensure the
    file is using the new owner and umask.
    
    Signed-off-by: Evan Hanson <evhan@foldling.org>

diff --git a/egg-compile.scm b/egg-compile.scm
index ba277b7f..0567c986 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -698,6 +698,8 @@ EOF
 
 (define ((install-suffix mode name info) platform)
   (let* ((infostr (with-output-to-string (cut pp info)))
+         (dcmd (remove-file-command platform))
+         (mkdir (mkdir-command platform))
          (dir (destination-repository mode))
          (qdir (quotearg (slashify dir platform)))
          (dest (quotearg (slashify (make-pathname dir name +egg-info-extension+)
@@ -707,18 +709,21 @@ EOF
       ((unix)
        (printf #<<EOF
 
-mkdir -p ~a~a
+~a ~a~a
+~a ~a~a
 cat >~a~a <<ENDINFO
 ~aENDINFO~%
 EOF
-               ddir qdir ddir dest infostr))
+               mkdir ddir qdir
+               dcmd ddir dest
+               ddir dest infostr))
       ((windows)
        (printf #<<EOF
 
-mkdir ~a~a
+~a ~a~a
 echo ~a >~a~a~%
 EOF
-               ddir qdir 
+               mkdir ddir qdir
                (string-intersperse (string-split infostr "\n") "^\n\n")
                ddir dest)))))
 
Trap