Subject: 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)

From: Francis Devereux <[email-masked]>
Date: Wed, 11 Jul 2012 12:33:27 +0100

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)