bug#39960: 28.0.50; Incompatible change to sql-add-product in Emacs 27

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#39960: 28.0.50; Incompatible change to sql-add-product in Emacs 27

Philipp Stephani

In Emacs 26, sql-add-product has the signature

(sql-add-product PRODUCT DISPLAY &rest PLIST)

However, in the Emacs 27 pretest the signature is now

(sql-add-product PRODUCT DISPLAY &optional PLIST)

Note the change from &rest to &optional.  This is a breaking change that
breaks all users of sql-add-product.  I've found quite a few uses of the
old signature in the wild,
e.g. https://github.com/kat-co/sql-prestodb/blob/f4a74d88dcb166445bb41efb865147c0faf1de3a/src/sql-presto.el#L59
or
https://github.com/r0man/vertica-el/blob/3c9647b425c5c13c30bf0cba483646af18196588/vertica.el#L68
or
https://github.com/jterk/sql-impala/blob/466e7c0c789ec3e5e8a276c8f6754f91bb584c3e/sql-impala.el#L71.
This change was introduced in commit
c124d5323c05a4010db9b2d330575d029936ade1.  I don't think we should
introduce such a breaking change to a widely-used public function; at
the very least, Emacs 27 should accept both signatures.


In GNU Emacs 28.0.50 (build 39, x86_64-apple-darwin19.3.0, NS appkit-1894.30 Version 10.15.3 (Build 19D76))
 of 2020-02-29
Repository revision: 3d2c82ac96a7f37e60b2b85a5c9c1d792084ab54
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.3

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --with-modules --without-xml2 --without-pop --with-mailutils
 --enable-gcc-warnings=warn-only --enable-checking=all
 --enable-check-lisp-object-type 'CFLAGS=-ggdb3 -O0''

Configured features:
NOTIFY KQUEUE ACL GNUTLS ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS
JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-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

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec epa epg epg-config gnus-util
rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils phst skeleton
derived edmacro kmacro pcase ffap thingatpt url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars
subr-x rx gnutls puny seq byte-opt gv bytecomp byte-compile cconv dbus
xml cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 60470 5746)
 (symbols 48 8045 0)
 (strings 32 20761 1931)
 (string-bytes 1 688813)
 (vectors 16 12996)
 (vector-slots 8 167493 10214)
 (floats 8 27 19)
 (intervals 56 196 0)
 (buffers 1000 11))



Reply | Threaded
Open this post in threaded view
|

bug#39960: 28.0.50; Incompatible change to sql-add-product in Emacs 27

Eli Zaretskii
Ping!

> Date: Sat, 07 Mar 2020 09:43:39 +0200
> From: Eli Zaretskii <[hidden email]>
> Cc: [hidden email]
>
> > From: Philipp <[hidden email]>
> > Date: Fri, 06 Mar 2020 23:39:16 +0100
> >
> >
> > In Emacs 26, sql-add-product has the signature
> >
> > (sql-add-product PRODUCT DISPLAY &rest PLIST)
> >
> > However, in the Emacs 27 pretest the signature is now
> >
> > (sql-add-product PRODUCT DISPLAY &optional PLIST)
> >
> > Note the change from &rest to &optional.  This is a breaking change that
> > breaks all users of sql-add-product.  I've found quite a few uses of the
> > old signature in the wild,
> > e.g. https://github.com/kat-co/sql-prestodb/blob/f4a74d88dcb166445bb41efb865147c0faf1de3a/src/sql-presto.el#L59
> > or
> > https://github.com/r0man/vertica-el/blob/3c9647b425c5c13c30bf0cba483646af18196588/vertica.el#L68
> > or
> > https://github.com/jterk/sql-impala/blob/466e7c0c789ec3e5e8a276c8f6754f91bb584c3e/sql-impala.el#L71.
> > This change was introduced in commit
> > c124d5323c05a4010db9b2d330575d029936ade1.  I don't think we should
> > introduce such a breaking change to a widely-used public function; at
> > the very least, Emacs 27 should accept both signatures.
>
> Thanks for reporting this.
>
> Michael, could you please look into this ASAP?  TIA.
>
> Btw, this change of a public API is not in NEWS, AFAICT; if we decide
> eventually on keeping the change, we should announce it in NEWS.
>
>
>
>



Reply | Threaded
Open this post in threaded view
|

bug#39960: 28.0.50; Incompatible change to sql-add-product in Emacs 27

Emacs - Bugs mailing list
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, March 13, 2020 5:53 AM, Eli Zaretskii <[hidden email]> wrote:

> Ping!
>
> > Date: Sat, 07 Mar 2020 09:43:39 +0200
> > From: Eli Zaretskii [hidden email]
> > Cc: [hidden email]
> >
> > > From: Philipp [hidden email]
> > > Date: Fri, 06 Mar 2020 23:39:16 +0100
> > > In Emacs 26, sql-add-product has the signature
> > > (sql-add-product PRODUCT DISPLAY &rest PLIST)
> > > However, in the Emacs 27 pretest the signature is now
> > > (sql-add-product PRODUCT DISPLAY &optional PLIST)
> > > Note the change from &rest to &optional. This is a breaking change that
> > > breaks all users of sql-add-product. I've found quite a few uses of the
> > > old signature in the wild,
> >
> > Thanks for reporting this.
> > Michael, could you please look into this ASAP? TIA.
> > Btw, this change of a public API is not in NEWS, AFAICT; if we decide
> > eventually on keeping the change, we should announce it in NEWS.

