title: Emacs tramp "Wrong type argument listp" error
body: <p>The title sounds almost identical to the question <a href="https://stackoverflow.com/questions/20647107/how-do-i-fix-a-wrong-type-argument-listp-error-when-trying-to-access-remote" title="here">here</a>. It didn't seem to be resolved and I couldn't post a comment and hence opened up this question. </p>
  
  <p>I am using emacs 24.3.1 installed using MacPorts on a Mac OS X Mavericks. I have been using tramp to access remote files without a problem until recently. I used to ssh without my username to access the files and it worked fine. When it stopped working, I noticed the error "Wrong type argument: listp, /home/t_nithyanandan/.bashrc" and this problem is not specific to .bashrc. It happens for any file. Subsequently I started putting my username in the ssh line in front of the remote machine name and it was working for a while until it broke down too with the same error. Now I am unable to use tramp at all. </p>
  
  <p>I am able to open my files on my local machine without trouble using C-x C-f. I reinstalled emacs using macports but it doesn't change anything. I installed emacs from <a href="http://emacsformacosx.com/" rel="nofollow noreferrer">here</a> but it has the same problem while using tramp.</p>
  
  <p>I disabled my .emacs before startup but that doesn't help either.</p>
  
  <p>After doing </p>
  
  <pre><code>M-x load-library RET tramp.el RET
  C-u 1 M-x toggle-debug-on-error RET
  </code></pre>
  
  <p>Here's the output in *Messages*:</p>
  
  <pre><code>Loading /opt/local/share/emacs/site-lisp/subdirs.el (source)...done
  For information about GNU Emacs and the GNU system, type C-h C-a.
  Making completion list...
  Loading /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/net/tramp.el.gz...
  uncompressing tramp.el.gz...done
  Loading /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/net/tramp.el.gz...done
  Debug on Error enabled globally
  Quit
  Tramp: Opening connection for enterprise.sese.asu.edu using ssh...
  Tramp: Sending command `exec ssh   -e none enterprise.sese.asu.edu'
  
  Tramp: Waiting for prompts from remote shell
  Tramp: Sending password
  Tramp: Sending command `exec ssh   -e none enterprise.sese.asu.edu'
  Tramp: Found remote shell prompt on `enterprise.sese.asu.edu'
  Tramp: Opening connection for enterprise.sese.asu.edu using ssh...done
  Entering debugger...
  Tramp: Opening connection for enterprise.sese.asu.edu using ssh...
  Tramp: Sending command `exec ssh   -e none enterprise.sese.asu.edu'
  
  Tramp: Waiting for prompts from remote shell
  Tramp: Sending password
  Tramp: Sending command `exec ssh   -e none enterprise.sese.asu.edu'
  Tramp: Found remote shell prompt on `enterprise.sese.asu.edu'
  Tramp: Opening connection for enterprise.sese.asu.edu using ssh...done
  tramp-sh-handle-file-attributes: Wrong type argument: listp, /home/t_nithyanandan/\.bashrc
  </code></pre>
  
  <p>Here's the output of *Backtrace*:</p>
  
  <pre><code>Debugger entered--Lisp error: (wrong-type-argument listp /home/t_nithyanandan/\.bashrc)
    tramp-convert-file-attributes(["ssh" nil "enterprise.sese.asu.edu" "/home/t_nithyanandan/.bashrc" nil] /home/t_nithyanandan/\.bashrc)
    tramp-sh-handle-file-attributes("/ssh:enterprise.sese.asu.edu:/home/t_nithyanandan/.bashrc")
    apply(tramp-sh-handle-file-attributes "/ssh:enterprise.sese.asu.edu:/home/t_nithyanandan/.bashrc")
    tramp-sh-file-name-handler(file-attributes "/ssh:enterprise.sese.asu.edu:/home/t_nithyanandan/.bashrc")
    apply(tramp-sh-file-name-handler file-attributes "/ssh:enterprise.sese.asu.edu:/home/t_nithyanandan/.bashrc")
    (catch (quote suppress) (apply foreign operation args))
    (catch (quote non-essential) (catch (quote suppress) (apply foreign operation args)))
    (setq result (catch (quote non-essential) (catch (quote suppress) (apply foreign operation args))))
    (let ((sf (symbol-function foreign)) result) (if (and (listp sf) (eq (car sf) (quote autoload))) (progn (let ((default-directory (tramp-compat-temporary-file-directory))) (load (cadr sf) (quote noerror) (quote nomessage))))) (setq result (catch (quote non-essential) (catch (quote suppress) (apply foreign operation args)))) (cond ((eq result (quote non-essential)) (tramp-message v 5 "Non-essential received in operation %s" (append (list operation) args)) (tramp-run-real-handler operation args)) ((eq result (quote suppress)) (let (tramp-message-show-message) (tramp-message v 1 "Suppress received in operation %s" (append (list operation) args)) (tramp-cleanup v) (tramp-run-real-handler operation args))) (t result)))
    (lambda nil (let ((sf (symbol-function foreign)) result) (if (and (listp sf) (eq (car sf) (quote autoload))) (progn (let ((default-directory (tramp-compat-temporary-file-directory))) (load (cadr sf) (quote noerror) (quote nomessage))))) (setq result (catch (quote non-essential) (catch (quote suppress) (apply foreign operation args)))) (cond ((eq result (quote non-essential)) (tramp-message v 5 "Non-essential received in operation %s" (append (list operation) args)) (tramp-run-real-handler operation args)) ((eq result (quote suppress)) (let (tramp-message-show-message) (tramp-message v 1 "Suppress received in operation %s" (append (list operation) args)) (tramp-cleanup v) (tramp-run-real-handler operation args))) (t result))))()
    funcall((lambda nil (let ((sf (symbol-function foreign)) result) (if (and (listp sf) (eq (car sf) (quote autoload))) (progn (let ((default-directory (tramp-compat-temporary-file-directory))) (load (cadr sf) (quote noerror) (quote nomessage))))) (setq result (catch (quote non-essential) (catch (quote suppress) (apply foreign operation args)))) (cond ((eq result (quote non-essential)) (tramp-message v 5 "Non-essential received in operation %s" (append (list operation) args)) (tramp-run-real-handler operation args)) ((eq result (quote suppress)) (let (tramp-message-show-message) (tramp-message v 1 "Suppress received in operation %s" (append (list operation) args)) (tramp-cleanup v) (tramp-run-real-handler operation args))) (t result)))))
    (if debug-on-error (funcall body) (condition-case err (funcall body) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" (append (list operation) args))) (signal (car err) (cdr err))) (error (cond ((and completion (zerop (length localname)) (memq operation (quote ...))) t) ((and completion (zerop (length localname)) (memq operation (quote ...))) filename) (t (signal (car err) (cdr err)))))))
    (let ((body (function (lambda nil (let ((sf ...) result) (if (and ... ...) (progn ...)) (setq result (catch ... ...)) (cond (... ... ...) (... ...) (t result))))))) (if debug-on-error (funcall body) (condition-case err (funcall body) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" (append (list operation) args))) (signal (car err) (cdr err))) (error (cond ((and completion (zerop ...) (memq operation ...)) t) ((and completion (zerop ...) (memq operation ...)) filename) (t (signal (car err) (cdr err))))))))
    (if foreign (let ((body (function (lambda nil (let (... result) (if ... ...) (setq result ...) (cond ... ... ...)))))) (if debug-on-error (funcall body) (condition-case err (funcall body) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" (append ... args))) (signal (car err) (cdr err))) (error (cond ((and completion ... ...) t) ((and completion ... ...) filename) (t (signal ... ...))))))) (tramp-run-real-handler operation args))
    (let* ((v (tramp-dissect-file-name filename)) (method (tramp-file-name-method v)) (user (tramp-file-name-user v)) (host (tramp-file-name-host v)) (localname (tramp-file-name-localname v)) (hop (tramp-file-name-hop v))) (if foreign (let ((body (function (lambda nil (let ... ... ... ...))))) (if debug-on-error (funcall body) (condition-case err (funcall body) ((debug quit) (let (tramp-message-show-message) (tramp-message v 1 "Interrupt received in operation %s" ...)) (signal (car err) (cdr err))) (error (cond (... t) (... filename) (t ...)))))) (tramp-run-real-handler operation args)))
    (let* ((filename (tramp-replace-environment-variables (apply (quote tramp-file-name-for-operation) operation args))) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (let* ((v (tramp-dissect-file-name filename)) (method (tramp-file-name-method v)) (user (tramp-file-name-user v)) (host (tramp-file-name-host v)) (localname (tramp-file-name-localname v)) (hop (tramp-file-name-hop v))) (if foreign (let ((body (function (lambda nil ...)))) (if debug-on-error (funcall body) (condition-case err (funcall body) ((debug quit) (let ... ...) (signal ... ...)) (error (cond ... ... ...))))) (tramp-run-real-handler operation args))))
    (progn (let* ((filename (tramp-replace-environment-variables (apply (quote tramp-file-name-for-operation) operation args))) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (let* ((v (tramp-dissect-file-name filename)) (method (tramp-file-name-method v)) (user (tramp-file-name-user v)) (host (tramp-file-name-host v)) (localname (tramp-file-name-localname v)) (hop (tramp-file-name-hop v))) (if foreign (let ((body (function ...))) (if debug-on-error (funcall body) (condition-case err (funcall body) (... ... ...) (error ...)))) (tramp-run-real-handler operation args)))))
    (unwind-protect (progn (let* ((filename (tramp-replace-environment-variables (apply (quote tramp-file-name-for-operation) operation args))) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (let* ((v (tramp-dissect-file-name filename)) (method (tramp-file-name-method v)) (user (tramp-file-name-user v)) (host (tramp-file-name-host v)) (localname (tramp-file-name-localname v)) (hop (tramp-file-name-hop v))) (if foreign (let ((body ...)) (if debug-on-error (funcall body) (condition-case err ... ... ...))) (tramp-run-real-handler operation args))))) (set-match-data save-match-data-internal (quote evaporate)))
    (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let* ((filename (tramp-replace-environment-variables (apply ... operation args))) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (let* ((v (tramp-dissect-file-name filename)) (method (tramp-file-name-method v)) (user (tramp-file-name-user v)) (host (tramp-file-name-host v)) (localname (tramp-file-name-localname v)) (hop (tramp-file-name-hop v))) (if foreign (let (...) (if debug-on-error ... ...)) (tramp-run-real-handler operation args))))) (set-match-data save-match-data-internal (quote evaporate))))
    (if tramp-mode (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let* ((filename (tramp-replace-environment-variables ...)) (completion (tramp-completion-mode-p)) (foreign (tramp-find-foreign-file-name-handler filename))) (let* ((v ...) (method ...) (user ...) (host ...) (localname ...) (hop ...)) (if foreign (let ... ...) (tramp-run-real-handler operation args))))) (set-match-data save-match-data-internal (quote evaporate)))) (tramp-run-real-handler operation args))
    tramp-file-name-handler(file-attributes "/ssh:enterprise.sese.asu.edu:/home/t_nithyanandan/.bashrc")
    file-attributes("/ssh:enterprise.sese.asu.edu:/home/t_nithyanandan/.bashrc")
    find-file-noselect("/ssh:enterprise.sese.asu.edu:/home/t_nithyanandan/.bashrc" nil nil t)
    find-file("/ssh:enterprise.sese.asu.edu:/home/t_nithyanandan/.bashrc" t)
    call-interactively(find-file nil nil)
  </code></pre>
  
  <p>I am not very good at lisp. If you'd like me to run some diagnostics, please keep in mind that I am a beginner. Any help will be appreciated.</p>
  
  <p>Thanks.</p>
  
  <p>P.S: I must mention that while tramp was working before this break down, there were times when it used to hang and I used C-g impatiently to quit whatever tramp was attempting to do. I am not sure if this could have corrupted something inside tramp.</p>
  
  <p><strong>Edit 1</strong></p>
  
  <p>Trying to follow Drew's advice, here's what I found. I have renamed my init file .emacs to .emacs.bkp and I have been assuming this should disable emacs loading up that init file. Interestingly, if I opened emacs with </p>
  
  <pre><code>emacs -Q
  </code></pre>
  
  <p>then I am able to ssh into the remote machine and view my files. So I have the following questions:</p>
  
  <p>1) It appears that renaming the init file and restarting emacs does not keep the init file from interfering.<br>
  2) What do I have to do to disable using the init file?<br>
  3) What part of my init file could be causing this problem? Let me know if positing my entire init file would be helpful. Tramp related lines in my renamed init file .emacs.bkp are:  </p>
  
  <pre><code>(add-to-list 'load-path "/usr/local/share/emacs/tramp/lisp/")  
  (require 'tramp)  
  (setq tramp-default-method "ssh")  
  (setq tramp-verbose 9)  
  </code></pre>
  
  <p><strong>Edit 2</strong></p>
  
  <p>I restored my init file using the original source I had backed up somewhere else. I used ediff-buffers to figure out the differences and restored all the differences to be the same as what I thought was in the corrupted init file. For some strange reason, the new init file looks exactly the same as my previous init file and tramp works fine now. In other words, I don't know what exactly got fixed but restoring my init file seemed to do the trick. </p>