mranderson icon indicating copy to clipboard operation
mranderson copied to clipboard

clojure.core require handled badly

Open vemv opened this issue 2 years ago • 12 comments

Namespaces can require clojure.core in their ns form. While rare, that was actually used as a workaround for a now-fixed Cloverage issue.

...when mranderson would find such a require, it would rewrite it to something very different (cider.nrepl.inlined-deps-corerrb-vector.v0v1v2.clojure.core), causing an error when trying to run the emitted code (because that namespace libspec would not be backed by an existing file).

This can be seen in the CircleCI build as of https://github.com/clojure-emacs/cider-nrepl/commit/c9b2f61875f41785e0373a3a7e0269701c20d720 (and can be repro'd locally by running make smoketest)

Probably fixing this bug (which is rare to hit) would also make the overall code more robust.

Cheers - V

vemv avatar Oct 11 '22 19:10 vemv

Maybe not that rare @vemv when used in conjunction with (:refer-clojure :exclude ...)?

A contrived example, but you get the idea:

(ns foobar
  (:refer-clojure :exclude [assoc])
  (:require [clojure.core :as c]))

(defn assoc [m k v]
  (c/assoc m (name k) v))

Would the above be problematic?

lread avatar Oct 18 '22 21:10 lread

Only one way to know!

vemv avatar Oct 19 '22 09:10 vemv

I'm facing this one again

Here's the ns that causes it:

https://github.com/clj-commons/claypoole/blob/4e8440a61178778d36dd30d1f026ade4bf12d2ec/src/clj/com/climate/claypoole/impl.clj#L14-L16

My build:

https://app.circleci.com/pipelines/github/clojure-emacs/cider-nrepl/775/workflows/b12679f3-7c6a-4fd1-8d2b-1882ab809432/jobs/9618

Message:

{:clojure.main/message
 "Syntax error (FileNotFoundException) compiling at (cider/nrepl/inlined/deps/claypoole/v1v2v2/com/climate/claypoole.clj:1:1).\nCould not locate cider/nrepl/inlined/deps/corerrb_vector/v0v1v2/clojure/core__init.class, cider/nrepl/inlined/deps/corerrb_vector/v0v1v2/clojure/core.clj or cider/nrepl/inlined/deps/corerrb_vector/v0v1v2/clojure/core.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.\n",

vemv avatar Jul 28 '23 17:07 vemv

oi @vemv

could not repro your problem, I assume it is my bad but can you test a fix on above branch (fix-76)?

benedekfazekas avatar Jul 31 '23 10:07 benedekfazekas

Thanks! Is it available as snapshot?

vemv avatar Aug 01 '23 14:08 vemv

it is now as https://clojars.org/thomasa/mranderson/versions/0.5.4-fix76

benedekfazekas avatar Aug 01 '23 20:08 benedekfazekas

@benedekfazekas could you tag the git repo with v0.5.4-fix76? that way my rewrite-clj tests can easily pick up this latest release for canary testing.

lread avatar Aug 02 '23 15:08 lread

that would be a bit tricky i am away from my laptop for more than a week and the phone app does not seem to have this option. it is on a branch tho does that help maybe?

benedekfazekas avatar Aug 02 '23 15:08 benedekfazekas

Oh you published from a branch? I can skip until you publish something from master.

lread avatar Aug 02 '23 15:08 lread

@lread bump shall I merge this? or your problem went away?

benedekfazekas avatar Aug 16 '23 08:08 benedekfazekas

sorry, wrong bump @lread I meant to bump @vemv

benedekfazekas avatar Aug 16 '23 08:08 benedekfazekas

I'll try to get back to this soon!

On Wed, Aug 16, 2023 at 10:35 AM Benedek Fazekas @.***> wrote:

sorry, wrong bump @lread https://github.com/lread I meant to bump @vemv https://github.com/vemv

— Reply to this email directly, view it on GitHub https://github.com/benedekfazekas/mranderson/issues/76#issuecomment-1680193142, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI354UXHPTNFS5RQCDMTETXVSA6TANCNFSM6AAAAAARCTBJXE . You are receiving this because you were mentioned.Message ID: @.***>

vemv avatar Aug 19 '23 19:08 vemv