Re: [PATCH] Partial fix for #1685

2021-05-20 Thread Mario Domenech Goulart
On Thu, 20 May 2021 10:06:56 +0200 Peter Bex  wrote:

> Here's a more "official" version of Mario's patch for #1685, which
> works on UNIX only.  For Windows we'll probably need to overhaul
> egg-compile.scm into some sort of structured system instead of using
> ad-hoc quoting, because on Windows it is context-dependent how one
> should quote variables and paths (see #1727 for more details).
>
> To me this would be more suitable to fully (i.e. also Windows) fix it
> in 5.4, but the UNIX path quoting seems to me like a trivial and nice
> improvement to go into 5.3 already.

Thanks, Peter.  I've pushed the patch.

All the best.
Mario
-- 
http://parenteses.org/mario



[PATCH] Partial fix for #1685

2021-05-20 Thread Peter Bex
Hi all,

Here's a more "official" version of Mario's patch for #1685, which
works on UNIX only.  For Windows we'll probably need to overhaul
egg-compile.scm into some sort of structured system instead of using
ad-hoc quoting, because on Windows it is context-dependent how one
should quote variables and paths (see #1727 for more details).

To me this would be more suitable to fully (i.e. also Windows) fix it
in 5.4, but the UNIX path quoting seems to me like a trivial and nice
improvement to go into 5.3 already.

Cheers,
Peter
From 9fd1dda69f0f5edd0db1b13078116c16c77880dc Mon Sep 17 00:00:00 2001
From: Peter Bex 
Date: Thu, 20 May 2021 09:57:17 +0200
Subject: [PATCH] Partial fix for #1685 - quote shell variables on UNIX
 platforms

This allows having shell metacharacters (like spaces) in path names.
This does not yet fix the situation for Windows - there, quotation
is context-dependent, so quite a bit harder to fix properly.

Signed-off-by: Peter Bex 
---
 NEWS| 2 ++
 egg-compile.scm | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index c5eb0f03..7f9faecd 100644
--- a/NEWS
+++ b/NEWS
@@ -65,6 +65,8 @@
 `Error: (string->number) bad argument type: #!eof` in some cases.
   - If chicken-install has a program prefix/suffix, it now writes to a
 cache directory matching its program name (#1713, thanks to Alice Maz)
+  - Fixed bug in chicken-install regarding variable quotation on UNIX-like
+systems which prevented installation into paths with spaces (#1685).
 
 5.2.0
 
diff --git a/egg-compile.scm b/egg-compile.scm
index a4c4bf0c..186a7227 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -1239,7 +1239,7 @@ EOF
 
 (define (shell-variable var platform)
   (case platform
-((unix) (string-append "${" var "}"))
+((unix) (string-append "\"${" var "}\""))
 ((windows) (string-append "%" var "%"
 
 ;; NOTE `cmd' must already be quoted for shell
-- 
2.20.1



signature.asc
Description: PGP signature