GNU bug report logs -
#25941
26.0.50; Different code behavior between using the auto-compiled and evaled versions
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25941 in the body.
You can then email your comments to 25941 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25941
; Package
emacs
.
(Thu, 02 Mar 2017 23:44:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Kaushal Modi <kaushal.modi <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 02 Mar 2017 23:44:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (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 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25941
; Package
emacs
.
(Fri, 03 Mar 2017 12:13:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 25941 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Here's a set of updates that could probably help trace the problem:
- I rebuilt emacs from master using make bootstrap, but the problem
persists.
- I see the problem when I do "M-x avy-goto-line 10" but not when I do "M-:
(avy-goto-line 10)". So the bug triggers only during interactive execution?
A workaround for now is to delete the avy.elc file.
Does the avy--process code not work well with the recently byte compiler
incompatibility in the master branch?
--
Kaushal Modi
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25941
; Package
emacs
.
(Thu, 09 Mar 2017 16:32:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 25941 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Vibhav,
This issue seems to be related to the switch bytecode change.
Can you please review it.
The code snippet in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25941#5 returns
t on emacs 25.2 but nil on emacs master. That is messing up the
avy-goto-line function (avy package).
avy--process does contain the cond form which is affected by the switch
bytecode change.
If I delete the .elc, the issue goes away.
On Fri, Mar 3, 2017 at 7:12 AM Kaushal Modi <kaushal.modi <at> gmail.com> wrote:
> Here's a set of updates that could probably help trace the problem:
>
> - I rebuilt emacs from master using make bootstrap, but the problem
> persists.
> - I see the problem when I do "M-x avy-goto-line 10" but not when I do
> "M-: (avy-goto-line 10)". So the bug triggers only during interactive
> execution?
>
> A workaround for now is to delete the avy.elc file.
>
> Does the avy--process code not work well with the recently byte compiler
> incompatibility in the master branch?
> --
>
> Kaushal Modi
>
--
Kaushal Modi
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25941
; Package
emacs
.
(Thu, 09 Mar 2017 18:24:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 25941 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Thu, Mar 9, 2017 at 10:01 PM, Kaushal Modi <kaushal.modi <at> gmail.com> wrote:
> This issue seems to be related to the switch bytecode change.
`cond' returns the value of the met condition when the clause doesn't
have a body. That's what seems to be happening when (eq res 'exit).
The result should be t instead of nil. A similar example like:
(defun test (v)
(cond ((eq v 1) 'one)
((eq v 2))
(t 'none)))
Also displays different results with (test 2) when byte compiled. I've
added a patch to bytecomp.el which tries to fix this, could you apply
it and see whether the issue still exists?
Thanks,
Vibhav
--
Vibhav Pant
vibhavp <at> gmail.com
[condition-only-clause.diff (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25941
; Package
emacs
.
(Thu, 09 Mar 2017 18:29:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 25941 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]
Reply sent
to
Kaushal Modi <kaushal.modi <at> gmail.com>
:
You have taken responsibility.
(Thu, 09 Mar 2017 19:17:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Kaushal Modi <kaushal.modi <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 09 Mar 2017 19:17:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 25941-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (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 2 (text/html, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 07 Apr 2017 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 80 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.