Fork me on GitHub
#tools-deps
<
2022-11-01
>
athos05:11:13

Removing that semicolon resolved the issue for me

tskardal16:11:55

For me too! Thanks 🙂

tskardal16:11:30

Should this be reported in some way?

Alex Miller (Clojure team)16:11:12

is it valid to remove that semicolon in other shells?

tskardal18:11:37

I don’t think the shell is relevant here. At least for me the issue is present in bash and zsh too.

Alex Miller (Clojure team)19:11:29

well what is relevant? that is, this does work now for lots of people, so what determines whether it works or not for different people?

tskardal19:11:02

I thought you meant that this “fixes” fish shell, but maybe breaks bash (or others). Maybe I misunderstood. I did some reading, and experimenting. If I understand it correctly, with the semicolon, the IFS variable remains : until printing the map . When removing the semicolon it doesn’t really get changed? And perhaps the classpath check isn’t really working? (not sure what’s happening there) Maybe it should be like this?

# Are .jar files in classpath missing?
  oldIFS="$IFS"
  IFS=':'; read -ra cp_entries <<<"$(cat $cp_file)"
  for cp_entry in "${cp_entries[@]}"; do
    if [[ "$cp_entry" == *.jar && ! -f "$cp_entry" ]]; then
      stale=true
      break
    fi
  done
  IFS="$oldIFS"
Disclaimer: I don’t know what. I’m doing 😅

Alex Miller (Clojure team)19:11:41

the intent here is that using it in the same line means that it is set only for the subcommand in the read and set back after the read

Alex Miller (Clojure team)19:11:47

I mean you don't have to figure it out if you don't know already, but this is work I'll have to do

Alex Miller (Clojure team)19:11:20

and I'm trying to figure out why it doesn't work on your machine so I can at least verify that I've fixed it after, and I still don't understand that

Alex Miller (Clojure team)19:11:38

seems like maybe this has to do with the scope of that IFS setting and the intent not being satisfied that this only is in effect on that one read call

tskardal19:11:38

I see. If you echo "$IFS" on the line below I expect you to see it is still :. And that it doesn’t really just apply to that statement.

Alex Miller (Clojure team)19:11:26

and then that IFS setting affects printing later on some shells?

tskardal19:11:58

I’m not sure why it does, but seems so, yes.

tskardal19:11:38

I’m on GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21) - could it be related to the bash version? As it is bash script after all, and I guess what shell you run it from doesn’t matter.

tskardal19:11:15

I created a script to reproduce it, and it works fine in GNU bash, version 5.1.4(1)-release (arm-unknown-linux-gnueabihf)

tskardal19:11:26

I mean, the colon doesn’t disappear there, but it does when running it on my mac.

Alex Miller (Clojure team)19:11:09

I'm running a newer bash than that and it works fine for me

Alex Miller (Clojure team)19:11:24

but yes, I suspect it's likely bash version related

tskardal19:11:34

yes, upgrading bash on my mac removes the problem 🎉

Alex Miller (Clojure team)19:11:53

I try not to depend too much on having a recent version of bash though so I will look at it eventually

lread00:11:11

I've just experienced this same symptom for v1.11.1.1182 on GitHub Actions on macOS.

lread00:11:05

Running clojure -Sdescribe as a run step seems to work fine. But when I spawn the same from a bb script to capture output the colons are missing.

Alex Miller (Clojure team)05:11:50

released that in 1.11.1.1189

lread13:11:54

Thanks @alexmiller! New version works as expected on GitHub Actions macOS.

tskardal06:11:45

Interesting, @athos! I'll try it out as soon as I get back to my mac 🙂 @pithyless that could be, but it works fine with fish on linux 🤷

seancorfield19:11:06

@alexmiller I'm seeing something very odd with the CLI/deps cache -- I run this command to generate a classpath at work:

clojure -Spath -A:build:dev:everything:runner:test
but every now and then, instead of returning the full classpath as expected (with hundreds of entries), I get back just the bare Clojure deps as if I had run clojure -Spath (with no aliases). Is it possible there's a hash collision for the filenames used in .cpcache? If I blow away .cpcache (or use -Sforce), it produces the full classpath again (of course).

Alex Miller (Clojure team)19:11:05

it's actually basically using a crc checksum of the concat'ed alias names (simplifying a little), certainly could be non-unique

Alex Miller (Clojure team)19:11:59

on that particular example, I get a string value of val=||:build:dev:everything:runner:test||||||/usr/local/Cellar/[email protected]/1.11.1.1182/deps.edn|/Users/alex.miller/.clojure/deps.edn|deps.edn which yields cksum of 3992683027

seancorfield19:11:25

If deps.edn changes, would it recompute the cached data?

seancorfield19:11:02

I thought it would but wanted to check.

Alex Miller (Clojure team)19:11:10

the stale check hits all the deps.edn files, any local manifest files, and will also become stale now on missing .jar files

Alex Miller (Clojure team)19:11:13

if you catch it again, throw a -Sverbose on there to see the cp_file and grab that set of files, then -Sforce and compare

