laurent.orseau
2020-11-7 14:19:01

@robby drracket changes the error-display-handler to displaying a message-box. Is there a way to retrieve the original display handler that outputs text on the error-port?



robby
2020-11-7 14:25:02

drracket:init I believe


robby
2020-11-7 14:27:41

Hm


robby
2020-11-7 14:27:53

They don’t seem to be documented.


laurent.orseau
2020-11-7 14:38:22

errortrace-error-display-handler seems to do the job


laurent.orseau
2020-11-7 14:41:15

This is my compilation procedure now: (define err-str-port (open-output-string)) (define cmc (make-caching-managed-compile-zo)) (parameterize ([current-error-port err-str-port] [current-namespace (make-base-empty-namespace)]) (for ([f (in-list files)]) (with-handlers* ([exn? (λ (e) (errortrace-error-display-handler (exn-message e) e))]) (time-info (format "Compiling ~a" (path->string f)) (cmc f))))) However it still doesn’t recompile scripts which zos have the wrong racket version number


laurent.orseau
2020-11-7 14:49:08

I suspect some interaction with DrRacket that can’t be seen from just the code above


robby
2020-11-7 14:50:46

This isn’t relevant to the problem you’re having, but using exn? is wrong; you want exn:fail? to avoid catching break exceptions


robby
2020-11-7 14:51:07

errotrace-display-handler is intended for use when you’re using errotrace


robby
2020-11-7 14:51:14

(which you aren’t)


robby
2020-11-7 14:51:23

I’m not sure what will go wrong exactly, however.


laurent.orseau
2020-11-7 14:52:39

doesn’t with-handers* do that already?


robby
2020-11-7 14:53:02

No….


robby
2020-11-7 14:53:07

that’s not what the docs mean.


laurent.orseau
2020-11-7 14:53:37

Seems to be working well afaict. It outputs an error message like scripts/unbound-id-not-skipped.rkt:12:4: some-unbound-id: unbound identifier in: some-unbound-id errortrace...: context...: /usr/share/racket-7.9.0.3/collects/compiler/private/cm-minimal.rkt:608:0: compile-zo* /usr/share/racket-7.9.0.3/collects/compiler/private/cm-minimal.rkt:407:15 /usr/share/racket-7.9.0.3/collects/compiler/private/cm-minimal.rkt:396:12: build /usr/share/racket-7.9.0.3/collects/compiler/private/cm-minimal.rkt:372:0: maybe-compile-zo /usr/share/racket-7.9.0.3/collects/compiler/private/cm-minimal.rkt:206:0: compile-root /usr/share/racket-7.9.0.3/collects/compiler/private/cm-minimal.rkt:102:4 /home/laurent/Prog/Racket/quickscript/base.rkt:199:6 /home/laurent/Prog/Racket/quickscript/base.rkt:181:0: compile-user-scripts /home/laurent/Prog/Racket/quickscript/tool.rkt:59:2 body of "/home/laurent/Prog/Racket/quickscript/tool.rkt" /usr/share/racket-7.9.0.3/pkgs/drracket/drracket/private/tools.rkt:294:2 /usr/share/racket-7.9.0.3/pkgs/drracket/drracket/private/tools.rkt:72:0: load/invoke-all-tools .../racket/unit.rkt:996:20 body of "/usr/share/racket-7.9.0.3/pkgs/drracket/drracket/tool-lib.rkt" body of "/usr/share/racket-7.9.0.3/pkgs/drracket/drracket/private/drracket-normal.rkt" body of "/usr/share/racket-7.9.0.3/pkgs/drracket/drracket/drracket.rkt"


laurent.orseau
2020-11-7 14:54:13

what do they mean then?


laurent.orseau
2020-11-7 14:54:42

but okay to avoid catching exn:break? in any case


robby
2020-11-7 14:54:52

It isn’t okay to catch exn:break.


laurent.orseau
2020-11-7 14:56:01

Replaced with (λ (e) (and (exn? e) (not (exn:break? e))))


robby
2020-11-7 14:56:35

I think you want exn:fail?


laurent.orseau
2020-11-7 14:57:15

alright, I can change to that.


robby
2020-11-7 14:58:28

I don’t see what’s wrong with the code you wrote for compiling zos. I’ll try to look more deeply into it later on.


laurent.orseau
2020-11-7 15:27:10

Thanks!


laurent.orseau
2020-11-7 15:28:15

Another possibility is that it actually works well, but something else makes it appear to me as if it doesn’t. I’ll continue looking into it


laurent.orseau
2020-11-7 19:18:42

I confirm that compilation does not happen for the faulty zos


laurent.orseau
2020-11-7 19:19:34

quickscript: Begin: Compiling /home/laurent/Prog/Racket/quickscript-test/scripts/test-compile-cs.rkt... quickscript: compiled-for-current-version? #f [compiling...] quickscript: compiled-for-current-version? #f


laurent.orseau
2020-11-7 19:26:26

one fix is still to use this detection and delete the faulty zos files before compiling, but it’s probably best to know where the problem comes from anyhow


robby
2020-11-7 19:27:22

My feeling is that many changes can cause a zo file to be problematic so we probably don’t want to use a version number test (outside of CM that is).


laurent.orseau
2020-11-7 19:30:31

I agree. Still a last resort though, in case we really can’t figure out what’s wrong


laurent.orseau
2020-11-7 19:31:11

(in particular since this is a rather common case)


laurent.orseau
2020-11-7 19:32:48

If you’re out of ideas, I’ll try to build a MWE. I’m pretty sure that’s not going to be straightforward though :smile: