GNU bug report logs - #25941
26.0.50; Different code behavior between using the auto-compiled and evaled versions

Previous Next

Package: emacs;

Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>

Date: Thu, 2 Mar 2017 23:44:01 UTC

Severity: normal

Found in version 26.0.50

Done: Kaushal Modi <kaushal.modi <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Subject: bug#25941: closed (Re: 26.0.50; Different code behavior between
 using the auto-compiled and evaled versions)
Date: Thu, 09 Mar 2017 19:17:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#25941: 26.0.50; Different code behavior between using the auto-compiled and evaled versions

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 25941 <at> debbugs.gnu.org.

-- 
25941: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25941
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: Vibhav Pant <vibhavp <at> gmail.com>, 25941-done <at> debbugs.gnu.org
Cc: Oleh Krehel <ohwoeowho <at> gmail.com>
Subject: Re: 26.0.50; Different code behavior between using the auto-compiled
 and evaled versions
Date: Thu, 09 Mar 2017 19:15:59 +0000
[Message part 3 (text/plain, inline)]
Thanks for the prompt action and fix.

(1) I re-built my emacs to the latest master containing the fix
(2) Re-built the elpa dir by running
     (byte-recompile-directory package-user-dir nil :force)
(3) .. and confirm the bug as fixed!



On Thu, Mar 9, 2017 at 1:28 PM Kaushal Modi <kaushal.modi <at> gmail.com> wrote:

> On Thu, Mar 9, 2017 at 1:23 PM Vibhav Pant <vibhavp <at> gmail.com> wrote:
>
> I've
> added a patch to bytecomp.el which tries to fix this, could you apply
> it and see whether the issue still exists?
>
>
> That fixes it! Thanks.
> --
>
> Kaushal Modi
>
-- 

Kaushal Modi
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>,
 Oleh Krehel <ohwoeowho <at> gmail.com>
Subject: 26.0.50; Different code behavior between using the auto-compiled and
 evaled versions
Date: Thu, 02 Mar 2017 23:43:15 +0000
[Message part 6 (text/plain, inline)]
I discovered a difference in between when running a command from the avy
package (available on GNU Elpa).

I verified that this issue did not exist on emacs 25.1 or emacs 25.2.1.

But it does exist on emacs 26.0.50.

How to recreate the problem:

1. emacs -Q
2. Install the avy package from GNU Elpa
3. M-x toggle-debug-on-error
4. M-x avy-goto-line
5. Enter the number 10

You will get a backtrace like this:

=====
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  avy-action-goto(nil)
  avy-goto-line(1)
  funcall-interactively(avy-goto-line 1)
  call-interactively(avy-goto-line record nil)
  command-execute(avy-goto-line record)
  execute-extended-command(nil "avy-goto-line" nil)
  funcall-interactively(execute-extended-command nil "avy-goto-line" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)
=====

By edebugging the avy.el code, I figured out that the problem was that this
function was returning nil when it should in fact be returning t.

The difficulty in debugging this further is that if I evaluate that
function (avy--process), then the problem goes away.
With point in that function, after I do C-M-x, M-x avy-goto-line starts
working fine.

This problem repeats after each emacs restart; and goes away after C-M-x on
avy--process.

This means that when the compiled version of avy--process is loaded, that
function returns nil incorrectly. But after manually evaluating it, it
starts returning t when expected.

=====
(defun avy--process (candidates overlay-fn)
  "Select one of CANDIDATES using `avy-read'.
Use OVERLAY-FN to visualize the decision overlay."
  (unless (and (consp (car candidates))
               (windowp (cdar candidates)))
    (setq candidates
          (mapcar (lambda (x) (cons x (selected-window)))
                  candidates)))
  (let ((len (length candidates))
        (cands (copy-sequence candidates))
        res)
    (if (= len 0)
        (message "zero candidates")
      (if (= len 1)
          (setq res (car candidates))
        (unwind-protect
             (progn
               (avy--make-backgrounds
                (avy-window-list))
               (setq res (if (eq avy-style 'de-bruijn)
                             (avy-read-de-bruijn
                              candidates avy-keys)
                           (avy-read (avy-tree candidates avy-keys)
                                     overlay-fn
                                     #'avy--remove-leading-chars))))
          (avy--done)))
      (cond ((eq res 'restart)
             (avy--process cands overlay-fn))
            ;; ignore exit from `avy-handler-function'
            ((eq res 'exit))
            (t
             (avy-push-mark)
             (when (and (consp res)
                        (windowp (cdr res)))
               (let* ((window (cdr res))
                      (frame (window-frame window)))
                 (unless (equal frame (selected-frame))
                   (select-frame-set-input-focus frame))
                 (select-window window))
               (setq res (car res)))

             (funcall (or avy-action 'avy-action-goto)
                      (if (consp res)
                          (car res)
                        res)))))))
=====

More info..

The avy--process is called via avy--line when doing M-x avy-goto-line.
Below is the relevant snippet from the avy-goto-line fn. Notice the r
variable.
When numbers are entered as input after M-x avy-goto-line, that (avy--line
(eq arg 4) form should return t. But it is returning nil instead. So
avy-action-goto gets called when it shouldn't be.

After manually evaluating avy--process, r is set to t instead of nil as
expected and the problem goes away.

===== snippet from avy-goto-line fn definition =====
             (r (avy--line (eq arg 4))))
        (unless (eq r t)
          (avy-action-goto r))))))
=====

I started off this bug report on the package github page:
https://github.com/abo-abo/avy/issues/182
But realizing that the same package version works fine on emacs 25.x but
not on the master build, I am filing this report.

In GNU Emacs 26.0.50 (build 52, x86_64-unknown-linux-gnu, GTK+ Version
2.24.23)
 of 2017-03-02
Repository revision: d0d26c1379598983d2163deb13ba8ab13b14ba2c
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Workstation release 6.6
(Santiago)


Configured using:
 'configure --with-modules
 --prefix=/home/kmodi/usr_local/apps/6/emacs/master
 '--program-transform-name=s/^ctags$/ctags_emacs/'
 'CPPFLAGS=-fgnu89-inline -I/home/kmodi/usr_local/6/include
 -I/usr/include/freetype2 -I/usr/include' 'CFLAGS=-ggdb3 -O0'
 'CXXFLAGS=-ggdb3 -O0' 'LDFLAGS=-L/home/kmodi/usr_local/6/lib
 -L/home/kmodi/usr_local/6/lib64 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix


-- 

Kaushal Modi
[Message part 7 (text/html, inline)]

This bug report was last modified 8 years and 81 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.