From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#23566: sql-sqlite: selecting database file is crippled) Date: Sat, 31 Dec 2016 23:03:07 -0500 Message-ID: <87pok777gk.fsf@users.sourceforge.net> References: <87posko3km.fsf@linux-qg7d.i-did-not-set--mail-host-address--so-tickle-me> <57900512.2070007@pointsman.de> <87r34n321o.fsf@pointsman.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1483243400 21497 195.159.176.226 (1 Jan 2017 04:03:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 1 Jan 2017 04:03:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 23566@debbugs.gnu.org To: Rolf Ade Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 01 05:03:15 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cNXMV-0004Tg-AL for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jan 2017 05:03:11 +0100 Original-Received: from localhost ([::1]:46136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNXMZ-0002nZ-0Y for geb-bug-gnu-emacs@m.gmane.org; Sat, 31 Dec 2016 23:03:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNXMP-0002mE-Hu for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 23:03:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cNXMM-0006nL-E5 for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 23:03:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46437) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cNXMM-0006nD-9L for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 23:03:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cNXML-0000BA-VO for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 23:03:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jan 2017 04:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23566 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23566-submit@debbugs.gnu.org id=B23566.1483243336633 (code B ref 23566); Sun, 01 Jan 2017 04:03:01 +0000 Original-Received: (at 23566) by debbugs.gnu.org; 1 Jan 2017 04:02:16 +0000 Original-Received: from localhost ([127.0.0.1]:33603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cNXLc-0000A4-6j for submit@debbugs.gnu.org; Sat, 31 Dec 2016 23:02:16 -0500 Original-Received: from mail-it0-f43.google.com ([209.85.214.43]:38613) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cNXLa-00009m-5P; Sat, 31 Dec 2016 23:02:14 -0500 Original-Received: by mail-it0-f43.google.com with SMTP id x2so258062719itf.1; Sat, 31 Dec 2016 20:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=MUh0X+PU0FLt3pYfuhFEmzjcVJOb4/ZGbDIwsG6KTBM=; b=V6BCRT3py7XkO8NQaHPzVrL3sp8bfPfwZDwKKWqVSZ6k3vnHXlPfHNw2zXHeG2XJp1 ATgli4b1ljnRJUxsbyCnf+wBUkO9XZtE/z+5gYVqr5oJjc1qO7kIWe3CsD/8/i0RlRWV UeREs2MVHN9YrFfBENV5tkWQBvJyDm1mokgSPTadzk4sIDG6Pt/3mwAbHTocsReYwCMI 9TUC46RuX3EjXRxyOUOMoX4Knbzm3xYWy//etdIFCbw98np5ISQEpl934a153Z2FNRRU N1/aESd7IIf61yWLLdFXoCadg7GWwD5bg2s7UEFD/nDf8I7UoaUWLr18dR+YhZD7Z+FO uN+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=MUh0X+PU0FLt3pYfuhFEmzjcVJOb4/ZGbDIwsG6KTBM=; b=j+NrBykZCKcU/CLgXnZGVvvTHjLB/8J9j7tV6we0vyRs2OClFjYW21B4Su7TTb/4Ha ugI0dvBNROFkiHP0ZrUMHWvzipv1s+WaVdoLRAzQ1zO3xGLomS9zkE2xrTkFsZvXaxOB GXKkWt66q2sKiakMjI/BkZvZDMf6MfLcy6xBxupcFXvkgicjAZoDUzblPekjHu8uNNIK woEuNmPkp1IwvOLz2m+AIq/JObhixUMaLTXXC/qKwAmBq12XFg6en5SeY6/9Uy0dNFRH 9wE4XoQ/V+/NzTf7kUA49EQfBsET+8z2d4UYoGcxmgtEY8tRdjyTPRrZwah3jhO/ji5C UweQ== X-Gm-Message-State: AIkVDXKv5oKKZ5VU5MoDQ1Po7tvKXUXuR3FRVAU1KWCIorHJPBLzbRk0VcoiDEKY8Lb+QA== X-Received: by 10.36.64.75 with SMTP id n72mr43058192ita.105.1483243328597; Sat, 31 Dec 2016 20:02:08 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id m9sm29641374ioa.12.2016.12.31.20.02.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 31 Dec 2016 20:02:07 -0800 (PST) In-Reply-To: <87r34n321o.fsf@pointsman.de> (Rolf Ade's message of "Sun, 01 Jan 2017 04:13:39 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:127653 Archived-At: tags 23566 patch quit Hi, I'm sorry that nobody responded to your bug report earlier. I expect the problem is that there aren't any sqlite experienced people working on Emacs right now (at least, ignorance of sql(ite) is why *I* passed on this bug the first time around). Rolf Ade writes: > Therefor I propose this slightly more elaborate patch: > > diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el > index 9608a7d..c3c61f2 100644 > --- a/lisp/progmodes/sql.el > +++ b/lisp/progmodes/sql.el > @@ -933,7 +933,7 @@ sql-sqlite-options > :version "20.8" > :group 'SQL) > > -(defcustom sql-sqlite-login-params '((database :file ".*\\.\\(db\\|sqlite[23]?\\)")) > +(defcustom sql-sqlite-login-params '((database :file nil)) > "List of login parameters needed to connect to SQLite." > :type 'sql-login-params > :version "24.1" The :version should be updated when the default value is changed. > @@ -2954,13 +2954,15 @@ sql-get-login-ext > ((plist-member plist :file) > (expand-file-name > (read-file-name prompt > - (file-name-directory last-value) default t > + (file-name-directory last-value) default 'confirm > (file-name-nondirectory last-value) > (when (plist-get plist :file) > `(lambda (f) > - (string-match > - (concat "\\<" ,(plist-get plist :file) "\\>") > - (file-name-nondirectory f))))))) > + (if (not(file-regular-p f)) ^^ missed a space here > + t > + (string-match > + (concat "\\<" ,(plist-get plist :file) "\\>") > + (file-name-nondirectory f)))))))) > > ((plist-member plist :completion) > (completing-read prompt-def (plist-get plist :completion) nil t > This looks reasonable to me, and is small enough to install without copyright assignment. Could you add a commit message too? (format as described in CONTRIBUTE) > > There is no need for fear, a user may by mistake damage a non SQLite > file (by not restricting the file select to a small number of file name > suffixes (which would't be a great strategy. if such fear had ground). > Every SQLite database file has a 100 byte long database header described > here: https://www.sqlite.org/fileformat.html#the_database_header I think the idea is more to restrict the completion to database files for convenience, not protection from damage. But since there doesn't seem to be much of a convention for sqlite file extensions, setting the default to nil seems okay.