GNU bug report logs - #51140
28.0.50; cl-letf appears not to work with native-comp (at least for process-exit-status and other builtins)

Previous Next

Package: emacs;

Reported by: Robert Irelan <rirelan <at> gmail.com>

Date: Mon, 11 Oct 2021 22:38:01 UTC

Severity: normal

Tags: moreinfo

Found in version 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Robert Irelan <rirelan <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 51140 <at> debbugs.gnu.org, Stefan Kangas <stefan <at> marxist.se>, Andrea Corallo <akrl <at> sdf.org>
Subject: bug#51140: 28.0.50; cl-letf appears not to work with native-comp (at least for process-exit-status and other builtins)
Date: Tue, 13 Sep 2022 20:22:36 -0700
[Message part 1 (text/plain, inline)]
I can't reproduce this anymore on 28.1 either:

> (defun +ivy--always-return-zero-exit-code-a (fn &rest args)
>   (let ((process-exit-status-orig
>          (symbol-function 'process-exit-status)))
>     (cl-letf* (((symbol-function 'process-exit-status)
>                 (lambda (_proc)
>                   (let ((code (funcall process-exit-status-orig _proc)))
>                     (if (/= code 0) 0 code)))))
>       (apply fn args))))
> (defun my-test-exit-status-advised ()
>   (my-test-exit-status))
> (defun my-test-exit-status ()
>   (let ((proc (start-process "my-test-exit-status" nil "false")))
>     (while (not (eq (process-status proc) 'exit))
>       (sit-for 0.05))
>     (process-exit-status proc)))
> (advice-add #'my-test-exit-status-advised :around
#'+ivy--always-return-zero-exit-code-a)
> (my-test-exit-status-advised)           ; => 0
> (my-test-exit-status)                   ; => 1

So let's close this.

On Mon, Sep 12, 2022 at 4:49 AM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Robert Irelan <rirelan <at> gmail.com> writes:
>
> >     (defun +ivy--always-return-zero-exit-code-a (fn &rest args)
> >       (let ((process-exit-status-orig
> >              (symbol-function 'process-exit-status)))
> >         (cl-letf* (((symbol-function 'process-exit-status)
> >                     (lambda (_proc)
> >                       (let ((code (funcall process-exit-status-orig
> _proc)))
> >                         (if (= code 2) 0 code)))))
> >           (apply fn args)))
> >     (advice-add #'counsel-rg :around
> #'+ivy--always-return-zero-exit-code-a)
>
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> Andrea was apparently unable to reproduce the problem here on the
> current "master" branch.  Robert, would it be possible for you to test
> this on that branch and see whether this works better there?
>


-- 
Robert Irelan
rirelan <at> gmail.com
[Message part 2 (text/html, inline)]

This bug report was last modified 2 years and 247 days ago.

Previous Next


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