Throw "No such file or directory" on posting if the parent directory is deleted #50

tomykaira opened this Issue Oct 6, 2011 · 3 comments

2 participants


This might be a bug of emacs, not twittering-mode.
I am not sure there is a workaround on the twittering-mode side.

How to reproduce

Emacs: 23.2.1 (I cannot easily check with HEAD emacs with OS issue, sorry)
Create a directory, exec twittering-update-status-interactive, delete the directory, and post.

$ mkdir -p ~/tmp/foo/bar/hoge
$ touch ~/tmp/foo/bar/hoge/piyo
(find-file "~/tmp/foo/bar/hoge/piyo")
$ rm -rf ~/tmp/foo
C-cC-c in the twittering-edit buffer


My name, post content, OAuth information, and some bytecodes are replaced.

Debugger entered--Lisp error: (file-error "Setting current directory" "そのようなファイルやディレクトリはありません" "/home/myname/tmp/hoge/huga/piyo/")
call-process-region(1 1000 "sha1sum" "/tmp/emacsyZkW2P" t nil)
apply(call-process-region 1 1000 "sha1sum" "/tmp/emacsyZkW2P" t nil nil)
sha1-string-external("...566666666666666666666666666666666666666666666POST&" t)
sha1-string("...566666666666666666666666666666666666666666666POST&" t)
sha1("...566666666666666666666666666666666666666666666POST&" nil nil t)
apply(sha1 ("...566666666666666666666666666666666666666666666POST&" nil nil t))
twittering-sha1("...566666666666666666666666666666666666666666666POST&" nil nil t)
twittering-hmac-sha1("dJUG2hW2mWYuy4YwElpwbB0icBBosp9vv51fvftsOE&c6Qc0SgPEvljPPTtYVlKRxVqyb5IjmPbWONtd0JXo0" "POST&")
twittering-oauth-auth-str("POST" "" (("status" . "...")) (("oauth_consumer_key" . "...") ("oauth_nonce" . "...") ("oauth_signature_method" . "HMAC-SHA1") ("oauth_timestamp" . "1317857208") ("oauth_version" . "1.0") ("oauth_token" . "...")) "...")
twittering-oauth-auth-str-access("POST" "" (("status" . "...")) "..." "..." "..." "...")
twittering-add-application-header-to-http-request(((method . "POST") (scheme . "https") (host . "") (port . 443) (path . "/1/statuses/update.xml") (query-string . "status=...") (encoded-query-alist ("status" . "...")) (uri . "") (uri-without-query . "") (header-list ("Content-Length" . "0") ("Host" . "") ("User-Agent" . "Emacs/23.2 Twittering-mode/HEAD")) (post-body . "")))
twittering-http-post("" "1/statuses/update" (("status" . "...")) nil nil)
twittering-call-api(update-status ((status . "...")))
call-interactively(twittering-edit-post-status nil nil)


Yes. It relates to a problem of Emacs itself.
The problem is discussed in some places.
As mentioned in the last URL, it may be difficult to generally fix the problem due to relative paths.
However, I think it can be avoided by the side of twittering-mode.
You can avoid the problem by binding default-directory to a certainly existent directory when invoking
I think temporary-file-directory can be used for it (maybe).
In the functions twittering-send-http-request-curl and twittering-send-http-request-wget, default-directory
has been already bound to the temporary directory in order to safely refer a SSL certificate file.
But, twittering-sha1 does not bind the variable though it is possible to invoke an external program.
For safety, all functions that may invoke an external program should bind default-directory as possible.
I will try it.
Can I mention your name to ChangeLog as a reporter of the problem when the fix is finished?
If you allow it, which name do you prefer? tomykaira or others?


Thank you for detailed information.

Using temp-dir is a good idea.
It exists almost always, more robust than using $HOME or something (I tried to use $HOME).

I appreciate that I am mentioned as a reporter!
Please use "tomykaira" ;)


I have commited the fix.
Please try it.

@tomykaira tomykaira closed this Aug 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment