This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-04
Channels
- # adventofcode (100)
- # announcements (7)
- # architecture (1)
- # aws (14)
- # beginners (209)
- # calva (30)
- # cider (5)
- # cljdoc (2)
- # cljs-dev (37)
- # cljsrn (2)
- # clojure (133)
- # clojure-dev (20)
- # clojure-finland (1)
- # clojure-italy (10)
- # clojure-nl (19)
- # clojure-spec (56)
- # clojure-uk (49)
- # clojurescript (57)
- # clojurex (8)
- # core-async (2)
- # core-logic (1)
- # cursive (38)
- # data-science (19)
- # datomic (28)
- # devcards (3)
- # duct (8)
- # emacs (28)
- # figwheel (1)
- # figwheel-main (31)
- # fulcro (2)
- # jobs (1)
- # kaocha (1)
- # klipse (2)
- # mount (6)
- # nrepl (43)
- # off-topic (20)
- # pathom (3)
- # pedestal (1)
- # re-frame (15)
- # ring-swagger (1)
- # shadow-cljs (47)
- # spacemacs (19)
- # sql (20)
- # tools-deps (58)
- # unrepl (13)
- # vim (5)
does tools.deps support git deps that have an edn file in a subdirectory? do you have to reflect this in the git url?
Specifically for use with REBL and openjdk, is there a way to tell REBL bring in the correct version of JavaFX as part of the extra-deps? I don't actually need it at the moment (I switched to the Java version to get it to work), but it seems like it would be useful to prevent problems (I ran into it on 2 of my machines that I use regularly for Clojure work).
It's a pity that existing .main
-files are lossy: both arguments are separated by spaces and spaces within arguments are written as spaces.
@dottedmag you mean via :main-opts
?
Any idea how to invalidate those? I could use readarray
Bash builtin to read \0-delimited file into a Bash array.
Hmm, I can change $ck
, but that invalidate all existing cached files, no matter if :main-opts
had had spaces in them or not.
@alexmiller ^ would that be acceptable?
https://dev.clojure.org/jira/browse/TDEPS-56 š some work is happening now. Ideas are being thrown around. \0 delimiters might be interesting, but can't parameters have \0 in them?
@dominicm That's the ticket I'm working on. No, Bash cannot keep \0 in variables or arguments.
There is even a hack in Bash to use ''
as a "delimiter" to denote "use \0 as a delimiter".
Also, execve(2)
API accepts NUL-terminated strings, so no way \0
can be passed through.
Well, the patch itself is not so complicated. The only remaining issue is backward compatibility with previously written .main
files.
On a personal note, it seems to me that updating clj
may/should invalidate all my caches
it is supposed to, as the install-level deps.edn is included in the cache calculation
but āinvalidateā != ādeleteā
as the idea of writing a script that goes around rmāing your dirs scares the crap out of me
using a .main2 seems perfectly acceptable too
I wonder if this would be usable for the string-splitting problem: http://mywiki.wooledge.org/BashPitfalls#hosts.3D.28_.24.28aws_....29_.29
...or if it would be acceptable to fall back to a tool written to handle this kind of thing, like awk
or something
...or if the string could be written to .main
separated by commas, and then read into the array on the bash side via readarray -d ,
would prefer to a) not add any additional deps if at all possible and b) have the clojure program write something as dumb and obvious as possible to the .main file
@alexmiller Only locations of install-level deps.edn
files are included in the key of cache, not their contents, right?
i'd like to point out that I've put some thought into this and proposed a solution for quoting: https://github.com/clojure/brew-install/pull/3/files#diff-b3212e45e19f61de4754a755466b793f
(and submitted a first pass at a patch)
@alexmiller How about this one? Or I can do .main2
, it's even simpler.
if I'm not on the right track, happy if others take a swing at this, but I wouldn't want effort needlessly wasted if possible
discussion here: https://clojurians.slack.com/archives/C6QH853H8/p1543759744032700
@pesterhazy Seems much easier to do \0
-based output and read back using readarray
like this:
- main_cache_opts=($(cat "$main_file"))
+ declare -a main_cache_opts
+ readarray -d '' -t main_cache_opts < "$main_file"
@pesterhazy t.d.a change is also trivial:
--- a/src/main/clojure/clojure/tools/deps/alpha/script/make_classpath.clj
+++ b/src/main/clojure/clojure/tools/deps/alpha/script/make_classpath.clj
@@ -76,7 +76,7 @@
(when (.exists jf)
(.delete jf))))
(if-let [main-opts (seq (get (deps/combine-aliases deps-map (concat aliases main-aliases)) :main-opts))]
- (io/write-file main-file (str/join " " main-opts))
+ (io/write-file main-file (str/join "\u0000" main-opts))
(let [mf (jio/file main-file)]
(when (.exists mf)
(.delete mf))))))
@pesterhazy I have to go right now, so I can't finish it at the moment.
sorry, I donāt have time to work on this atm but will hopefully have a slice of deps time in a day or two
@pesterhazy I don't mind if you pick it up from here, if you think this approach is good enough.
if there are two (or N) options, thatās fine, just describe the tradeoffs in a table (and separate the file impl aspect from the ānot breaking existing stuffā aspect - those I think are orthogonal)
the obvious downside of readarray
is that it's not available in bash3, which is what ships with macOS
I think that rules it out
also not sure how reliable reading NUL character in bash is - that's the kind of thing where bash if flaky
according to this https://stackoverflow.com/a/6571549/239678: "In Bash, you can't store the NULL-character in a variable."
many languages with C strings have trouble with NUL characters in strings, for the obvious reasons
As of now all NUL-characters are stripped from .main
when read by Bash, so no backward compatibility problems here.
well try it - I didn't have luck reading the "\\ " character sequence using read
no it's not backward compatible - it would turn potentially multiple arguments into a single argument, i.e. change the semantics
I don't think there's a way around using a different file extension
$ echo '00000000: 310032003300' | xxd -r | while read -r -d '' i; do printf ">$i<\n"; done
>1<
>2<
>3<
@pesterhazy By backward compatibility I meant backward compatibility for code that relied on \u0000
passed from deps.edn
unchanged to the app. But that didn't work, so we don't need to care about it.
@alexmiller I've updated the ticket with a summary
The ticket doesn't mention back porting readarray, https://stackoverflow.com/a/49322365 has some hints. Would this work?