Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Open
tomykaira opened this Issue · 3 comments

2 participants

tomykaira Tadashi MATSUO
tomykaira

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")
(twittering-update-status-interactive)
$ rm -rf ~/tmp/foo
C-cC-c in the twittering-edit buffer

Backtrace

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&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.xml..." t)
sha1-string("...566666666666666666666666666666666666666666666POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.xml..." t)
sha1("...566666666666666666666666666666666666666666666POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.xml..." nil nil t)
apply(sha1 ("...566666666666666666666666666666666666666666666POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.xml..." nil nil t))
twittering-sha1("...566666666666666666666666666666666666666666666POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.xml..." nil nil t)
twittering-hmac-sha1("dJUG2hW2mWYuy4YwElpwbB0icBBosp9vv51fvftsOE&c6Qc0SgPEvljPPTtYVlKRxVqyb5IjmPbWONtd0JXo0" "POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.xml...")
twittering-oauth-auth-str("POST" "https://api.twitter.com/1/statuses/update.xml" (("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" "https://api.twitter.com/1/statuses/update.xml" (("status" . "...")) "..." "..." "..." "...")
twittering-add-application-header-to-http-request(((method . "POST") (scheme . "https") (host . "api.twitter.com") (port . 443) (path . "/1/statuses/update.xml") (query-string . "status=...") (encoded-query-alist ("status" . "...")) (uri . "https://api.twitter.com/1/statuses/update.xml?status=...") (uri-without-query . "https://api.twitter.com/1/statuses/update.xml") (header-list ("Content-Length" . "0") ("Host" . "api.twitter.com") ("User-Agent" . "Emacs/23.2 Twittering-mode/HEAD")) (post-body . "")))
twittering-http-post("api.twitter.com" "1/statuses/update" (("status" . "...")) nil nil)
twittering-call-api(update-status ((status . "...")))
twittering-edit-post-status()
call-interactively(twittering-edit-post-status nil nil)

Tadashi MATSUO
Collaborator

Yes. It relates to a problem of Emacs itself.
The problem is discussed in some places.
http://www.mew.org/pipermail/mew-dist/2006-July/026762.html
https://bugzilla.redhat.com/show_bug.cgi?id=522746
http://web.archiveorange.com/archive/v/UcW9CQ0nw0dwjc7exUcu
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
twittering-update-status-interactive.
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?

tomykaira

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" ;)

Tadashi MATSUO
Collaborator

I have commited the fix.
Please try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.