From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#62556: 29.0.60; [PATCH] Fix regression when calling 'eshell-command' with a pipeline in the background Date: Sat, 1 Apr 2023 00:36:33 -0700 Message-ID: References: <2bb74356-66ec-d417-5732-e1e18b3df1e3@gmail.com> <83tty13040.fsf@gnu.org> <84b09e1c-7670-0f4d-fb26-ed33010214e5@gmail.com> <83y1ncyusb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8988"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62556@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 01 09:37:25 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1piVnh-000272-3Z for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Apr 2023 09:37:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1piVnL-00046D-Na; Sat, 01 Apr 2023 03:37:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piVnK-00045h-5I for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 03:37:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1piVnJ-0006Em-Ta for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 03:37:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1piVnJ-0002SG-Pk for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 03:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Apr 2023 07:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62556 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 62556-submit@debbugs.gnu.org id=B62556.16803346019400 (code B ref 62556); Sat, 01 Apr 2023 07:37:01 +0000 Original-Received: (at 62556) by debbugs.gnu.org; 1 Apr 2023 07:36:41 +0000 Original-Received: from localhost ([127.0.0.1]:35341 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1piVmy-0002RY-Tp for submit@debbugs.gnu.org; Sat, 01 Apr 2023 03:36:41 -0400 Original-Received: from mail-pl1-f175.google.com ([209.85.214.175]:43799) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1piVmx-0002RH-94 for 62556@debbugs.gnu.org; Sat, 01 Apr 2023 03:36:39 -0400 Original-Received: by mail-pl1-f175.google.com with SMTP id kc4so23545325plb.10 for <62556@debbugs.gnu.org>; Sat, 01 Apr 2023 00:36:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680334593; x=1682926593; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=aIG2YPPvyptL+0FF+iOWMVMY7ugAB3GdDwgiKeVEiYA=; b=DuHrCJCm85bvshiDSQB22NmAJCTFjs6EQu3F/sMWAPbu0nDPeLNUshgwQUhbeLMD1m oNWtXs3FydsegO7PKmOdb8Cnf617DXuGMM6iu2KYoirHKcQL8SQDdZExIsH1MKwhWFWv ihiIXZ4PLstN4bzCihvwDunBcWkE6tR6+4sIYcmnvq7d620/BRj9JOQtfh75FYhOSqyx HWKJky1kq2Ef5HYxGEaQHmjRFw+Rvj5IDpjoIgqbHJ2ZwS5C1ev+HlMHm400fB6A/I+8 p6jxgwhnCq9thpH7+EI3HUnnpggJlbjkI0pcu79WRXiWXzWgyGtqEHNmnUxOZ+h0zJTW lAkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680334593; x=1682926593; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aIG2YPPvyptL+0FF+iOWMVMY7ugAB3GdDwgiKeVEiYA=; b=4K7GNbmvVSQ9+qeViFCFSrh4EZ9m+v9t8saptrJKtYMYtnetv5JNeTsjAhKSqYkTlq eA/wJuErJif5QktYKGSXdmIQNFk0waZgCTAsN00SFtyveZW+QQJ0EvTmsuTVoof0ILUK Qoz7U4LoDVvjihJxhrfev3K0FcjBOdAde25q4hnoVYp6v2+InbG0Jpob4bmwAeRoqK5w NHpwj2B/iW1tJ2x30S/NYXcPIV7nkm0H+6H2cmFVCvRy2Hob1wweOFlGfwvJ1lkPx2fX 8V2JJJ6Ije7kXonWsahAq4GRmnfm7fJBhPglcQjJTMQlHA1yNZJqomHR3d9vUnu1QvEi c3UA== X-Gm-Message-State: AAQBX9fYXLXYfzXGUv69N987qT9SJVhuGvVthKoykOJbB1Wj6CJYTa2k HKuR2pvc7z4yYdSNXToVIo4= X-Google-Smtp-Source: AKy350aTeV+wjFeJzQJHeUVk2YMJkuYWAQ9wKDeOhcR76b+RWjrACeA/ZDGtuN6symcaXN1Ha6XJcw== X-Received: by 2002:a17:90b:4c43:b0:230:b0e3:9cad with SMTP id np3-20020a17090b4c4300b00230b0e39cadmr12533297pjb.23.1680334592934; Sat, 01 Apr 2023 00:36:32 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id mh11-20020a17090b4acb00b0023cfbe7d62esm12895888pjb.1.2023.04.01.00.36.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 01 Apr 2023 00:36:32 -0700 (PDT) Content-Language: en-US In-Reply-To: <83y1ncyusb.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:259033 Archived-At: On 3/31/2023 11:35 PM, Eli Zaretskii wrote: > I fixed the first 2, but I don't understand what goes wrong in the > last one and why: [snip] > Test eshell-test/subcommand-reset-in-pipeline condition: > (ert-test-failed > ((should > (eshell-command-result--equal command > (eshell-test-command-result command) > result)) > :form > (eshell-command-result--equal "*cat $ | *cat" nil "first") > :value nil :explanation > (nonequal-result > (command "*cat $ | *cat") > (result nil) > (expected "first")))) > FAILED 16/16 eshell-test/subcommand-reset-in-pipeline (1.796875 sec) at lisp/eshell/eshell-tests.el:80 Lars reported a similar issue a while back too: . I *think* it's due to a race condition somewhere, but I've had quite a bit of difficulty fixing it. I have a couple ideas though, but they're probably too invasive for the release branch. > As another annoyance, I get this prompt, and must type "yes RET": > > passed 1/16 eshell-test/command-running-p (0.203125 sec) > passed 2/16 eshell-test/eshell-command/background (0.015625 sec) > Buffer "*Eshell Async Command Output*" has a running process; kill it? (yes or no) yes > passed 3/16 eshell-test/eshell-command/background-pipeline (2.453125 sec) > > Any suggestions? Does this patch fix it? ---------------------------------------- diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index bf7ec0389f0..fbff51a8873 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -136,6 +136,8 @@ eshell-test/eshell-command/background ;; buffer. (eshell-command "*echo hi &") (with-current-buffer "*Eshell Async Command Output*" + (while (get-buffer-process (current-buffer)) + (accept-process-output)) (goto-char (point-min)) (should (looking-at "\\[echo\\(\\.exe\\)?\\(<[0-9]+>\\)?\\]")))))) @@ -149,6 +151,8 @@ eshell-test/eshell-command/background-pipeline ;; XXX: As above, we can't write to the current buffer here. (eshell-command "*echo hi | *cat &") (with-current-buffer "*Eshell Async Command Output*" + (while (get-buffer-process (current-buffer)) + (accept-process-output)) (goto-char (point-min)) (should (looking-at "\\[cat\\(\\.exe\\)?\\(<[0-9]+>\\)?\\]"))))))