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

rtags.el: Infinite recursion "wrong-type-argument sequencep checkstyle" in tramp mode #1422

Open
richls opened this issue Aug 6, 2021 · 1 comment

Comments

@richls
Copy link

richls commented Aug 6, 2021

I ran rtags-reparse-fileon a remote .cpp file in Tramp mode.
After a few seconds, Emacs stopped responding due to infinite repetitions of the message pair:

error in process filter: apply: Wrong type argument: sequencep, checkstyle
error in process filter: Wrong type argument: sequencep, checkstyle

Canceling with Ctrl-g or Ctrl-] did not help, I had to restart Emacs.

I managed to get a trace the second time this happened:

Debugger entered--Lisp error: (wrong-type-argument sequencep checkstyle)
  tramp-make-tramp-file-name("ssh" nil nil "desk" nil checkstyle nil)
  apply(tramp-make-tramp-file-name ("ssh" nil nil "desk" nil checkstyle nil))
  rtags--alter-path-in-tramp-location("/ssh:desk:<filepath redacted>" checkstyle)
  rtags-trampify(checkstyle)
  rtags-parse-check-style((("/ssh:desk:<filepath redacted>.h" . #<buffer SafeBuf.h>)) (("<filepath redacted>.h" (nil 234 32 15 warning "Value Conversion Issue: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'const ssize_t' (aka 'const long'): -Wsign-conversion" (("<filepath redacted>.h" 25 10 nil note "in file included from <filepath redacted>.h:25:" nil) ("<filepath redacted>.h" 16 10 nil note "in file included from <filepath redacted>.h:16:" nil) (nil 270 12 nil note "in instantiation of function template specialization 'scidb::findSmallest<std::vector<unsigned int, std::allocator<unsigned int> > >' requested here" nil) ("<filepath redacted>.h" 29 10 nil note "in file included from <filepath redacted>.h:29:" nil) ("<filepath redacted>.h" 16 10 nil note "in file included from <filepath redacted>.h:16:" nil) ("<filepath redacted>.cpp" 13 10 nil note "in file included from <filepath redacted>.cpp:13:" nil)))) (checkstyle ("<filepath redacted>.cpp"))))
  rtags-parse-diagnostics()
  rtags-diagnostics-process-filter(#<process RTags Diagnostics> "(list 'checkstyle (cons \"<filepath redacted>.h\" (list (list nil 17 10 13 'error \"Lexical or Preprocessor Issue: 'string_view' file not found\" (list  (list \"<filepath redacted>.h\" 15 10 nil 'note \"in file included from <filepath redacted>.h:15:\" nil)  (list \"<filepath redacted>.h\" 15 10 nil 'note \"in file included from <filepath redacted>.h:15:\" nil)  (list \"<filepath redacted>.h\" 14 10 nil 'note \"in file included from <filepath redacted>.h:14:\" nil)  (list \"<filepath redacted>.cpp\" 11 10 nil 'note \"in file included from <filepath redacted>.cpp:11:\" nil))) (list nil 105 5 5 'error \"Semantic Issue: no type named 'string_view' in namespace 'std'\" nil))))\n")

The second argument to rtags-parse-check-style is a list of 2 elements. I think the issue is that the second element in that list is (checkstyle ("<filepath redacted>.cpp")) and "checkstyle" isn't supposed to be there; rtags-trampify tries to treat checkstyle as a filename, and blows up.

rtags-package-version: 2.38
rc --version: 2.38.131

@richls
Copy link
Author

richls commented Aug 6, 2021

I made a small change to rtags-parse-check-style to work around the infinite-recursion problem. Note that this just makes Emacs usable after checkstyle gets into the list, but doesn't address the original problem of checkstyle being in the list in the first place.

(defun rtags-parse-check-style (buffers checkstyle)
    (when checkstyle
      (setq rtags-last-check-style checkstyle))
    (dolist (cur checkstyle)
      (if (equal (car cur) 'checkstyle)                ; Added this line
          (message "rtags-parse-check-style: (cur) is '%s'" cur)   ; Added this line
        (let* ((file (rtags-trampify (car cur)))
               (buf (cdr (assoc file buffers)))
               (diags (cdr cur)))
          ;; (unless buf
          ;;   (message "ditched %d diags for %s" (length diags) file))
          (when buf
            (with-current-buffer buf
              (rtags-overlays-remove)
              (setq rtags--diagnostics-count nil)
              (dolist (diag diags)
                (rtags-handle-check-style file diag))
              ;; Manually trigger Flycheck to be in sync.
              (when (and (featurep 'flycheck-rtags)
                         (bound-and-true-p flycheck-mode))
                (flycheck-buffer))))))))

The output from my added (message) line is:

Dirtied /ssh:desk:<file 1 redacted>.h
You can run the command ‘rtags-reparse-file’ with C-c r e
rtags-parse-check-style: (cur) is ’(checkstyle (<file 1 redacted (same as the "dirtied" file)>.h))’
rtags-parse-check-style: (cur) is ’(checkstyle (<file 2 redacted>.h))’
rtags-parse-check-style: (cur) is ’(checkstyle (<file 3 redacted>.h))’
Dirtied /ssh:desk:<file 1 again>.h
rtags-parse-check-style: (cur) is ’(checkstyle (<file 4 redacted>.cpp))’
rtags-parse-check-style: (cur) is ’(checkstyle (<file 5 redacted>.cpp))’
rtags-parse-check-style: (cur) is ’(checkstyle (<file 6 redacted>.cpp))’
rtags-parse-check-style: (cur) is ’(checkstyle (<file 7 redacted>.cpp))’

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

No branches or pull requests

1 participant