From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id SC5BOaS+3GU1mgAAe85BDQ:P1 (envelope-from ) for ; Mon, 26 Feb 2024 17:39:01 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id SC5BOaS+3GU1mgAAe85BDQ (envelope-from ) for ; Mon, 26 Feb 2024 17:39:01 +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=NwP1HFU8; 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=1708965540; 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=I9cu8eg3+MXyAodJS3hthQOymwR4FgwUyRajLdT8lZU=; b=DK6LdpEl++RgeeAPsWnrcAhsWTYchkudz+ocrsdNd/kCtK4kkL3ooTNFVPFtfkFc2adpL0 NODeP6GRVORNY9bLjFMCVeM/bVGRIllDa0KoSFi8+CRv0kQ8Z8M4puEIVi7x5CgldAvoKF f6crNkj8k+dyKbXrClN1sLHNJeuOLGCcYygp9fj5b68f++tey6+hqo0vNmkZyqvp/UalJ/ ka0n1eJzRKOtEvsxEtuFZhIIhefw4+EOKhLMkXSopeojS8lLsKoE22VAtbU9EVyuSwE+LJ 6txYyj1Pcwsd0tNCEJWHr58UJ7ehY8OTKqzvd849WzDSB/uo9n3NWm25Wd8GvA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=NwP1HFU8; 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=1708965540; a=rsa-sha256; cv=none; b=dLdGLFF8rMCqp0FcWWEkLJToiLRm9iGOmR/UNbyekm1M/9mlbaf1dm/tpKX7+Ba4LBjRki PV8Ld0546UxwT/Di3RrkA3nZEiksP5WQBs6nZNeeFgmj+2LH5dGlpiO13z/ngNqgZs9gtT OERK3j7SoLAzZWS5UA4c7XH3+kWiKi+mp4UoU43k6Cm+DEwDXRFtab7ad9J/rWSYYLJatr dJhEdr1dqwQdLpaCrGRnIDzR+cAyNFzSzAWWXGLprTrXaKJRcgzr/Yw2zwo5IC7gwzON6T hrq2eXxzKGGDUS2MuiJ5WXGz1NDdH+EUNN9dtiBIFfoxylVUPWTg3xnRG4ffeg== 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 9FD2E7542D for ; Mon, 26 Feb 2024 17:39:00 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1redzF-0004Ge-PG; Mon, 26 Feb 2024 11:37:53 -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 1redzA-0004Fk-AK for emacs-orgmode@gnu.org; Mon, 26 Feb 2024 11:37:49 -0500 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1redz8-0004C0-O9 for emacs-orgmode@gnu.org; Mon, 26 Feb 2024 11:37:48 -0500 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-512f7332252so2224679e87.0 for ; Mon, 26 Feb 2024 08:37:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708965464; x=1709570264; 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=I9cu8eg3+MXyAodJS3hthQOymwR4FgwUyRajLdT8lZU=; b=NwP1HFU8+KuybxQ8+BK9QF+FcSEX52saWJBkIxrtwvJa9BxDqqZX70TSZaWkW+Ndzj 2Bj6fGNmj9S8kTv4me1uXsc6vlhavMvYCrQ5UWdknYNjS9l6hSAB33FpFuibp1slEg3O D+U7Xn9z0OXZUO0bxtccSJqft+knE/r10Tvan/PsJjlKVO0BLjJUj4xBk3xQi9r4PUt/ GIARGjDqoVNwhJ0vWwr46YrrE4MpzdLG8oJ4C0Nn719YoMDkfCXM0GZNdih13RhHjSfk xpn+oLDdQwwnWMmi27OtqHrbXZrp3Y0T6+cGbRYYehNypTXGKiRgeVyefEmwKNvwTGRc NQBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708965464; x=1709570264; 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=I9cu8eg3+MXyAodJS3hthQOymwR4FgwUyRajLdT8lZU=; b=q/88mk7SzQYmFVP4X6DFyIcTPCSwyeTI+4kMkviRmj1jr33JaK/p1unLaGJoA5uemx yOJz2a+iqw4+eY4CSDFB3A+MMQJmbkowV9S2ssTnB2EdX6iBQMVBmy0eLZAiRiJxWjGe pBiChvKtREEVNl1m+YXJSEqp2w/C7kgf4DKm81+M/L6cUDdYP8xgU3Th7O1RuHGU5Ek0 7fvuE9t+0wEBnKmagbjxowGdRci4UyI8JktdHidxd/5ciV+Vpc3qCT/dTWq8Pl+tvz0F LwVxtNpL5sc9Bvrn9ImAnEABsFXDem3uZnirljh9YBym5ieFWgL39jf7ynTk3g8Kdm+/ yY7A== X-Gm-Message-State: AOJu0Yy5cJe486t+QxAJWQeHqb1FgO4NYLKlxJUBz2e3pXdsSg7wmiG3 +7zFcykjmLalxMPi1Vrax7AJECurLETtdE5El9GFDUmQLkY3Gj94T65xIh2e X-Google-Smtp-Source: AGHT+IG23SIlgW5wFPjrEEqEKLqsTcUdq/ub1rtSaHaScc58FCt+e5IPMmLwfxLk0KMxcsN7Wn+N2A== X-Received: by 2002:a05:6512:1291:b0:512:b36b:b8db with SMTP id u17-20020a056512129100b00512b36bb8dbmr5339047lfs.65.1708965463839; Mon, 26 Feb 2024 08:37:43 -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 a3-20020a056512374300b00512fb973e21sm539267lfs.294.2024.02.26.08.37.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Feb 2024 08:37:43 -0800 (PST) Message-ID: <735645dd-1ddf-4579-a6dd-2700f3e83c94@gmail.com> Date: Mon, 26 Feb 2024 23:37:42 +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> <6e49c590-ad27-4fb0-b1f2-6a89c60a0b58@gmail.com> <87msrncxhq.fsf@localhost> From: Max Nikulin Mail-Followup-To: emacs-orgmode@gnu.org, =?UTF-8?Q?Martin_Edstr=C3=B6m?= In-Reply-To: <87msrncxhq.fsf@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=manikulin@gmail.com; helo=mail-lf1-x129.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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.86 X-Spam-Score: -3.86 X-Migadu-Queue-Id: 9FD2E7542D X-Migadu-Scanner: mx11.migadu.com X-TUID: dUTzL8oxd3RI On 26/02/2024 17:48, Ihor Radchenko wrote: > Max Nikulin writes: >> 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'. > > I agree that it will be more reliable to shell-escape argument. > However, I am concerned that escaping may break certain uses like > > somecommand << EOF > %i > EOF > > In the above scenario, escaping will break things. It is unsafe to use such command. Variable expansion, etc. is performed inside here document blocks. Try cat << EOF \[f(i), \text{where $i \ne 10$}\] EOF That is why I proposed to use stdin in the case of missed %i. `org-latex-to-html-convert-command' should be set to something like "latexmlc --profile=math --preload=siunitx.sty - 2>/dev/null" this case. > That's why I prefer to add a new replacement, not change the meaning of > %i. We might even remove %i from the docstring, keeping support in the > code for backwards-compatibility. What you calls backward compatibility is actually a means to get strange results in the case of complex math. It is better to force users to update configuration (I hope, it actually will not be necessary) and to ensure safe command without pitfalls related to missed parts of equations. > (with-temp-file "/tmp/test2.html" > (let ((org-latex-to-html-convert-command > "latexmlc literal:%I --profile=math --preload=siunitx.sty 2>/dev/null")) > (insert (org-format-latex-as-html "$f' = df/dx$")))) > > test2.html is rendered *incorrectly* as in the attached screenshot. Looks like missed inside > In contrast, manually providing output file as > > latexmlc literal:\$f\'\ =\ df/dx\$ --profile=math --preload=siunitx.sty --output /tmp/test3.html > > yields correct rendering. Perhaps this time the browser just guessed file encoding. Anyway rendering is incorrect. Gecko puts derivative into the correct place. I have no idea if it is a fault of latexml generating incorrect MathML or a browser which is likely a KHTML descendant. It seems, latexml is terribly broken in Debian. With --preload=siunitx.sty it hangs during processing of expl3-code.tex, without this option it removes all files in /tmp. I am still strongly against code that may cause execution of equations as shell commands and may silently lose parts of equations.