Summary
chicken-install srfi-18 fails on Windows
Metadata
- Id: b5dec762d76e08d9b39cb3c9d418297b058ce6be
- Trac id: 1727
- Type: defect
- Reporter: Josh
- Owner:
- Cc:
- Status: closed
- Component: unknown
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone: 5.3
- Version: 5.2.0
- Changetime: 2021-07-30 05:58:48 UTC
- Created: 2021-01-28 21:45:05 UTC
- Keywords:
Attachments
- b5dec762d76e08d9b39cb3c9d418297b058ce6be/attachments/0001-Correctly-quote-set-calls-in-Windows-scripts.patch
Description
The culprit appears to be improper path escaping:
C:\>chicken-install srfi-18
building srfi-18
C:\Users\j\AppData\Local\chicken-install\srfi-18\build-srfi-18.bat -host -D compiling-extension -J -s -regenerate-import-libraries -setup-mode -I C:\Users\j\AppData\Local\chicken-install\srfi-18 -C -IC:\Users\j\AppData\Local\chicken-install\srfi-18 -O2 -d1 srfi-18.scm -o C:\Users\j\AppData\Local\chicken-install\srfi-18\srfi-18.so
'""C:' is not recognized as an internal or external command,
operable program or batch file.
1 file(s) copied.
'""C:' is not recognized as an internal or external command,
operable program or batch file.
Error: shell command terminated with nonzero exit code
1
"C:\\Users\\j\\AppData\\Local\\chicken-install\\srfi-18\\srfi-18.build.bat"
C:\>
Changes and comments
[2021-01-29 08:31:32 UTC] sjamaan wrote:
Hi there! I think this isn't a SRFI-18 specific problem, but rather a `chicken-install` problem.
It looks like you might have missed the CHICKEN build instructions from the `README` file:
- When installing under mingw, with a windows shell
("cmd.exe"), pass an absolute pathname (including the
drive letter) as PREFIX and use forward slashes. If you
are building the sources from git, use backslashes to
specify the path to `chicken' (the "CHICKEN" variable).
Note that this requires you to use forward slashes, probably because of this issue. Of course, if you can fix CHICKEN and `chicken-install` specifically to make it work with backslashes that would be great too.
[2021-01-30 19:51:24 UTC] timerooney wrote:
Hey, I've also had this problem with some eggs in the past on Windows. I've been able to get around it when it pops up by removing some extra quotes in the build-*.bat files.
The problem seems to be that %CHICKEN_CSC% and %CHICKEN_CSI% are already quoted, but some of the batch files themselves quote the variable, causing doubled quotes that Windows cannot handle.
I believe that this should be all of the affected eggs:
; In
$ grep --include=*.bat -rw . -e '"%CHICKEN_CSC%"' -e '"%CHICKEN_CSI%"' | awk -F "/" '{ print $2 }'
; Out
breadline
imlib2
openssl
socket
srfi-18
taglib
[2021-04-11 19:41:06 UTC] wasamasa wrote:
I've looked into this today and discovered that we might need to do a breaking change. Windows handles quoting differently when applied to environment variables:
C:\Users\me> set JAVA="C:\path\to\java" C:\Users\me> echo %JAVA% "C:\path\to\java" C:\Users\me> echo "%JAVA%" ""C:\path\to\java"" C:\Users\me> %JAVA% -version openjdk version "11.0.8" 2020-07-14 [...] C:\Users\me> "%JAVA%" -version '""C:' is not recognized as an internal or external command, operable program or batch file.
In fact, quotes aren't permitted in paths. If I inspect the environment variables on my Windows machine, it may look like this:
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;[...]
Which is not what egg-compile.scm does:
(printf #<<EOF
@echo off~%
set PATH=~a;%PATH%
set CHICKEN_CC=~a
set CHICKEN_CXX=~a
set CHICKEN_CSC=~a
set CHICKEN_CSI=~a
EOF
(qs* default-bindir platform) (qs* default-cc platform)
(qs* default-cxx platform) (qs* default-csc platform)
(qs* default-csi platform))
{{{
C:\Users\me> set "JAVA=C:\path\to\java"
C:\Users\me> echo %JAVA%
C:\path\to\java
C:\Users\me> echo "%JAVA%"
"C:\path\to\java"
C:\Users\me> %JAVA% -version
'""C:' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\me> "%JAVA%" -version
openjdk version "11.0.8" 2020-07-14
[...]
I believe that to be the correct behavior and am willing to write a patch to implement it. However it will require every single egg installable on Windows (I've found nine with a .bat file) to use quoting for the CHICKEN_CSC, CHICKEN_CSI, CHICKEN_CC and CHICKEN_CXX variables, otherwise the scripts will break on every installation that contains spaces in its installation path. On the upside, this would relieve me from fixing the above six scripts, five of which I'm directly responsible for :)
[2021-04-11 19:41:06 UTC] wasamasa wrote:
1618163279938017
[2021-04-11 20:06:32 UTC] wasamasa attached 0001-Correctly-quote-set-calls-in-Windows-scripts.patch (description=#f)
[2021-04-11 20:07:24 UTC] wasamasa wrote:
Here's an untested patch that should resolve the reported problem. If it's accepted, I'll look into adjusting the three remaining eggs to quote CHICKEN_CSC and CHICKEN_CSI.
[2021-04-19 18:44:00 UTC] wasamasa wrote:
I've tested the patch successfully using "PREFIX=C:/chicken 5.2.0" for my new installation. Both the srfi-18 and taglib egg (socket egg flaked out due to WINAPI nonsense) have been installed successfully using it. As mentioned earlier, I'd submit patches to the sendfile, kiwi and bind eggs.
[2021-04-19 18:44:00 UTC] wasamasa wrote:
1618852216263597
[2021-04-21 11:34:16 UTC] sjamaan changed milestone from someday to 5.4
[2021-04-21 11:40:13 UTC] sjamaan changed milestone from 5.4 to 5.3
[2021-05-16 15:55:37 UTC] wasamasa wrote:
I've tested it now with Cygwin in addition to my previous test with mingw64-msys2, seems like Cygwin isn't affected by the patch at all. So that's one less thing to worry about.
[2021-07-30 05:58:48 UTC] evhan changed status from new to closed
[2021-07-30 05:58:48 UTC] evhan set resolution to fixed
[2021-07-30 05:58:48 UTC] evhan wrote:
This should be fixed by 278c2477.