emacscollective / epkg

Browse the Emacsmirror package database
https://emacsmirror.net/manual/epkg
GNU General Public License v3.0
55 stars 7 forks source link

Cannot use `epkg-list-packages` on Emacs master #12

Closed NicolasPetton closed 6 years ago

NicolasPetton commented 6 years ago

I've been using Emacs 25.2 for a while, and I now switched to the master branch.

When executing epkg-list-packages, I get the following error:

entered--Lisp error: (error "Keyword argument (:file /home/nico/.emacs.d/var/epkgs/epkg.sqlite) not one of nil")
  signal(error ("Keyword argument (:file /home/nico/.emacs.d/var/epkgs/epkg.sqlite) not one of nil"))
  error("Keyword argument %s not one of nil" (:file "/home/nico/.emacs.d/var/epkgs/epkg.sqlite"))
  #f(compiled-function (arg1 &rest rest) #<bytecode 0x17d3ed1>)(#<epkg-database epkg-database-1d2b460> (:file "/home/nico/.emacs.d/var/epkgs/epkg.sqlite"))
  apply(#f(compiled-function (arg1 &rest rest) #<bytecode 0x17d3ed1>) (#<epkg-database epkg-database-1d2b460> (:file "/home/nico/.emacs.d/var/epkgs/epkg.sqlite")))
  #f(compiled-function (&rest args) #<bytecode 0x16a48c1>)(#<epkg-database epkg-database-1d2b460> (:file "/home/nico/.emacs.d/var/epkgs/epkg.sqlite"))
  apply(#f(compiled-function (&rest args) #<bytecode 0x16a48c1>) #<epkg-database epkg-database-1d2b460> (:file "/home/nico/.emacs.d/var/epkgs/epkg.sqlite"))
  initialize-instance(#<epkg-database epkg-database-1d2b460> (:file "/home/nico/.emacs.d/var/epkgs/epkg.sqlite"))
  #f(compiled-function (class &rest slots) "Default constructor for CLASS `eieio-default-superclass'.\nSLOTS are the initialization slots used by `initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls `initialize-instance' on that object." #<bytecode 0x10f1c89>)(epkg-database :file "/home/nico/.emacs.d/var/epkgs/epkg.sqlite")
  apply(#f(compiled-function (class &rest slots) "Default constructor for CLASS `eieio-default-superclass'.\nSLOTS are the initialization slots used by `initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls `initialize-instance' on that object." #<bytecode 0x10f1c89>) epkg-database (:file "/home/nico/.emacs.d/var/epkgs/epkg.sqlite"))
  make-instance(epkg-database :file "/home/nico/.emacs.d/var/epkgs/epkg.sqlite")
  #f(compiled-function (class &optional variable file debug) #<bytecode 0x178c1b5>)(epkg-database epkg--db-connection "/home/nico/.emacs.d/var/epkgs/epkg.sqlite")
  apply(#f(compiled-function (class &optional variable file debug) #<bytecode 0x178c1b5>) epkg-database (epkg--db-connection "/home/nico/.emacs.d/var/epkgs/epkg.sqlite"))
  closql-db(epkg-database epkg--db-connection "/home/nico/.emacs.d/var/epkgs/epkg.sqlite")
  epkg-db()
tarsius commented 6 years ago

After switching between Emacs 26 and 25 you have to recompile at least closql. Not sure if recompiling just that is enough, but I would recommend doing it like so even that were the case:

cd ~/.emacs.d
make

The problem is that in Emacs 26 eieio uses the new records type while before it used vectors, and if you use byte-code from one version in the other, then you will in some cases get the wrong type. I am not sure whether this affects all code that uses eieio or only closql which has to poke at things users of eieio are not supposed to poke at (because it has to de-/serialize objects).

NicolasPetton commented 6 years ago

I did that already, pulled epkgs, and ran make from my emacs.d, but it didn't change anything.

NicolasPetton commented 6 years ago

@tarsius note that I'm using the master branch of Emacs, not emacs-26.

tarsius commented 6 years ago

Err yeah, and the backtrace doesn't say anything about vectors or records anyway. Compiling...

tarsius commented 6 years ago

Reverting https://github.com/emacs-mirror/emacs/commit/cea0bca54f1fa3635591e24eba1017742b04abd0 fixes the issue. I haven't investigated further than that yet.

NicolasPetton commented 6 years ago

Yes, the issue happens with emacsql. I'll open a ticket in debbugs.

tarsius commented 6 years ago

Please post a link here if/when you have done that.

tarsius commented 6 years ago

Actually it was a bug in emacsql, fixed in https://github.com/skeeto/emacsql/commit/83a278aa6bc0fec5d8aa731b06f2385a8ad8cdbb.

@DamienCassou thanks!

@skeeto could you please make a subminor release for this?

skeeto commented 6 years ago

@tarsius Just now I released EmacSQL 2.0.3 which includes this fix.

This is sort of off-topic, but it's just too convenient not to bring it up. Since I was looking at EmacSQL today, I decided it's finally time to push the minimum supported Emacs version for EmacSQL up to Emacs 25.1. The primary reason is that I want to dump the finalizer dependency and just use Emacs' built-in make-finalizer. In particular, starting in Emacs 25 there's some sort of subtle Emacs memory corruption bug related to post-gc-hook that's preventing me from running EmacSQL's unit tests, and the easiest thing to do is not use this hook (as is required by the finalizer package). The secondary reason is this simplifies things with respect to cl-generic and eieio.

However, I intentionally did not include those commits in 2.0.3 since that's a breaking change if you're using Emacs 24.

tarsius commented 6 years ago

That's a perfectly reasonable thing to do; support older Emacsen until it starts getting painful - then stop. And to answer the implied question; no this doesn't affect me, all my packages that use emacsql already depend on Emacs 25.

Off-off-topic, since it is just too convenient to do this now; here's my wishlist for emacsql:

tarsius commented 6 years ago

@skeeto You haven't pushed the tag yet. Since the old tag wasn't public yet, could you please recreate it to include the current tip with my change?