From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id AHunAIMZ22WZ/AAA62LTzQ:P1 (envelope-from ) for ; Sun, 25 Feb 2024 11:42:11 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id AHunAIMZ22WZ/AAA62LTzQ (envelope-from ) for ; Sun, 25 Feb 2024 11:42:11 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=G7IYaEnM; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708857730; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=bdrmbc7Pt7vJ+UwFiczjOSWBqTFwJaykeyCS/sPi/mY=; b=j2vn5LKSrJkyerUBOjssKIpah20minF4Xlt64wNS7TOURxDYSTUIEqIncZKAceTbCILq76 pGLNFS2nUloC/or1uh297ePk9k+Jtn7izH9pdFn78y7zNMfsNqxmcDWWzf4adGXXpMpRe1 jk/R1mx6qTlRekzjvSbdIT1bVoj3pjIMR5W8bbG9+fNSDNqPwRvrG5+iOrdqfQW3wH5BvV qiWBP+aNnpoZ7H6hqymee0ZvSPpw5xXC+Naf38HQWUBoACXXX9ZmIBTIlkaxL1y534/SEQ aymSvv2gn5VmjL1V4kmqrJnLqsL0rgEvxKoTgH+keyEiA1qW/RF9rsD/60XHjg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=G7IYaEnM; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708857730; a=rsa-sha256; cv=none; b=Ss0f94y5j/17HmDIXxIbosQuKCzfGpaHdy1iUlc8/NmmCNvOaPJdR8F6rclon9cmePr0vu 0+dTZYw7fdoP+lrXKXXmHmHnpRBJvPE0ap33zgqy3ivV8WPFC+j4pMAY0282f15o/2kIgI Eb6ANiQ9zrh+phya9ZtyhEIW3/4+blnGQDhKcCeiUsyBLDIrBgvJVTfenLUzTm/yZ7CQrX f0ZGS6IifE4dByfReelLRSyagroTooN2wKHejb+dNHSJwhctWaZC3QuP2Qp2wA30c+41nf E1Pju8LpQa1b2/o/RyVcz5TqiLAbbFL4c3K8MQmTbKKInnFKY7aNJ1ABzD0N3Q== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C6AC1A1EF for ; Sun, 25 Feb 2024 11:42:10 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reBx9-0005gT-FJ; Sun, 25 Feb 2024 05:41:51 -0500 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 1reBx7-0005g7-VD for emacs-orgmode@gnu.org; Sun, 25 Feb 2024 05:41:49 -0500 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1reBx6-0007BC-7Y for emacs-orgmode@gnu.org; Sun, 25 Feb 2024 05:41:49 -0500 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2d21a68dd3bso29608051fa.1 for ; Sun, 25 Feb 2024 02:41:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708857705; x=1709462505; darn=gnu.org; h=content-transfer-encoding:in-reply-to:mail-followup-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=bdrmbc7Pt7vJ+UwFiczjOSWBqTFwJaykeyCS/sPi/mY=; b=G7IYaEnMvMI3E6SSs+z20UABkVL9s22xdADKhnQEzIOF0kGdCEDUppRqYjO41dE7wS TBwb/14L3N4nuH48j0o7+kvFFPrzUecjOC7Rxrec6IGBLAYTRBl5Zg6SJyE7JlQjTRTE zBE33ybP/cr71eDLaevq+5RPYKPSDanZMBDPyWIS6TQg5iC/QXHXByiTYjWQ9Klja43t 7uJZvbUYd7HshLf9EjXgO2ciL/KaOrxspcZuPwurM0Yuis4Z1le0CSQGwxqOVIfIv1Pd 1j1F+sjQKUamcZfpyfkxwgLKp+DItVQuhzmjM/pJLHid9ELEeevY84vv1tZgXjoKukvh JEUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708857705; x=1709462505; h=content-transfer-encoding:in-reply-to:mail-followup-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bdrmbc7Pt7vJ+UwFiczjOSWBqTFwJaykeyCS/sPi/mY=; b=PNMezA46U561pXM+TSd2AUt64jcc1N9anbtlS9YhiFQOO2ToEK956xKxndRQEF+eTH MitkjfTTInfY5+mOzIQq+n5wMPFSXoV+ALNqoSgN4hiWwZjwnWMUEx84uby1LBLRCgz/ WI5gefpq+/lK1aGWXacgBoxEGrp1hlwVJHDavBOfNHxeBh/2d6LZhZcXiNLNpPjiqVOh EN34TKiRiiWouXRIRlRy+UM1AJw2aomLqszsW2OJCzv/C9g6fVMCgCyFLy9WpL3Qb409 jgQQ+tecOfNIlS5L8ckCxwD/XISyF8IobxbEP0M0LjeEFkZJv35+TONmcyEBlWDJMexj TBqw== X-Gm-Message-State: AOJu0YwkDYZuoldF8vVtFfwd8sGXIVd7EMOyVavno4XBFnXAjs2pf/EO q0aytRyt4FfyE13y/MnUScoEKiITyXqvzNSTUIZv9oHl12U0WsHUIa/BZeBz X-Google-Smtp-Source: AGHT+IEBeFxlweLBN1oHd0ZMchcINQfweMr3Vn2kCKkRJ5KXPsgyWGEB9qFWZbpLwpVbKQ0EbLAwhg== X-Received: by 2002:a2e:8058:0:b0:2d2:4450:998a with SMTP id p24-20020a2e8058000000b002d24450998amr2357870ljg.32.1708857705211; Sun, 25 Feb 2024 02:41:45 -0800 (PST) Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id e21-20020a2e9855000000b002d0b33c1571sm506391ljj.26.2024.02.25.02.41.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Feb 2024 02:41:44 -0800 (PST) Message-ID: <6e49c590-ad27-4fb0-b1f2-6a89c60a0b58@gmail.com> Date: Sun, 25 Feb 2024 17:41:43 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Warn about shell-expansion in the docstring of org-latex-to-html-convert-command Content-Language: en-US, ru-RU To: emacs-orgmode@gnu.org Cc: =?UTF-8?Q?Martin_Edstr=C3=B6m?= References: <87wmr1rc2w.fsf@localhost> <874jdzjqkk.fsf@localhost> From: Max Nikulin Mail-Followup-To: emacs-orgmode@gnu.org, =?UTF-8?Q?Martin_Edstr=C3=B6m?= In-Reply-To: <874jdzjqkk.fsf@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=manikulin@gmail.com; helo=mail-lj1-x22e.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -3.30 X-Spam-Score: -3.30 X-Migadu-Queue-Id: C6AC1A1EF X-TUID: 2lOoYYitZlq3 On 23/02/2024 19:46, Ihor Radchenko wrote: > Max Nikulin writes: > >> On 19/02/2024 02:36, Martin Edström wrote: >>> +Since this is a shell-command, remember to use single-quotes >>> +around \\='%i\\=', not double-quotes! Else a math fragment such >>> +as \"$y = 200$\" gets butchered into only \" = 200\"." >> >> I am afraid, the code, not the docstring must be fixed. I have not tried >> it, but I expect an issue with >> >> Test \(f' = df/dx\) >> >> So `shell-quote-argument' is necessary and quotes around %i must be >> stripped similar to %s in mailcap entries in `org-open-file'. > > That would be backwards-incompatible. > What about introducing %e replacement that will be shell-escaped? Ihor, it is just a bug and its manifestation depends on content of .org files more than on user configuration. Do you really want to allow part of equations be executed as shell commands for the sake of miracle backward compatibility? To minimize user annoyance my suggestion is to strip quotes in words like - '%i' - "%i" - 'something%i' - "something%i" - something='%i' - something="%i" before calling `format-spec' with `shell-quote-argument' result. Please, revert the commit that added a misleading recommendation. By the way, single quotes have no special meaning in cmd.exe on windows. Example of silent error resulting in incorrect equation: (let ((org-latex-to-html-convert-command "printf '%%s' '%i'")) (org-format-latex-as-html "$f'' = df/dx$")) "$f = df/dx$" Random parts of math becomes part of shell command: (let ((org-latex-to-html-convert-command "printf '%%s' '%i'")) (org-format-latex-as-html "$f' = df/dx$")) "/bin/bash: -c: line 1: unexpected EOF while looking for matching `'' " Something weird may be executed in the case of sufficiently complex equations. It should be more reliable to pass fragment to command stdin. It can be done if %i is missed in `org-latex-to-html-convert-command'.