GNU bug report logs - #56865
M-x find-dired fails with "Wrong type: processp, nil"

Previous Next

Package: emacs;

Reported by: Paul Pogonyshev <pogonyshev <at> gmail.com>

Date: Mon, 1 Aug 2022 08:08:01 UTC

Severity: normal

To reply to this bug, email your comments to 56865 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Mon, 01 Aug 2022 08:08:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Pogonyshev <pogonyshev <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 01 Aug 2022 08:08:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: M-x find-dired fails with "Wrong type: processp, nil"
Date: Mon, 1 Aug 2022 10:06:50 +0200
[Message part 1 (text/plain, inline)]
GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.33,
cairo version 1.16.0) of 2022-07-26

Tested also with `emacs -Q', so this is not a problem of my configuration.

1. Open (a slow) remote connection, with TRAMP
2. Run M-x find-dired RET, arguments not important
3. Internal error "Wrong type: processp, nil" appears

Debugging suggests that it happens in `find-dired-with-command' when
calling `set-process-filter'. Apparently the asynchronously started shell
command started ~30 lines above counts as having finished (?) by then.

Paul
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Tue, 02 Aug 2022 10:36:01 GMT) Full text and rfc822 format available.

Message #8 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Paul Pogonyshev <pogonyshev <at> gmail.com>
Cc: 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Tue, 02 Aug 2022 12:34:58 +0200
Paul Pogonyshev <pogonyshev <at> gmail.com> writes:

> Tested also with `emacs -Q', so this is not a problem of my configuration.
>
> 1. Open (a slow) remote connection, with TRAMP
> 2. Run M-x find-dired RET, arguments not important
> 3. Internal error "Wrong type: processp, nil" appears
>
> Debugging suggests that it happens in `find-dired-with-command' when calling
> `set-process-filter'. Apparently the asynchronously started shell command started ~
> 30 lines above counts as having finished (?) by then.

The proper fix here would be to have a way to specify the
filter/sentinel in `shell-command', since that's the only way to really
guarantee that we'll be getting the output here.

But some testing seems to indicate that just moving the settings up
until right after the `shell-command' makes things work, so I've now
made that trivial fix in Emacs 29.  Does this fix this issue for you,
too?






Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 02 Aug 2022 10:36:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Tue, 02 Aug 2022 11:25:02 GMT) Full text and rfc822 format available.

Message #13 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Tue, 2 Aug 2022 13:24:25 +0200
[Message part 1 (text/plain, inline)]
Seems so. I guess with the way Elisp works it is even correct, because (as
I understand) Elisp has no way to notice that process has died if there are
no IO calls between `shell-process' and `set-process-*'. But it does feel
dirty. (Also that `(sit-for 1)'  a few lines above feels dirty.)

Paul

On Tue, 2 Aug 2022 at 12:35, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Paul Pogonyshev <pogonyshev <at> gmail.com> writes:
>
> > Tested also with `emacs -Q', so this is not a problem of my
> configuration.
> >
> > 1. Open (a slow) remote connection, with TRAMP
> > 2. Run M-x find-dired RET, arguments not important
> > 3. Internal error "Wrong type: processp, nil" appears
> >
> > Debugging suggests that it happens in `find-dired-with-command' when
> calling
> > `set-process-filter'. Apparently the asynchronously started shell
> command started ~
> > 30 lines above counts as having finished (?) by then.
>
> The proper fix here would be to have a way to specify the
> filter/sentinel in `shell-command', since that's the only way to really
> guarantee that we'll be getting the output here.
>
> But some testing seems to indicate that just moving the settings up
> until right after the `shell-command' makes things work, so I've now
> made that trivial fix in Emacs 29.  Does this fix this issue for you,
> too?
>
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Tue, 02 Aug 2022 11:29:01 GMT) Full text and rfc822 format available.

Message #16 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Paul Pogonyshev <pogonyshev <at> gmail.com>
Cc: 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Tue, 02 Aug 2022 13:28:29 +0200
Paul Pogonyshev <pogonyshev <at> gmail.com> writes:

> Seems so. I guess with the way Elisp works it is even correct, because
> (as I understand) Elisp has no way to notice that process has died if
> there are no IO calls between `shell-process' and `set-process-*'.

Yes, but I'm not quite sure that's actually the case in all
circumstances (especially when Tramp is involved)...

