This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-02
Channels
- # adventofcode (286)
- # aws (3)
- # beginners (243)
- # calva (4)
- # cider (51)
- # cljs-dev (8)
- # clojure (74)
- # clojure-conj (1)
- # clojure-france (1)
- # clojure-italy (1)
- # clojure-spec (21)
- # clojure-uk (22)
- # clojurescript (25)
- # clojurex (6)
- # code-reviews (5)
- # core-async (3)
- # cursive (1)
- # defnpodcast (1)
- # fulcro (29)
- # mount (1)
- # off-topic (85)
- # onyx (5)
- # other-languages (7)
- # pathom (6)
- # pedestal (6)
- # re-frame (20)
- # reagent (2)
- # reitit (8)
- # ring-swagger (10)
- # shadow-cljs (53)
- # spacemacs (8)
- # tools-deps (34)
I'm trying to tackle TDEPS-56, but am having trouble building the project. I've discovered two repos, brew-install and tools.deps.alpha. In the former I can run
cd src/main/resources && bash -x install.sh ~/tmp
but that fails because *.jar
is missingPresumably the jar is built from the tools.deps.alpha repo, but am I supposed to copy that over to brew-install/src/main/resources ?
Next up, I'm running into this issue:
bin/clojure: line 174: $install_dir/libexec/clojure-tools-${project.version}.jar: bad substitution
${project.version}
is not valid Bash syntax so that must be related to the maven "filtering" feature
looks like I was confused - master
in the brew-install
repo is an outdated branch
ok figured it out - in a nutshell you need to go through the package.sh
script and before that mvn install
tools.deps.alpha (also point the pom to the snapshot version you're testing)
yes, exactly
Added a patch: https://dev.clojure.org/jira/browse/TDEPS-56?focusedCommentId=50847#comment-50847 cc: @seancorfield @dottedmag
@U06F82LES I share Alex's concern about both the eval
aspect and the lack of compatibility with existing cached .main
files -- I wonder if the script could verify the file contents, ensuring it was all \c\h\a\r\a\c\t\e\r\s and only calling eval
in that case? I think that would retain compatibility with existing files and also address the security issue? /cc @U064X3EF3
I think we should not use eval. I think probably it would be best to read the file as an array and then array splat it into the command line. I think that largely fixes the spacing problem, but not sure what still needs to be solved for quoting.
happy to try a different tack
to read the file into an array from dash, we'll need to use a separator
were you thinking of separating arguments by newline?
do you need a separator? I thought space was the separator
right, then we'll need to escape space
so we'd write this
-co {:aot-cache\ true}
do you? the whole idea here is to write the string with spaces, then read it back into an array (breaking on spaces), then drop that into the args list
I think that’s actually fine and the issue is really what happens when you have Clojure quoted things inside the args
here's how I'm thinking it could it could work: - in the clojure code, we'd replace " " with "\\ " and "\\" with "\\\\" - in the bash code, we'd read the file char by char, replace "\\ " with a space, replace "\\\\" with "\\" and else when encounter an unescaped space, start a new argument
we'd basically implement our own quote/unquote scheme
the main point is that space-as-arg-separator and space-as-literal-space need to be distinguished in the bash code
newline separator might also be a better choice - I think you may be able to automatically get some of what we want by changing the IFS too
ideally, I think the main file should have as little markup as possible
sure, though the main-opts strings may contain newlines as well
the less magic that’s in the Clojure code the better. we’re just creating portability problems the more coordination is required between these two pieces of code
agreed
maybe keep a Windows version in mind as well
I think new lines in the args is much less common than multi-word / quoting
I am keeping Windows in mind :) (I suspect powershell has better options for this stuff though)
I need to do some other stuff, checking out
even newlines aren't common, it shouldn't break if they do appear
i'll give it another try
Using newlines as arg separators, I wrote an explode
Bash function that takes a string and generates an array: https://github.com/clojure/brew-install/pull/3/files#diff-b3212e45e19f61de4754a755466b793f - it allows you to escape newlines by prefixing them with a backslash. So the file format is simple.
If that looks like the right direction, I'll prepare a new patch