all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#11908: 24.1; "Unable to locate SQL program" when using sql-mysql with tramp and the client does not have the SQL program (but the server does)
@ 2012-07-11 11:33 Francis Devereux
  2012-07-13 14:31 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Francis Devereux @ 2012-07-11 11:33 UTC (permalink / raw)
  To: 11908

Steps to reproduce:

1) Have a client machine (i.e. the machine running emacs) with no mysql
executable on the PATH, and a server machine which does have mysql on
the path.

2) C-x C-f /server: RETURN (to open a tramp dired buffer to the server)

3) M-x sql-mysql RETURN, and then fill in username/password/database, leave
server blank

4) You get the message "Unable to locate SQL program 'mysql'"

However, if you comment out the following lines in sql-comint in sql.el:
;    (unless (executable-find program)
;      (error "Unable to locate SQL program \'%s\'" program))
then it works - you get an SQLi buffer running mysql in an ssh session on
the server.

I'm running Emacs on OS X, server is running Debian GNU/Linux 6.0 (also
happens with Red Hat servers). Can test with a GNU/Linux client if required.

Francis

In GNU Emacs 24.1.1 (x86_64-apple-darwin11.4.0, NS apple-appkit-1138.47)
 of 2012-06-10 on jupiter-wifi.repton.int
Windowing system distributor `Apple', version 10.3.1138
Configured using:
 `configure '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Dired by date

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<return> a s s e t b a n k _ <backspace> <return> <return> 
<help-echo> M-x r e p o r t - e m <tab> <return>

Recent messages:
Making completion list...
Quit [3 times]
Loading sql...done
goto-history-element: Beginning of history; no preceding item
Creating customization items...
Creating customization items ...done
Resetting customization items...done
Creating customization setup...done
Quit
Login...
sql-comint: Unable to locate SQL program 'mysql'

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mail-utils sql thingatpt cus-edit
cus-start cus-load wid-edit help-mode easymenu view dired tramp-cache
tramp-sh tramp tramp-compat auth-source eieio byte-opt bytecomp
byte-compile cconv macroexp assoc gnus-util mm-util mail-prsvr
password-cache shell pcomplete comint ansi-color ring format-spec advice
help-fns advice-preload tramp-loaddefs regexp-opt time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process ns multi-tty
emacs)






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#11908: 24.1; "Unable to locate SQL program" when using sql-mysql with tramp and the client does not have the SQL program (but the server does)
  2012-07-11 11:33 bug#11908: 24.1; "Unable to locate SQL program" when using sql-mysql with tramp and the client does not have the SQL program (but the server does) Francis Devereux
@ 2012-07-13 14:31 ` Michael Albinus
  2012-07-13 14:45   ` Francis Devereux
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2012-07-13 14:31 UTC (permalink / raw)
  To: Francis Devereux; +Cc: 11908

Francis Devereux <francis@devrx.org> writes:

> However, if you comment out the following lines in sql-comint in sql.el:
> ;    (unless (executable-find program)
> ;      (error "Unable to locate SQL program \'%s\'" program))
> then it works - you get an SQLi buffer running mysql in an ssh session on
> the server.

Indeed, `executable-find' does not work in this case. I would propose
the following check, which keeps the test for local processes:

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs/lisp/progmodes/sql.el.~109053~	2012-07-13 16:25:32.863194360 +0200
--- /home/albinus/src/emacs/lisp/progmodes/sql.el	2012-07-13 16:24:52.026991734 +0200
***************
*** 4146,4153 ****
  passed as command line arguments."
    (let ((program (sql-get-product-feature product :sqli-program))
          (buf-name "SQL"))
!     ;; make sure we can find the program
!     (unless (executable-find program)
        (error "Unable to locate SQL program \'%s\'" program))
      ;; Make sure buffer name is unique
      (when (sql-buffer-live-p (format "*%s*" buf-name))
--- 4146,4155 ----
  passed as command line arguments."
    (let ((program (sql-get-product-feature product :sqli-program))
          (buf-name "SQL"))
!     ;; Make sure we can find the program.  `executable-find' does not
!     ;; work for remote hosts; we suppress the check there.
!     (unless (or (file-remote-p default-directory)
! 		(executable-find program))
        (error "Unable to locate SQL program \'%s\'" program))
      ;; Make sure buffer name is unique
      (when (sql-buffer-live-p (format "*%s*" buf-name))
--8<---------------cut here---------------end--------------->8---

Could you, please, check, whether this works for you?

> Francis

Best regards, Michael.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#11908: 24.1; "Unable to locate SQL program" when using sql-mysql with tramp and the client does not have the SQL program (but the server does)
  2012-07-13 14:31 ` Michael Albinus
@ 2012-07-13 14:45   ` Francis Devereux
  2012-07-13 15:00     ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Francis Devereux @ 2012-07-13 14:45 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 11908

On 13 Jul 2012, at 15:31, Michael Albinus wrote:

> Francis Devereux <francis@devrx.org> writes:
> 
>> However, if you comment out the following lines in sql-comint in sql.el:
>> ;    (unless (executable-find program)
>> ;      (error "Unable to locate SQL program \'%s\'" program))
>> then it works - you get an SQLi buffer running mysql in an ssh session on
>> the server.
> 
> Indeed, `executable-find' does not work in this case. I would propose
> the following check, which keeps the test for local processes:

[ patch snipped]

> Could you, please, check, whether this works for you?

Yes, this does work for me. I have tested both for a remote host, where the check is correctly skipped, and for the local host, where the check is done and correctly fails when sql-mysql-program can't be found.

Thanks Michael :-)

Francis






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#11908: 24.1; "Unable to locate SQL program" when using sql-mysql with tramp and the client does not have the SQL program (but the server does)
  2012-07-13 14:45   ` Francis Devereux
@ 2012-07-13 15:00     ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2012-07-13 15:00 UTC (permalink / raw)
  To: Francis Devereux; +Cc: 11908-done

Francis Devereux <francis@devrx.org> writes:

> Yes, this does work for me. I have tested both for a remote host,
> where the check is correctly skipped, and for the local host, where
> the check is done and correctly fails when sql-mysql-program can't be
> found.

Thanks for the test. I've committed the patch to the trunk, closing this
bug.

> Thanks Michael :-)
>
> Francis

Best regards, Michael.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-13 15:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-11 11:33 bug#11908: 24.1; "Unable to locate SQL program" when using sql-mysql with tramp and the client does not have the SQL program (but the server does) Francis Devereux
2012-07-13 14:31 ` Michael Albinus
2012-07-13 14:45   ` Francis Devereux
2012-07-13 15:00     ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.