Git commit fd1ee05977.

Open any file with TRAMP. From this buffer, evaluate:

    (let ((file buffer-file-name)) (with-temp-buffer (insert-file-contents file nil)))

This works fine. However, if you use a region:

    (let ((file buffer-file-name)) (with-temp-buffer (insert-file-contents file nil 1 10)))

this fails with an obviously wrong (file is certainly there) signal:

    Debugger entered--Lisp error: (file-missing "/ssh:...")
      signal(file-missing ("/ssh:..."))
      tramp-error((tramp-file-name "ssh" "..." nil "..." "..." "..." nil) file-missing "/ssh:...")
      tramp-handle-insert-file-contents("/ssh:..." nil 1 10 nil)
      apply(tramp-handle-insert-file-contents ("/ssh:..." nil 1 10 nil))
      tramp-sh-file-name-handler(insert-file-contents "/ssh:..." nil 1 10 nil)
      apply(tramp-sh-file-name-handler insert-file-contents ("/ssh:..." nil 1 10 nil))
      tramp-file-name-handler(insert-file-contents "/ssh:..." nil 1 10 nil)
      insert-file-contents("/ssh:..." nil 1 10)
      (progn (insert-file-contents file nil 1 10))

Please add some automated tests for this.

Also, when a command fails with `file-missing' signal, Emacs UI only prints the filename, as that seems to be the signal data. From user point of view that says nothing. You can only understand what's wrong (even if this is not a bug, as above) by setting `debug-on-error' to t, which is extremely user-unfriendly.

Paul