cjohansson / emacs-ssh-deploy

A deployment plugin via Tramp for Emacs.
GNU General Public License v3.0
152 stars 6 forks source link

error in process sentinel creating directory permission denied #57

Closed jeswcollins closed 1 year ago

jeswcollins commented 5 years ago

I noticed an error that occurs the first time that I try to use ssh-deploy to upload a file after opening emacs.

After saving the file to initiate an automatic upload, the upload fails with a message like "error in process sentinel, creating directory ... permission denied"

After changing the file and saving to initiate upload, the upload succeeds.

cjohansson commented 5 years ago

yes I get error sometimes too, I think it's a Tramp bug, would be nice to have a way to reproduce it

jeswcollins commented 5 years ago

I reproduced it by closing my emacs, starting new emacs process, making a change to a file, and saving.

the dir-local.el (changed the directory names but could provide more detail):

  (ssh-deploy-root-local . "/localDir/")
  (ssh-deploy-root-remote . "/ssh:usr@example.com:/remoteDir/")
  (ssh-deploy-async . 1)
  (ssh-deploy-on-explicit-save . 1)
  (ssh-deploy-script . (lambda() (let ((default-directory ssh-deploy-root-remote))(shell-command "bash compile.sh"))))
)))

and ssh-deploy lines in .emacs initialization file:

(require 'ssh-deploy)
(ssh-deploy-line-mode) ;; If you want mode-line feature
(ssh-deploy-add-menu) ;; If you want menu-bar feature
(ssh-deploy-add-after-save-hook) ;; If you want automatic upload support
(ssh-deploy-add-find-file-hook) ;; If you want detecting remote changes support
(global-set-key (kbd "C-c C-z") 'ssh-deploy-prefix-map)
jeswcollins commented 5 years ago

Oh maybe you mean how to reproduce with Tramp only...that I don't know.

jeswcollins commented 5 years ago

I had a similar issue where the first auto-upload seemed to hang, during with process I'd get a message the remote file changed. But when trying C-c C-z d to download, I got an error like this:error in process sentinel, cannot resolve lock conflict in batch mode. Some time later I was able to C-c C-z d to download w/buffer auto-refresh. Uploads started working fine too.

cjohansson commented 5 years ago

Ok thanks, I’ll see if I can reproduce it on my machine too

cjohansson commented 5 years ago

What you could do is test if this expression results in the same error if you run it when emacs start:

(copy-file path-local path-remote t t t t)

(You need to replace path-local with a local filename and path-remote with a tramp remote filename. )

If it doesn't work you should report in to GNU Emacs maintainers. If it works then it might be a async.el issue and you could instead test this when emacs starts:

(async-start
    (lambda() (copy-file path-local path-remote t t t t))
    (lambda(response) (message "Copied with response: %s" response))

If it doesn't work with async.el you could test running async processes via threads instead like this and also you should report it to async.el maintainers.

(make-thread
    (lambda() (message "Copied with response: %s" (copy-file path-local path-remote t t t t))))

or just set ssh-deploy-async-with-threads to 1 with (setq ssh-deploy-async-with-threads 1) in your config, it should result in equivalent behavior, otherwise it's a bug in the plugin.

jeswcollins commented 5 years ago

Thanks, would like to try your recommendations when I have some more free time.

In the meantime I thought I would mention here in case it is related, that after getting this process sentinel error, I then got the file change warning I referenced in another issue, and then this error message in the mini-buffer after attempting to force the upload (C-c C-z u): Wrong type argument: commandp, ssh-deploy-upload-handle

jeswcollins commented 5 years ago

I see now that it is fairly straight forward in this case that the C-c C-z u fails to simply launch an ediff, make the small edits on the remote file to get it up to version with the local file, and save the remote file.

I think this error occurred in another case of me making 2-3+ small changes and saves in about as many seconds.

jeswcollins commented 5 years ago

I also get this error in process sentinel message shortly after trying to save a second file while the first saved filed is still uploading.

As you recommended trying, I tried opening a new session of emacs from the terminal, and M-: (copy-file path-local path-remote t t t t). This copy command worked, so I may try that async line of yours next.

jeswcollins commented 5 years ago

(async-start (lambda() (copy-file path-local path-remote t t t t)) (lambda(response) (message "Copied with response: %s" response))

Failed with read--expression: End of file during parsing

(make-thread (lambda() (message "Copied with response: %s" (copy-file path-local path-remote t t t t))))

worked! thx. I am busy with work but may find time to report to async.el maintainers in days/weeks time.

jeswcollins commented 5 years ago

Just wanted to note that after pasting (setq ssh-deploy-async-with-threads 1) in my .emacs (and M-x eval-buffer), ssh-deploy automatic uploads work, but I get Error running timer: (no-catch timeout timeout) [2 times]...is that Tramp error? Async.el?

jeswcollins commented 5 years ago

I get a message Forbidden reentrant call of Tramp when saving/uploading a second time while the first is still uploading when using threads.