Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix occasional (wrong-type-argument stringp nil) #1128

Merged
merged 1 commit into from
Jun 16, 2015
Merged

Fix occasional (wrong-type-argument stringp nil) #1128

merged 1 commit into from
Jun 16, 2015

Conversation

Malabarba
Copy link
Member

This had been bugging me for a while. Sometimes the backtrace buffer is created and displayed correctly, but an error is signaled because tooling-file-p is called with a nil argument. This avoids that.

@expez
Copy link
Member

expez commented Jun 13, 2015

Any idea why we have a file that's nil here? Feel like this patch is just taking care of a symptom without fixing the underlying cause.

@Malabarba
Copy link
Member Author

Yes, I agree, but I have no idea why that's happening. I can paste a proper emacs backtrace later.

@Malabarba
Copy link
Member Author

Here we go:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-nondirectory(nil)
  (let ((fname (file-name-nondirectory file-name))) (string-match-p "^form-init" fname))
  cider--tooling-file-p(nil)
  (if (cider--tooling-file-p file) nil (let ((buffer (cider-find-file file))) (if buffer (progn (save-current-buffer (set-buffer buffer) (save-excursion (save-restriction (widen) (goto-char ...) (forward-line ...) (move-to-column ...) (let ... ...))))))))
  (let ((file (nth 0 info)) (line (nth 1 info)) (col (nth 2 info))) (if (cider--tooling-file-p file) nil (let ((buffer (cider-find-file file))) (if buffer (progn (save-current-buffer (set-buffer buffer) (save-excursion (save-restriction ... ... ... ... ...))))))))
  (progn (let ((file (nth 0 info)) (line (nth 1 info)) (col (nth 2 info))) (if (cider--tooling-file-p file) nil (let ((buffer (cider-find-file file))) (if buffer (progn (save-current-buffer (set-buffer buffer) (save-excursion ...))))))))
  (if info (progn (let ((file (nth 0 info)) (line (nth 1 info)) (col (nth 2 info))) (if (cider--tooling-file-p file) nil (let ((buffer (cider-find-file file))) (if buffer (progn (save-current-buffer ... ...))))))))
  (let ((info (cider-extract-error-info cider-compilation-regexp message))) (if info (progn (let ((file (nth 0 info)) (line (nth 1 info)) (col (nth 2 info))) (if (cider--tooling-file-p file) nil (let ((buffer ...)) (if buffer (progn ...))))))))
  (save-excursion (let ((info (cider-extract-error-info cider-compilation-regexp message))) (if info (progn (let ((file (nth 0 info)) (line (nth 1 info)) (col (nth 2 info))) (if (cider--tooling-file-p file) nil (let (...) (if buffer ...))))))))
  cider--find-last-error-location("CompilerException java.lang.ClassNotFoundException: java.lang.Stringa, compiling:(NO_SOURCE_PATH:0:0) \n")
  (let ((loc (cider--find-last-error-location message))) (if loc (let ((overlay (make-overlay (nth 0 loc) (nth 1 loc) (nth 2 loc)))) (if overlay (let ((info (cider-extract-error-info cider-compilation-regexp message))) (if info (progn (let* ... ... ... ... ... ... ...))))))))
  cider-handle-compilation-errors("CompilerException java.lang.ClassNotFoundException: java.lang.Stringa, compiling:(NO_SOURCE_PATH:0:0) \n" #<buffer main.clj<popcorntimer>>)
  (closure ((eval-buffer . #<buffer main.clj<popcorntimer>>) (buffer) t) (_buffer err) (cider-emit-interactive-eval-err-output err) (cider-handle-compilation-errors err eval-buffer))(#<buffer main.clj<popcorntimer>> "CompilerException java.lang.ClassNotFoundException: java.lang.Stringa, compiling:(NO_SOURCE_PATH:0:0) \n")
  #[257 "\306�\307\"\306�\310\"\306�\311\"\306�\312\"\306�\313\"\306��\314\"\306��\315\"\306��\316\"\306�   \317\"\306�\n\320\"r\300q\210��\203@�\321\322!\204@�����)�  \203R�\301\205\333�\301\300��\"\202\333���\203c�\302\205\333�\302\300�  \"\202\333�\211\203r�\302\205\333�\302\300�\"\202\333���\203\203�\303\205\333�\303\300��\"\202\333��\205\333�\323��\235\203\222�\324\325!\210\326��\235\203\245�\305\206\237�� \300���$\210\327��\235\203\260�\324\330!\210\331��\235\203\273�\332\300!\210\333��\235\205\333�\334�\335���!\"�\"#\210\336��!\"\210\304\205\333�\304\300!\207" [#<buffer main.clj<popcorntimer>> (closure ((eval-buffer . #<buffer main.clj<popcorntimer>>) (buffer) t) (_buffer value) (cider--display-interactive-eval-result value)) (closure ((eval-buffer . #<buffer main.clj<popcorntimer>>) (buffer) t) (_buffer out) (cider-emit-interactive-eval-output out)) (closure ((eval-buffer . #<buffer main.clj<popcorntimer>>) (buffer) t) (_buffer err) (cider-emit-interactive-eval-err-output err) (cider-handle-compilation-errors err eval-buffer)) nil nil nrepl-dict-get "value" "ns" "out" "err" "status" "id" "ex" "root-ex" "session" "pprint-out" derived-mode-p clojure-mode "interrupted" message "Evaluation interrupted." "eval-error" "namespace-not-found" "Namespace not found." "need-input" cider-need-input "done" puthash gethash remhash cider-buffer-ns nrepl-err-handler nrepl-pending-requests nrepl-completed-requests] 16 "\n\n(fn RESPONSE)"]((dict "err" "CompilerException java.lang.ClassNotFoundException: java.lang.Stringa, compiling:(NO_SOURCE_PATH:0:0) \n" "id" "984" "session" "c232bd08-1b78-48a6-815d-0c0e536893bb"))
  nrepl--dispatch-response((dict "err" "CompilerException java.lang.ClassNotFoundException: java.lang.Stringa, compiling:(NO_SOURCE_PATH:0:0) \n" "id" "984" "session" "c232bd08-1b78-48a6-815d-0c0e536893bb"))
  nrepl-client-filter(#<process nrepl> "d3:err103:CompilerException java.lang.ClassNotFoundException: java.lang.Stringa, compiling:(NO_SOURCE_PATH:0:0) \n2:id3:9847:session36:c232bd08-1b78-48a6-815d-0c0e536893bbe")

@Malabarba
Copy link
Member Author

Btw, I guess I should move this to a proper bug report then?

@expez
Copy link
Member

expez commented Jun 13, 2015

Btw, I guess I should move this to a proper bug report then?

Yeah, lets try to get to the bottom of this.

@bbatsov
Copy link
Member

bbatsov commented Jun 14, 2015

That'd be ideal indeed.

expez added a commit that referenced this pull request Jun 16, 2015
Fix occasional (wrong-type-argument stringp nil)
@expez expez merged commit 53f7736 into clojure-emacs:master Jun 16, 2015
@expez
Copy link
Member

expez commented Jun 16, 2015

Merging this as it's pretty harmless and clearly at least one person is affected.

@bbatsov
Copy link
Member

bbatsov commented Jun 16, 2015

@expez Please, don't merge things I haven't signed off on, unless they are truly trivial.

@bbatsov
Copy link
Member

bbatsov commented Jun 16, 2015

I don't mind the fix, I just feel we might end up missing something significant. It wasn't even established what exactly causes this problem...

@expez
Copy link
Member

expez commented Jun 16, 2015

Please, don't merge things I haven't signed off on

fine

It wasn't even established what exactly causes this problem...

It was specfic to clojure-android and nobody wanted to spend time on such a trivial issue.

@bbatsov
Copy link
Member

bbatsov commented Jun 16, 2015

No worries. I just think we should have discussed what to do about this a bit more. Report a ticket on clojure-android, etc. I'm not fond of sweeping problems under the rug.

P.S. I really appreciate your help dealing with issues/PRs!

@arrdem
Copy link
Contributor

arrdem commented Jun 16, 2015

For the record I've definitely seen this before in not a clojure-android context. Glad to see it's patch'd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants