From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Shell quoting in Eshell (was: eshell-batch-file) Date: Sat, 15 Jun 2024 22:10:01 +0300 Message-ID: <86y176rpiu.fsf@gnu.org> References: <86cyoqbq7m.fsf@gnu.org> <6a0e51ee-f4a2-c668-fcc7-eb83954539d5@gmail.com> <86bk4a9bcs.fsf@gnu.org> <86ed8yv951.fsf@gnu.org> <8826aea7-75dd-c147-3dd1-93489038a1ac@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5038"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Jim Porter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 15 21:10:25 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sIYnB-00013V-HV for ged-emacs-devel@m.gmane-mx.org; Sat, 15 Jun 2024 21:10:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sIYmv-0000A0-51; Sat, 15 Jun 2024 15:10:09 -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 1sIYmt-00009j-Gr for emacs-devel@gnu.org; Sat, 15 Jun 2024 15:10:07 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sIYmt-0001D8-8Q; Sat, 15 Jun 2024 15:10:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=JllrEITNpN4rOiJsHCdZaZx5fjZVIP1mtTHYJRv0u+w=; b=ldxMrN9NhwWm QQ62M+u+fd7zN31JyNe/M67S0A0GTCfrXV0nblvdQwRdR+se8oN9ZTku2icMufsnQKpCC5Xum8vZd 1OBBB1EQcc+zpiYEtb5wirDGmWd6LwIKveJthIPmr1u2eA62yWG/l6VlbYzt+6CxYpv6Ln5b6Bnzx ZC83XurQz0dzvuyAhRKgLI3maSRDuUyepL46OTEOjLaLRYPBxd83Tm/vUXmHeJXHtMyPTHtJGdIfQ NecFyiu2OQt3C9EbAcV7l3kOYtizF9q8cwq97PtbJARxXA+cW5LwCjmckm0hS0kFm/JZEv+ms2Idj ls2bkABF/BeYAp6hZnXFEA==; In-Reply-To: <8826aea7-75dd-c147-3dd1-93489038a1ac@gmail.com> (message from Jim Porter on Sat, 15 Jun 2024 11:36:57 -0700) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:320168 Archived-At: > Date: Sat, 15 Jun 2024 11:36:57 -0700 > Cc: emacs-devel@gnu.org > From: Jim Porter > > > Why do we expect to see "killed" or "interrupt" in this case? > > Eshell intends to print the exit message from the process sentinel of > the tail process here (unless the message starts with "finished" or > "exited"). After thinking this over, I realized that the test failure > you encountered was actually a race condition: Eshell tries to kill all > the processes in the pipeline, which -- if Eshell is fast enough -- > sends a signal to the tail process, making us print the exit message. > However, if Eshell is slow, the tail process might exit on its own > before we can signal it, leading to no message. > > I've now fixed this test so that we check that there are zero or one > exit messages (the old code was too lenient in some regards). The test succeeds, thanks. > I think the only remaining thing to do here is to figure out why you > needed to change 'eshell-command-result--equal'. I imagine this is > because I made a mistake somewhere with case normalization (my guess is > in the globbing tests). Hopefully it's just a problem with the tests, > but it could be that there's a bug hiding in Eshell proper. I don't see how you could fix this in the tests, since this is a basic problem with comparing file names on MS-Windows. See below. > Could you try the diff below and report back the failures when you get a > chance? Here: Test esh-cmd-test/which/plain/external-program backtrace: signal(ert-test-failed (((should (eshell-command-result--equal comma ert-fail(((should (eshell-command-result--equal command (eshell-test (if (unwind-protect (setq value-7 (apply fn-5 args-6)) (setq form-de (let (form-description-9) (if (unwind-protect (setq value-7 (apply f (let ((value-7 'ert-form-evaluation-aborted-8)) (let (form-descripti (let* ((fn-5 #'eshell-command-result--equal) (args-6 (condition-case (let ((eshell-module-loading-messages nil)) (let* ((fn-5 #'eshell-co (let ((ert--infos (cons (cons "Command logs: " #'eshell-get-debug-lo eshell-command-result-equal("which sh" "d:/usr/MSYS/bin/sh.exe\n") #f(lambda () [t] (let* ((fn-167 #'executable-find) (args-168 (condit #f(compiled-function () #)() handler-bind-1(#f(compiled-function () # ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test ert-run-test(#s(ert-test :name esh-cmd-test/which/plain/external-pro ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp)))) ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n command-line-1(("-L" ";." "-l" "ert" "--eval" "(setq treesit-extra-l command-line() normal-top-level() Test esh-cmd-test/which/plain/external-program condition: Command logs: command: "which sh" (ert-test-failed ((should (eshell-command-result--equal command (eshell-test-command-result command) result)) :form (eshell-command-result--equal "which sh" #("D:/usr/MSYS/bin/sh.exe\n" 22 23 (field command-output front-sticky ... rear-nonsticky ... insert-in-front-hooks ...)) "d:/usr/MSYS/bin/sh.exe\n") :value nil :explanation (nonequal-result (command "which sh") (result #("D:/usr/MSYS/bin/sh.exe\n" 22 23 ...)) (expected "d:/usr/MSYS/bin/sh.exe\n")))) FAILED 59/66 esh-cmd-test/which/plain/external-program (0.003953 sec) at lisp/eshell/esh-cmd-tests.el:538 IOW: you run "which SOMETHING" and pretend to know how it will capitalize the drive letter.