Subject: Re: bug#45433: 28.0.50; byte/native-compiling ivy and ox-publish possibly miscompiled

From: Andrea Corallo <[email-masked]>
Date: Wed, 06 Jan 2021 00:13:36 +0000

Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

> Mauricio Collares <[email-masked]> writes:
>
>> Andrea Corallo <[email-masked]> writes:
>>
>>> Hi Mauricio,
>>>
>>> I had a look, this issue is not native compiler related as I get the
>>> same behavior byte compiling.
>>>
>>> The trouble seems with `ivy-add-face-text-property' being defaliased,
>>> ATM I'm not sure what is going on tho.
>>>
>>>   Andrea
>>
>> Hi Andrea,
>>
>> Here's an attempt at a minimized testcase:
>>
>> * Contents of ~/ivy.el:
>>
>> (defun ivy--call-marked (action)
>>   (let* ((prefix-len (length ivy-mark-prefix))
>>          (marked-candidates
>>           (mapcar
>>            (lambda (s)
>>              (let ((cand (substring s prefix-len)))
>>                (if ivy--directory
>>                    (expand-file-name cand ivy--directory)
>>                  cand)))
>>            ivy-marked-candidates))
>>          (multi-action (ivy--get-multi-action ivy-last)))))
>>
>> (defalias 'ivy--file-local-name
>>   (if (fboundp 'file-local-name)
>>       #'file-local-name
>>     (lambda (file)
>>       (or (file-remote-p file 'localname) file))))
>>
>> (provide 'ivy)
>>
>> * Run the following three commands (note that skipping either command 1
>>   or command 2 makes the last command pass):
>>
>> $ emacs -Q --batch --eval "(add-to-list 'load-path \"/home/collares\")"
>> -f batch-byte-compile ~/ivy.el
>>
>> $ emacs -Q --batch --eval "(add-to-list 'load-path \"/home/collares\")"
>> --eval "(setq comp-eln-load-path '(\"/home/collares/\"))" -f batch-native-compile ~/ivy.el
>>
>> $ emacs -Q --batch --eval "(add-to-list 'load-path \"/home/collares\")"
>> --eval "(setq comp-eln-load-path '(\"/home/collares/\"))" --eval "(require 'ivy)"
>>
>> With this, I still get the same error locally:
>
> Hi Mauricio,
>
> thanks for reducing, I can reproduce this version too.
>
> It looks more like a load issue then a miscompilation.

All right I did some investigation.  This is how the top level form
looks in the .elc file:

(byte-code "\300\301\302\303!\203\f^@\303\202^M^@\304\"\210\305\306!\207" [defalias xxx--file-local-name fboundp file-local-name #[257 "\300^A\301\"\206^H^@\211\207" [file-
remote-p localname] 4 "\n\n(fn FILE)"] provide xxx] 4)

When we execute this from the .elc in exec_byte_code we have:

(gdb) p *(bytestr_data+10)
$43 = 13 '\r'

While loading from .eln we have:

(gdb) p *(bytestr_data+10)
$31 = 10 '\n'

ATM I've no idea why of this difference, I'm pretty sure in the eln we
have 13 so might be a reader miss-configuration?

I'll look into it more to see where the difference is coming from,
hopefully should be pretty narrowed at this stage.

  Andrea