dgutov / mmm-mode

New official home for mmm-mode, fixed for Emacs >= 23
http://mmm-mode.sourceforge.net/
GNU General Public License v2.0
333 stars 31 forks source link

mmm-mode bug when upgrading with debian (apt upgrade) #137

Closed OrionRandD closed 1 year ago

OrionRandD commented 1 year ago

sudo fix_broken_package.sh

Root user Which is the package name you want to 'manually' remove? mmm-mode dpkg: dependency problems prevent removal of mmm-mode: maxima-emacs depends on mmm-mode.

dpkg: error processing package mmm-mode (--remove): dependency problems - not removing Errors were encountered while processing: mmm-mode

done :)

sudo apt install -f Reading package lists... Done Building dependency tree... Done Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Setting up mmm-mode (0.5.9-1) ... needrestart is being skipped since dpkg has failed

more info:

apt install --reinstall mmm-mode Reading package lists... Done Building dependency tree... Done Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded. Need to get 0 B/106 kB of archives. After this operation, 0 B of additional disk space will be used. dpkg: warning: files list file for package 'mmm-mode' missing; assumin g package has no files currently installed (Reading database ... 827949 files and directories currently installed .) Preparing to unpack .../mmm-mode_0.5.9-1_all.deb ... Unpacking mmm-mode (0.5.9-1) over (0.5.9-1) ... Setting up mmm-mode (0.5.9-1) ... Install emacsen-common for emacs emacsen-common: Handling install of emacsen flavor emacs Install mmm-mode for emacs install/mmm-mode: Handling install of emacsen flavor emacs install/mmm-mode: byte-compiling for emacs

In toplevel form: mmm-auto.el:178:4: Error: Wrong number of arguments: (3 . 4), 2

In toplevel form: mmm-class.el:36:2: Error: Eager macro-expansion failure: (wrong-number -of-arguments (3 . 4) 2)

In toplevel form: mmm-cmds.el:36:2: Error: Eager macro-expansion failure: (wrong-number- of-arguments (3 . 4) 2)

In toplevel form: mmm-cweb.el:35:2: Error: Eager macro-expansion failure: (wrong-number- of-arguments (3 . 4) 2)

In toplevel form: mmm-defaults.el:37:2: Error: Eager macro-expansion failure: (wrong-num ber-of-arguments (3 . 4) 2)

In toplevel form: mmm-erb.el:62:2: Error: Eager macro-expansion failure: (wrong-number-o f-arguments (3 . 4) 2)

In toplevel form: mmm-mason.el:36:2: Error: Eager macro-expansion failure: (wrong-number -of-arguments (3 . 4) 2)

In toplevel form: mmm-mode.el:93:2: Error: Eager macro-expansion failure: (wrong-number- of-arguments (3 . 4) 2)

In toplevel form: mmm-myghty.el:41:2: Error: Eager macro-expansion failure: (wrong-numbe r-of-arguments (3 . 4) 2)

In toplevel form: mmm-noweb.el:44:2: Error: Eager macro-expansion failure: (wrong-number -of-arguments (3 . 4) 2)

In toplevel form: mmm-region.el:42:2: Error: Eager macro-expansion failure: (wrong-numbe r-of-arguments (3 . 4) 2)

In toplevel form: mmm-rpm.el:45:2: Error: Eager macro-expansion failure: (wrong-number-o f-arguments (3 . 4) 2)

In toplevel form: mmm-sample.el:38:2: Error: Eager macro-expansion failure: (wrong-numbe r-of-arguments (3 . 4) 2)

In toplevel form: mmm-univ.el:35:2: Error: Eager macro-expansion failure: (wrong-number- of-arguments (3 . 4) 2) ERROR: install script from mmm-mode package failed dpkg: error processing package mmm-mode (--configure): installed mmm-mode package post-installation script subprocess return ed error exit status 1 Processing triggers for install-info (7.0.3-2) ... install-info: warning: no info dir entry in /usr/share/info/ocaml.inf o.hocaml.info.hind.gz' install-info: warning: no info dir entry in/usr/share/info/ocaml.inf o.haux.gz' install-info: warning: no info dir entry in `/usr/share/info/ocaml.inf o.hocaml.info.kwd.hind.gz' Errors were encountered while processing: mmm-mode needrestart is being skipped since dpkg has failed E: Sub-process /usr/bin/dpkg returned an error code (1)

vinc17fr commented 1 year ago

The error (with debugging details) can be reproduced by running eval-expression (ESC :), then entering the problematic code from mmm-auto.el:

(if (not (string-match "XEmacs" (emacs-version)))
    (define-obsolete-function-alias 'mmm-add-find-file-hooks 'mmm-add-find-file-hook
      "0.3.8"
      "Both `mmm-add-find-file-hooks' and `mmm-add-find-file-hook' are deprecated.")
  (define-obsolete-function-alias 'mmm-add-find-file-hooks 'mmm-add-find-file-hook))

This seems to be due to the fact that define-obsolete-function-alias is a macro, which is expanded when the file is loaded, i.e. both macros are expanded.

vinc17fr commented 1 year ago

This is reproducible with GNU Emacs 28.2 and 29.1, but not with 27.1. However, it seems that this was working before GNU Emacs 28 for this reason.

OrionRandD commented 1 year ago

This is reproducible with GNU Emacs 28.2 and 29.1, but not with 27.1. However, it seems that this was working before GNU Emacs 28 for this reason.

My emacs version GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.16.0) of 2023-08-30, modified by Debian

What should I do to fix it then?

vinc17fr commented 1 year ago

What should I do to fix it then?

An easy solution could be to drop XEmacs support (or ask XEmacs to implement the when feature), i.e. to change the above code to just:

(define-obsolete-function-alias 'mmm-add-find-file-hooks 'mmm-add-find-file-hook
  "0.3.8"
  "Both `mmm-add-find-file-hooks' and `mmm-add-find-file-hook' are deprecated.")
OrionRandD commented 1 year ago

What should I do to fix it then?

An easy solution could be to drop XEmacs support (or ask XEmacs to implement the when feature), i.e. to change the above code to just:

(define-obsolete-function-alias 'mmm-add-find-file-hooks 'mmm-add-find-file-hook
  "0.3.8"
  "Both `mmm-add-find-file-hooks' and `mmm-add-find-file-hook' are deprecated.")

Thx a ton...

dgutov commented 1 year ago

@vinc17fr Thank you for the help, but apparently the code you are quoting was added (or at least augmented) by the Debian packager, to try to keep the XEmacs support alive.

dgutov commented 1 year ago

I guess we might as well remove them in the next version, to make it easier for the packager. Both functions have been non-recommended for 20+ years now.

dgutov commented 1 year ago

Cc @az143