dash-docs-el / helm-dash

Browse Dash docsets inside emacs
511 stars 59 forks source link

No data base connection on OS X #25

Closed phaebz closed 10 years ago

phaebz commented 10 years ago

Using helm-dash after installing Python_3 docset via helm-dash-install-docset on OS X gives the error (see below for full Backtrace):

esqlite: "Stream buffer has been deleted"

How can I debug this further? Is relevant information missing?

Used Versions: helm-dash from MELPA (20140114.1710) esqlite from MELPA (20140115.728) emacs 24.3.1 (x86_64-apple-darwin)

Backtrace:

Debugger entered--Lisp error: (esqlite-error "Stream buffer has been deleted")
  signal(esqlite-error ("Stream buffer has been deleted"))
  esqlite--error("Stream buffer has been deleted")
  esqlite-stream-read(#<process Esqlite> "SELECT name FROM sqlite_master WHERE type = 'table' LIMIT 1")
  helm-dash-docset-type(#<process Esqlite>)
  #[(x) "\303  \"?\205
dhaley commented 10 years ago

Similar error for me:

Debugger entered--Lisp error: (esqlite-error "Stream buffer has been deleted") signal(esqlite-error ("Stream buffer has been deleted")) (let ((msg (apply (quote format) fmt args))) (signal (quote esqlite-error) (list msg))) esqlite--error("Stream buffer has been deleted") (if (buffer-live-p buf) nil (esqlite--error "Stream buffer has been deleted")) (let ((buf (process-buffer stream))) (if (buffer-live-p buf) nil (esqlite--error "Stream buffer has been deleted")) (save-current-buffer (set-buffer buf) (esqlite--read-csv-with-deletion nullvalue))) (let (nullvalue) (cond ((process-get stream (quote esqlite-stream-continue-prompt)) (setq nullvalue (process-get stream (quote esqlite-null-value)))) (t (setq nullvalue (esqlite--temp-null query)) (process-put stream (quote esqlite-null-value) nullvalue) (esqlite-stream--send-command-0 stream (format ".nullvalue %s" nullvalue)))) (esqlite-stream--send-sql-0 stream query) (let ((buf (process-buffer stream))) (if (buffer-live-p buf) nil (esqlite--error "Stream buffer has been deleted")) (save-current-buffer (set-buffer buf) (esqlite--read-csv-with-deletion nullvalue)))) esqlite-stream-read(# "SELECT name FROM sqlite_master WHERE type = 'table' LIMIT 1") (car (esqlite-stream-read connection type_sql)) (member "searchIndex" (car (esqlite-stream-read connection type_sql))) (if (member "searchIndex" (car (esqlite-stream-read connection type_sql))) "DASH" "ZDASH") (let ((type_sql "SELECT name FROM sqlite_master WHERE type = 'table' LIMIT 1")) (if (member "searchIndex" (car (esqlite-stream-read connection type_sql))) "DASH" "ZDASH")) helm-dash-docset-type(#) (list x connection (helm-dash-docset-type connection)) (let ((connection (helm-dash-connect-to-docset x))) (list x connection (helm-dash-docset-type connection))) (lambda (x) (let ((connection (helm-dash-connect-to-docset x))) (list x connection (helm-dash-docset-type connection))))("Drupal_7") mapcar((lambda (x) (let ((connection (helm-dash-connect-to-docset x))) (list x connection (helm-dash-docset-type connection)))) ("Drupal_7")) (setq helm-dash-connections (mapcar (function (lambda (x) (let ((connection (helm-dash-connect-to-docset x))) (list x connection (helm-dash-docset-type connection))))) helm-dash-common-docsets)) (progn (setq helm-dash-connections (mapcar (function (lambda (x) (let ((connection ...)) (list x connection (helm-dash-docset-type connection))))) helm-dash-common-docsets))) (if (not helm-dash-connections) (progn (setq helm-dash-connections (mapcar (function (lambda (x) (let (...) (list x connection ...)))) helm-dash-common-docsets)))) helm-dash-create-common-connections() helm-dash() call-interactively(helm-dash) ido-hacks-execute-extended-command(nil) call-interactively(ido-hacks-execute-extended-command nil nil)

kidd commented 10 years ago

I see that https://github.com/mhayashi1120/Emacs-esqlite code says that hasn't been tested in mac osX.

@phaebz or @dhaley Could you test esqlite on its own to make sure that it works by itself? (some elisp knowledge might be needed ) Thanks!

kidd commented 10 years ago

Both errors seem due to buffers being killed (or the sqlite process inside them) and then trying to access them for the searches.

Just blind guessing, some general debugging tips:

Maybe this will give a clue of when/why it's failing.

phaebz commented 10 years ago

As discussed in https://github.com/mhayashi1120/Emacs-esqlite/issues/2#issuecomment-32716187, the helm-dash-install-docset function was autocompleting to "Python_3" when the docset on disk is saved as "Python 3.docset". Now I changed the helm-dash-common-docsets to ("Python 3" "Django") but when doing helm-dash no completions are done...

areina commented 10 years ago

Hi,

please, mac users, could you try to use the 'sqlite-cmd-with-shell-commands' branch?

Thanks!

phaebz commented 10 years ago

I tried with the mentioned branch 'sqlite-cmd-with-shell-commands' and completion works!

The default action 'Go to doc' does not work, though. Do I need a dedicated emacs docset viewer? Anyways, I do not get an error, so how can we debug this further?

kidd commented 10 years ago

it uses `browse-url'. you can try to open a browser and then try helm-dash again. for google-chrome it fails to start the proces on 1 box of mine. haven't dug into that yet.

phaebz commented 10 years ago

Go to doc works for Django, but not for Python[ _]3. I am trying to reinstall the docset and see if that helps. This might be related to comment https://github.com/mhayashi1120/Emacs-esqlite/issues/2#issuecomment-32720743?

kidd commented 10 years ago

@phaebz how did it go with the reinstall?

mhayashi1120 commented 10 years ago

@areina I saw the changes of sqlite-cmd-with-shell-commands branch. It seems that use synchronous shell-command-to-string. If you could still consider to use esqlite as the library, please use esqlite-read function to read sql result safely. This function works well on Mac at least travis environment.

https://travis-ci.org/mhayashi1120/travis-test/builds/17344862

FYI Please consider to use esqlite-prepare function to construct SQL query. This function make it easy to escape SQL text, or LIKE text.

kidd commented 10 years ago

aha. We though about the change to shell-command just as a temporary solution.

We'll take a look at the esqlite-read and esqlite-prepare.

phaebz commented 10 years ago

@kidd Nothing changed with the reinstall, but I noticed another strange thing. After successful installation into Python 3.docset on disk, the Messages buffer showed

Docset installed. Add "x Python 3" to helm-dash-common-docsets or helm-dash-docsets.

I even tried it with the x in front :) still the same, I am getting the completions but the 'browse-url' does not open the Python 3 doc where it does so with Django docset

phaebz commented 10 years ago

FWIW, I edebugged the 'browse-url' and it gets called with the url

"file:///Users/user/.docsets/Python 3.docset/Contents/Resources/Documents/library/itertools.html#//apple_ref/cpp/Module/itertools"

Maybe that blank has to be escaped somehow?

kidd commented 10 years ago

aha, yes, it's quite likely this is what's happening. This branch changed the way we called sqlite, so we may have introduced some bugs.

Thanks for your time!. We'll fix it asap, and maybe try the solution proposed by @mhayashi1120 .

areina commented 10 years ago

Hi @mhayashi1120,

I'm updating the code to use esqlite-read. I see that esqlite is not updated in melpa with the latest changes, could you check it, please?

thanks