> But it does feel dirty. (Also that `(sit-for 1)' a few lines above
> feels dirty.)

Yeah, much of the code in find-dired.el looks pretty fragile.

But I guess this works now, so I'm closing this bug report.





bug marked as fixed in version 29.1, send any further explanations to 56865 <at> debbugs.gnu.org and Paul Pogonyshev <pogonyshev <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 02 Aug 2022 11:29:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Wed, 10 Aug 2022 13:27:02 GMT) Full text and rfc822 format available.

Message #21 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Wed, 10 Aug 2022 15:26:03 +0200
[Message part 1 (text/plain, inline)]
Actually no, it doesn't help in all cases. It got better, but sometimes
still dies with the same error:

Debugger entered--Lisp error: (wrong-type-argument processp nil)
  process-mark(nil)
  (move-marker (process-mark proc) (point) (current-buffer))
  (let ((proc (get-buffer-process (current-buffer)))) (message "@ %S %S"
(current-buffer) proc) (move-marker (process-mark proc) (point)
(current-buffer)) (set-process-filter proc #'find-dired-filter)
(set-process-sentinel proc #'find-dired-sentinel))
  ...

For debugging I also added this line:

     (shell-command (concat command "&") (current-buffer))
     (let ((proc (get-buffer-process (current-buffer))))
 +     (message "@ %S %S" (current-buffer) proc)
       ;; Initialize the process marker; it is used by the filter.
       (move-marker (process-mark proc) (point) (current-buffer))  ;; <--
dies here

Here is the resut in buffer *Messages*:

@ #<buffer *Find*> nil

So, the process can be nil immediately after `shell-command' returns too.

Paul


On Tue, 2 Aug 2022 at 13:28, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Paul Pogonyshev <pogonyshev <at> gmail.com> writes:
>
> > Seems so. I guess with the way Elisp works it is even correct, because
> > (as I understand) Elisp has no way to notice that process has died if
> > there are no IO calls between `shell-process' and `set-process-*'.
>
> Yes, but I'm not quite sure that's actually the case in all
> circumstances (especially when Tramp is involved)...
>
> > But it does feel dirty. (Also that `(sit-for 1)' a few lines above
> > feels dirty.)
>
> Yeah, much of the code in find-dired.el looks pretty fragile.
>
> But I guess this works now, so I'm closing this bug report.
>
>
[Message part 2 (text/html, inline)]

bug No longer marked as fixed in versions 29.1 and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 12 Aug 2022 14:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Fri, 12 Aug 2022 15:05:01 GMT) Full text and rfc822 format available.

Message #26 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Paul Pogonyshev <pogonyshev <at> gmail.com>
Cc: 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Fri, 12 Aug 2022 17:04:01 +0200
Paul Pogonyshev <pogonyshev <at> gmail.com> writes:

> Actually no, it doesn't help in all cases. It got better, but sometimes still dies with the
> same error:
>
> Debugger entered--Lisp error: (wrong-type-argument processp nil)
>   process-mark(nil)
>   (move-marker (process-mark proc) (point) (current-buffer))

Yeah, I suspected that this was a too brittle solution.

The real solution would be to use `make-process' here so that we can
specify the filter/sentinel immediately, but I'm not sure how that will
interfere with Tramp?

Anyway, I'm reopening this bug report.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Fri, 12 Aug 2022 15:13:02 GMT) Full text and rfc822 format available.

Message #29 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Fri, 12 Aug 2022 17:12:07 +0200
[Message part 1 (text/plain, inline)]
For what it's worth, I use `grep-find' a lot over Tramp and have never had
problems with it. (Other than when it finds a match in something like a 500
KB minified JS, but this is not Tramp-specific; Emacs in general sucks with
very long lines in text files.) It works over compilation infrastructure
apparently. Compilation itself also works fine for me.

Paul

On Wed, 10 Aug 2022 at 15:26, Paul Pogonyshev <pogonyshev <at> gmail.com> wrote:

> Actually no, it doesn't help in all cases. It got better, but sometimes
> still dies with the same error:
>
> Debugger entered--Lisp error: (wrong-type-argument processp nil)
>   process-mark(nil)
>   (move-marker (process-mark proc) (point) (current-buffer))
>   (let ((proc (get-buffer-process (current-buffer)))) (message "@ %S %S"
> (current-buffer) proc) (move-marker (process-mark proc) (point)
> (current-buffer)) (set-process-filter proc #'find-dired-filter)
> (set-process-sentinel proc #'find-dired-sentinel))
>   ...
>
> For debugging I also added this line:
>
>      (shell-command (concat command "&") (current-buffer))
>      (let ((proc (get-buffer-process (current-buffer))))
>  +     (message "@ %S %S" (current-buffer) proc)
>        ;; Initialize the process marker; it is used by the filter.
>        (move-marker (process-mark proc) (point) (current-buffer))  ;; <--
> dies here
>
> Here is the resut in buffer *Messages*:
>
> @ #<buffer *Find*> nil
>
> So, the process can be nil immediately after `shell-command' returns too.
>
> Paul
>
>
> On Tue, 2 Aug 2022 at 13:28, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
>> Paul Pogonyshev <pogonyshev <at> gmail.com> writes:
>>
>> > Seems so. I guess with the way Elisp works it is even correct, because
>> > (as I understand) Elisp has no way to notice that process has died if
>> > there are no IO calls between `shell-process' and `set-process-*'.
>>
>> Yes, but I'm not quite sure that's actually the case in all
>> circumstances (especially when Tramp is involved)...
>>
>> > But it does feel dirty. (Also that `(sit-for 1)' a few lines above
>> > feels dirty.)
>>
>> Yeah, much of the code in find-dired.el looks pretty fragile.
>>
>> But I guess this works now, so I'm closing this bug report.
>>
>>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Fri, 12 Aug 2022 15:34:01 GMT) Full text and rfc822 format available.

Message #32 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Paul Pogonyshev <pogonyshev <at> gmail.com>, 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Fri, 12 Aug 2022 17:33:29 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

Hi Lars,

> The real solution would be to use `make-process' here so that we can
> specify the filter/sentinel immediately, but I'm not sure how that will
> interfere with Tramp?

Tramp supports filters and sentinels in make-process.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Sat, 13 Aug 2022 11:44:01 GMT) Full text and rfc822 format available.

Message #35 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Paul Pogonyshev <pogonyshev <at> gmail.com>, 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Sat, 13 Aug 2022 13:43:39 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Tramp supports filters and sentinels in make-process.

Great; then I think the rewrite to use make-process should be pretty
straightforward.





Removed tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 11 Sep 2022 11:21:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Thu, 01 Dec 2022 07:34:01 GMT) Full text and rfc822 format available.

Message #40 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Liu Hui <liuhui1610 <at> gmail.com>
To: larsi <at> gnus.org
Cc: michael.albinus <at> gmx.de, pogonyshev <at> gmail.com, 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Thu, 01 Dec 2022 15:33:08 +0800
[Message part 1 (text/plain, inline)]
Hi,

I create a patch according to the discussion and find-dired works well
now.

Best,
Hui

[0001-Set-the-filter-sentinel-of-find-process-reliably-in-.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Thu, 01 Dec 2022 09:22:02 GMT) Full text and rfc822 format available.

Message #43 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Liu Hui <liuhui1610 <at> gmail.com>
Cc: larsi <at> gnus.org, pogonyshev <at> gmail.com, 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Thu, 01 Dec 2022 10:21:28 +0100
Liu Hui <liuhui1610 <at> gmail.com> writes:

> Hi,

Hi Hui,

> I create a patch according to the discussion and find-dired works well
> now.

Thanks, it looks good to me. I'm not sure whether it will always work,
because the embedding shell, added by `shell-command', is not here. But
likely, it doesn't matter.

Paul, could you pls test this patch whether it works for you?

> Best,
> Hui

Best regards, Michael.




Added tag(s) patch. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 01 Dec 2022 13:57:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Sat, 03 Dec 2022 13:39:01 GMT) Full text and rfc822 format available.

Message #48 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Liu Hui <liuhui1610 <at> gmail.com>, larsi <at> gnus.org, 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Sat, 3 Dec 2022 14:38:09 +0100
[Message part 1 (text/plain, inline)]
I can only tell that it doesn't fail every time. The previous
implementation didn't fail constantly, only from time to time, so it's hard
to tell if the new is better.

> it looks good to me

So this is probably a better indicator.

Paul

On Thu, 1 Dec 2022 at 10:21, Michael Albinus <michael.albinus <at> gmx.de> wrote:

> Liu Hui <liuhui1610 <at> gmail.com> writes:
>
> > Hi,
>
> Hi Hui,
>
> > I create a patch according to the discussion and find-dired works well
> > now.
>
> Thanks, it looks good to me. I'm not sure whether it will always work,
> because the embedding shell, added by `shell-command', is not here. But
> likely, it doesn't matter.
>
> Paul, could you pls test this patch whether it works for you?
>
> > Best,
> > Hui
>
> Best regards, Michael.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56865; Package emacs. (Wed, 06 Sep 2023 22:42:02 GMT) Full text and rfc822 format available.

Message #51 received at 56865 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Liu Hui <liuhui1610 <at> gmail.com>, larsi <at> gnus.org, pogonyshev <at> gmail.com,
 56865 <at> debbugs.gnu.org
Subject: Re: bug#56865: M-x find-dired fails with "Wrong type: processp, nil"
Date: Wed, 6 Sep 2023 15:41:29 -0700
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Liu Hui <liuhui1610 <at> gmail.com> writes:
>
>> Hi,
>
> Hi Hui,
>
>> I create a patch according to the discussion and find-dired works well
>> now.
>
> Thanks, it looks good to me. I'm not sure whether it will always work,
> because the embedding shell, added by `shell-command', is not here. But
> likely, it doesn't matter.
>
> Paul, could you pls test this patch whether it works for you?
>
>> Best,
>> Hui
>
> Best regards, Michael.

This patch doesn't apply any more after the below commit.

commit 7bbd7cae0748958a623f23637b95a6fc9debb8b7
Author: Michael Albinus <michael.albinus <at> gmx.de>
Date:   Mon Jul 31 17:49:21 2023 +0200

    Fix find-dired-with-command for remote directories

    * lisp/find-dired.el (find-dired-with-command):
    Use `start-file-process-shell-command'.  (Bug#64897)




Removed tag(s) patch. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 06 Sep 2023 22:42:03 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 282 days ago.

Previous Next


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