seancorfield19:11:22

OK, I'll remove the -Sforce I've added to prevent the problem and I'll keep an eye on it...

Alex Miller (Clojure team)19:11:26

seems unlikely you'd hit a collision with no aliases though, so maybe worth thinking about other ways you could see that result

Alex Miller (Clojure team)19:11:28

or restating, if that was the collision, seems like you'd see it all the time

Alex Miller (Clojure team)19:11:48

for example, if you missing a file system fsync and did not see the just written file at all, you'd have the same result?

Alex Miller (Clojure team)20:11:01

mac is well known to cheat fsync for example and not actually flush necessarily

seancorfield20:11:43

This is Windows/WSL2.

Alex Miller (Clojure team)20:11:56

if you retry without force, do you still get the bare path?

Alex Miller (Clojure team)20:11:37

if so, I presume the file contents has the shorter path and the problem is in building the classpath (or it's a cksum collision)

seancorfield20:11:09

After a force, it produces the right classpath for quite a while. I need to figure out what action somewhere in the system is causing the overwrite. Will keep you posted. It happens pretty often.

seancorfield00:11:41

OK, it happened today. Here's the verbose output trying to run the CLI after it created the wrong path etc:

(/Developer/workspace/wsmain)-(!2092)-> (cd clojure/ && clojure -Sverbose -Spath -A:build:dev:everything:runner:test)
version      = 1.11.1.1182
install_dir  = /var/www/worldsingles/build/clojure
config_dir   = /home/sean/.clojure
config_paths = /var/www/worldsingles/build/clojure/deps.edn /home/sean/.clojure/deps.edn deps.edn
cache_dir    = .cpcache
cp_file      = .cpcache/1422105138.cp

src:/home/sean/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar:/home/sean/.m2/repository/org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar:/home/sean/.m2/repository/org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar

Wed Nov 02 17:33:45
(/Developer/workspace/wsmain)-(!2093)-> (cd clojure/ && tar cvzf /mnt/c/Users/seanc/Downloads/tda_debug.tgz .cpcache/1422105138.*)
.cpcache/1422105138.basis
.cpcache/1422105138.cp
.cpcache/1422105138.libs
I'll attach that tgz file...

seancorfield00:11:49

LMK if this helps:

seancorfield00:11:46

Running it with force fixes the problem:

(/Developer/workspace/wsmain)-(!2095)-> (cd clojure/ && clojure -Sverbose -Sforce -Spath -A:build:dev:everything:runner:test)
version      = 1.11.1.1182
install_dir  = /var/www/worldsingles/build/clojure
config_dir   = /home/sean/.clojure
config_paths = /var/www/worldsingles/build/clojure/deps.edn /home/sean/.clojure/deps.edn deps.edn
cache_dir    = .cpcache
cp_file      = .cpcache/1422105138.cp

Refreshing classpath
... giant classpath removed ...
and you can see the sizes of the files now which are expected:
(/Developer/workspace/wsmain)-(!2096)-> ls -l clojure/.cpcache/1422105138.*
-rw-r--r-- 1 sean sean 395258 Nov  2 17:39 clojure/.cpcache/1422105138.basis
-rw-r--r-- 1 sean sean  48481 Nov  2 17:39 clojure/.cpcache/1422105138.cp
-rw-r--r-- 1 sean sean    597 Nov  2 17:39 clojure/.cpcache/1422105138.jvm
-rw-r--r-- 1 sean sean 211646 Nov  2 17:39 clojure/.cpcache/1422105138.libs
-rw-r--r-- 1 sean sean  13604 Nov  2 17:39 clojure/.cpcache/1422105138.manifest

Alex Miller (Clojure team)04:11:47

did this start happening with the latest release?

seancorfield04:11:32

I hadn't seen this happening until recently so I think it's a new failure mode, yes.

seancorfield04:11:04

This is why I was asking about the hash (crc) thing because the cache file has the "right" number for the aliases etc -- it's always 1422105138 for that invocation (when it works) but sometimes it seems to act as if it ignored the aliases (after calculating the correct hash/crc).

seancorfield04:11:05

I haven't looked at the shell script, but is it possible that two concurrent runs of the CLI script could interfere with each other? Does it use any fixed temporary file paths, anything like that?

seancorfield04:11:11

I ask because this seems to coincide with me restarting LSP in VS Code which I have configured to a CLI script to generate the classpath because of the workspace / repo structure I have.

Alex Miller (Clojure team)04:11:58

it may be related to the other issue that's being discussed re IFS and I've just released 1.11.1.1189 if you want to bump to that and see if things change

seancorfield04:11:26

OK, I'll make a note to try that tomorrow at work.

seancorfield04:11:32

Since it's happening every day or two, I should have a reasonable level of comfort deciding whether that's a fix or not 🙂

Alex Miller (Clojure team)04:11:41

really, that's the only change that I can think of that would be related to this

Alex Miller (Clojure team)19:11:16

but in a particular project the only thing varying there in this case is the concatenated alias string

tskardal16:11:30

Should this be reported in some way?