Sorry for the delay. The massive switch to WFH and illness concerns at home
interfered. All are fine, and I actually do get work done occasionally.

I've got the following patch to make. I assume it needs to be made to the
emacs-27 branch and corresponding patches made to master as well. If I
should only commit to master (same change is needed there) for cherry-picking
for emacs-27, let me know.

$ git diff
diff --git a/ChangeLog.3 b/ChangeLog.3
index fc41c1f7dc..e6cad9ed7c 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -1,3 +1,11 @@
+2020-03-22  Michael R. Mauger  <[hidden email]>
+
+ * lisp/progmodes/sql.el (sql-add-product): Re-correct argument
+ spec.  Previous change was due to my own stupidity; I have
+ resolved prior behavior (Bug#39960).
+ * test/lisp/progmodes/sql-tests.el (sql-test-add-product): Added
+ test to insure I don't make the same mistake again.
+
 2020-02-27  Nicolas Petton  <[hidden email]>

  * admin/authors.el (authors-ignored-files): Fix entries.
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 400e304ecf..a04c26d276 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -2740,7 +2740,7 @@ sql-read-product
              nil 'require-match
              init 'sql-product-history init))))

-(defun sql-add-product (product display &optional plist)
+(defun sql-add-product (product display &rest plist)
   "Add support for a database product in `sql-mode'.

 Add PRODUCT to `sql-product-alist' which enables `sql-mode' to
diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el
index d6f89341be..91805ab725 100644
--- a/test/lisp/progmodes/sql-tests.el
+++ b/test/lisp/progmodes/sql-tests.el
@@ -187,13 +187,19 @@ sql-test-add-product
       (sql-add-product 'xyz "XyzDb")

       (should (equal (pp-to-string (assoc 'xyz sql-product-alist))
-                     "(xyz :name \"XyzDb\")\n"))))
+                     "(xyz :name \"XyzDb\")\n")))
+
+  (sql-test-product-feature-harness
+      (sql-add-product 'stu "StuDb" :X 1 :Y "2")
+
+      (should (equal (pp-to-string (assoc 'stu sql-product-alist))
+                     "(stu :name \"StuDb\" :X 1 :Y \"2\")\n"))))

 (ert-deftest sql-test-add-existing-product ()
   "Add a product that already exists."

   (sql-test-product-feature-harness
-      (should-error (sql-add-feature 'a "Aaa"))
+      (should-error (sql-add-product 'a "Aaa"))
       (should (equal (pp-to-string (assoc 'a sql-product-alist))
                      "(a :X 1 :Y 2 :Z sql-test-feature-value-a)\n"))))




--
[hidden email] // FSF and EFF member // GNU Emacs sql.el maintainer




Reply | Threaded
Open this post in threaded view
|

bug#39960: 28.0.50; Incompatible change to sql-add-product in Emacs 27

Philipp Stephani
Am Mo., 23. März 2020 um 02:20 Uhr schrieb Michael Mauger
<[hidden email]>:

>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Friday, March 13, 2020 5:53 AM, Eli Zaretskii <[hidden email]> wrote:
>
> > Ping!
> >
> > > Date: Sat, 07 Mar 2020 09:43:39 +0200
> > > From: Eli Zaretskii [hidden email]
> > > Cc: [hidden email]
> > >
> > > > From: Philipp [hidden email]
> > > > Date: Fri, 06 Mar 2020 23:39:16 +0100
> > > > In Emacs 26, sql-add-product has the signature
> > > > (sql-add-product PRODUCT DISPLAY &rest PLIST)
> > > > However, in the Emacs 27 pretest the signature is now
> > > > (sql-add-product PRODUCT DISPLAY &optional PLIST)
> > > > Note the change from &rest to &optional. This is a breaking change that
> > > > breaks all users of sql-add-product. I've found quite a few uses of the
> > > > old signature in the wild,
> > >
> > > Thanks for reporting this.
> > > Michael, could you please look into this ASAP? TIA.
> > > Btw, this change of a public API is not in NEWS, AFAICT; if we decide
> > > eventually on keeping the change, we should announce it in NEWS.
>
> Sorry for the delay. The massive switch to WFH and illness concerns at home
> interfered. All are fine, and I actually do get work done occasionally.

No worries, and good to hear that!

>
> I've got the following patch to make. I assume it needs to be made to the
> emacs-27 branch and corresponding patches made to master as well. If I
> should only commit to master (same change is needed there) for cherry-picking
> for emacs-27, let me know.

Thanks for the patch! I noticed that it made it to master as commit
82a632edc8b80bf16d9b9f205474bf9724b084c0, but not to emacs-27, are you
still planning to backport it?



Reply | Threaded
Open this post in threaded view
|

bug#39960: 28.0.50; Incompatible change to sql-add-product in Emacs 27

Eli Zaretskii
> From: Philipp Stephani <[hidden email]>
> Date: Sun, 9 Aug 2020 11:14:24 +0200
> Cc: Eli Zaretskii <[hidden email]>, "[hidden email]" <[hidden email]>
>
> Typically you'd cherry-pick the commit onto the release branch. But
> since Emacs 27 is about to be released (tomorrow), it might be too
> late now.

Indeed, it's too late for 27.1.  Let's try to cherry-pick after 27.1
is released, so that the fix ends up in 27.2.

Thanks.