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.devel Subject: Re: Shell quoting in Eshell (was: eshell-batch-file) Date: Sun, 9 Jun 2024 15:37:05 -0700 Message-ID: References: <86cyoqbq7m.fsf@gnu.org> <6a0e51ee-f4a2-c668-fcc7-eb83954539d5@gmail.com> <86bk4a9bcs.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31078"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 10 00:37:51 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 1sGRAc-0007r2-FN for ged-emacs-devel@m.gmane-mx.org; Mon, 10 Jun 2024 00:37:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sGR9z-0003Cg-8X; Sun, 09 Jun 2024 18:37:11 -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 1sGR9x-0003CI-Sy for emacs-devel@gnu.org; Sun, 09 Jun 2024 18:37:10 -0400 Original-Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sGR9w-0004xY-AN; Sun, 09 Jun 2024 18:37:09 -0400 Original-Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-6e9f52e99c2so664105a12.1; Sun, 09 Jun 2024 15:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717972626; x=1718577426; darn=gnu.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=vIU2AEF4N55NZGm84IBRrS/bmJi2RBjItFA6wA1qNhc=; b=Rwe6rHO4BQI6LMJutxG2dCAbzjKM4PwMzq6rpmDNXZ5fbsLuU7b4IEdBX7b++QGy0v 7GjgNgKrnZKhhWviuK5Wvl74peK5eYJntOvhuX7oZHZPmcQ1udZgmlAZt2KLt4t2HqHX WqWXjtns3H3Oi+765TiaocaDPpPzXp8Xwb9Mj81dkFUQi3dhHeqg9LY1o0DeE0VMaNlJ gPx/DryZBr32EZLEOvS72bJtix2jVWbo0nMhH2Y6Tp/Hy2K88lAMjYxaF1GopnTEYRG9 QWIRV92+68EgtShETLmhAEcAK4QcwBi5jywraArYACV6jxdFauDYQ3USg5Mk5DfYaQdo Of8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717972626; x=1718577426; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vIU2AEF4N55NZGm84IBRrS/bmJi2RBjItFA6wA1qNhc=; b=GR1eog1iHLePVbTt+vJ4t9Uzey527hsz/G+Abd6W93+43fKFey5/Atiy/rjw9pl1Ch kveYbpAAtDP+Q6G3626yfbwKzKKG3jFDGviBrNHJK7ZfK5q6Tt4ZHmClidXovUeziHtg StlqvAN0mVS/3mhLPpjnTN2pHGAjWBQTvU2+MLHGAziX0NbRmEDG6skiUeKs9Nw7Rhe1 Y/OhYaXQgnPUWx2aUPYRXwVAbTQbuZqx16tO+wxu43aheuMyGR+c/5nPEOjQRUQe3Zb+ fpw82ZSrZ5sAYXFHwSacSvPxs0D3Lj4U6rB/jf1MeFKaqrLn9HWWkAOrOXgc9/waIaH+ Bk1g== X-Gm-Message-State: AOJu0Yy3wuzcDYv/x714OGftar22yo/eqp4+4mgMO7kkcV/8HVqRaHAJ +c6lCRyeFXtwSR1KafXrKVNIECDbJYcgbAGizUGkEZQlUeoeOAo/FBJUqQ== X-Google-Smtp-Source: AGHT+IF4tLLe1BDuFwycs9oEu7r3RYQT2ANsjdExaT5Eic4Ocwdxk5Pj0TvFVeOksYW7W2M+aiGUbw== X-Received: by 2002:a05:6a20:3c86:b0:1b7:175a:6756 with SMTP id adf61e73a8af0-1b71769bb95mr1281702637.50.1717972626220; Sun, 09 Jun 2024 15:37:06 -0700 (PDT) Original-Received: from [192.168.1.2] (syn-023-240-098-037.res.spectrum.com. [23.240.98.37]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2c2d5804777sm4054231a91.55.2024.06.09.15.37.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Jun 2024 15:37:05 -0700 (PDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=jporterbugs@gmail.com; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:319943 Archived-At: On 6/9/2024 1:07 PM, Jim Porter wrote: > On 6/9/2024 12:15 PM, Eli Zaretskii wrote: >> Curiously, there is already eshell-quote-argument, but it doesn't >> produce the same effect as shell-quote-argument with 2nd arg non-nil, >> which is why in esh-proc-tests.el I couldn't use >> eshell-quote-argument.  Any idea why eshell-quote-argument is >> different? > > Hmm, I'm not immediately sure, although I have a feeling that's a bug. > In particular, 'eshell-quote-argument' doesn't quote parens, which seems > like a problem since that's how you write Lisp forms in Eshell. Surely > we'd want to quote those. I'll take a look though, and see if I can fix > things so we can use 'eshell-quote-argument' in the tests at the right > spots. Ah, I figured it out. 'eshell-quote-argument' only produces accurate results when called from inside an Eshell buffer. It also had a bug where quoting newlines didn't work properly. I've fixed the latter issue and documented/worked-around the former, and then updated the tests where appropriate. There are just two changes you made that I'm not quite sure what to do about. When you get the chance, could you apply the following patch and report back the test failures you get? -------------------------------------------------- diff --git a/test/lisp/eshell/esh-proc-tests.el b/test/lisp/eshell/esh-proc-tests.el index 90bbb4fa14e..6dca1f7ec1c 100644 --- a/test/lisp/eshell/esh-proc-tests.el +++ b/test/lisp/eshell/esh-proc-tests.el @@ -289,7 +289,7 @@ esh-proc-test/kill-pipeline (eshell-wait-for-subprocess t) (should (string-match-p ;; "interrupt\n" is for MS-Windows. - (rx (or "interrupt\n" "killed\n" "killed: 9\n" "")) + (rx (or "interrupt\n" "killed\n" "killed: 9\n")) (buffer-substring-no-properties output-start (eshell-end-of-output))))))) diff --git a/test/lisp/eshell/eshell-tests-helpers.el b/test/lisp/eshell/eshell-tests-helpers.el index acbe57a7283..bfd829c95e9 100644 --- a/test/lisp/eshell/eshell-tests-helpers.el +++ b/test/lisp/eshell/eshell-tests-helpers.el @@ -179,12 +179,7 @@ eshell-test-command-result (defun eshell-command-result--equal (_command actual expected) "Compare the ACTUAL result of a COMMAND with its EXPECTED value." - (or (equal actual expected) - ;; Compare case-isensitively on case-insensitive filesystems. - (and (memq system-type '(windows-nt ms-dos)) - (stringp actual) - (stringp expected) - (string-equal-ignore-case actual expected)))) + (equal actual expected)) (defun eshell-command-result--equal-explainer (command actual expected) "Explain the result of `eshell-command-result--equal'."