From unknown Sat Jun 14 19:39:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70409: 30.0.50; `latexenc-find-file-coding-system` uses `TeX-master` before we know it's safe Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Apr 2024 22:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70409 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 70409@debbugs.gnu.org Cc: monnier@iro.umontreal.ca X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: monnier@iro.umontreal.ca Received: via spool by submit@debbugs.gnu.org id=B.171322098828273 (code B ref -1); Mon, 15 Apr 2024 22:44:02 +0000 Received: (at submit) by debbugs.gnu.org; 15 Apr 2024 22:43:08 +0000 Received: from localhost ([127.0.0.1]:40070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwV2Y-0007Ll-EE for submit@debbugs.gnu.org; Mon, 15 Apr 2024 18:43:08 -0400 Received: from lists.gnu.org ([2001:470:142::17]:47044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwV2S-0007Ji-Kw for submit@debbugs.gnu.org; Mon, 15 Apr 2024 18:43:04 -0400 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 1rwV2B-0000jZ-9v for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 18:42:43 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rwV29-00085C-7O for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 18:42:42 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id F0F4380A6B; Mon, 15 Apr 2024 18:42:38 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1713220957; bh=szhegStluImvn2hWZqUUnpUnoK65J/z/30T9kFhcOLI=; h=From:To:Subject:Date:From; b=mmfUl9NMkvEdnTaNtkj2Jr+2EHuJTtY+QlMI3fg2Me95aXnrzrF4M4yRFhRIj83xf PoHYNDZgeeewsTrDNLy1J0yuY9ELSTniHWxFCsJvQ6xXRQviCuS1bpcFZa0omjuoxp qGqUVV/nKEW5veV6YiMWeCOu1o/c6ZbyY4wDJCdza0HAqJrr6iNN68KQl6aFlQ77Qh Pyx2EkmOo8n9IwMN1de70HeBlFtNQWsi1GiAgdkqQFPYOpxG5TPEIPp20+NoCirIvq p946vM7J+9Fkk1+zB2jVpPyEpug0JzCK2b4E270je6qBJiW92ovND9w3G3SJPSyZ0o kyDQYjuVo5JOQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C7F548004C; Mon, 15 Apr 2024 18:42:37 -0400 (EDT) Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A96851202D7; Mon, 15 Apr 2024 18:42:37 -0400 (EDT) From: Stefan Monnier Message-ID: Date: Mon, 15 Apr 2024 18:42:36 -0400 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.067 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Package: Emacs Version: 30.0.50 If I open a file `foo.tex` with a local variable setting of `TeX-master: "paper.tex"` and that `paper.tex` file has a local variable setting of `TeX-master: t`, I get the funny behavior that Emacs first asks me whether to obey the `TeX-master: t` setting of `paper.tex` before asking me whether to obey the `TeX-master: "paper.tex"` setting of `foo.tex`, even though it obviously had to use the `TeX-master: "paper.tex"` setting in order to decide to open the `paper.tex` file (and ask me about its `TeX-master: t`). The corresponding backtrace looks as below: Debugger entered--Lisp error: (minibuffer-quit) #() read-char-from-minibuffer("Please type y, n, ! or i, or C-v/M-v to scroll: " (33 105 121 110 32)) read-char-choice("Please type y, n, ! or i, or C-v/M-v to scroll: " (33 105 121 110 32)) hack-local-variables-confirm(((TeX-master . t)) ((TeX-master . t)) nil nil) hack-local-variables-filter(((TeX-master . t)) nil) hack-local-variables(no-mode) run-mode-hooks(latex-mode-hook) latex-mode() set-auto-mode-0(latex-mode nil) set-auto-mode() normal-mode(t) after-find-file(nil nil) find-file-noselect-1(# ".../paper.tex" t nil ".../paper.tex" (3064599 65026)) find-file-noselect("paper.tex" t) latexenc-find-file-coding-system((insert-file-contents ".../foo.tex" t nil nil nil)) insert-file-contents(".../foo.tex" t) find-file-noselect-1(# ".../foo.tex" nil nil ".../foo.tex" (3064581 65026)) find-file-noselect(".../foo.tex") command-line-1((".../foo.tex")) command-line() normal-top-level() showing that the problem is that `latexenc-find-file-coding-system` is the function that opens `paper.tex` before the users had a chance to confirm that they think this is safe. I suggest the patch below which makes `latexenc-find-file-coding-system` use `safe-local-variable-p` before using a file-local setting, and also adds corresponding `safe-local-variable` settings for `TeX-master` and `tex-main-file`. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=tex-master.diff diff --git a/lisp/international/latexenc.el b/lisp/international/latexenc.el index 6e2306449bc..66e3faa37b9 100644 --- a/lisp/international/latexenc.el +++ b/lisp/international/latexenc.el @@ -155,14 +155,16 @@ latexenc-find-file-coding-system (when (re-search-forward "^%+ *\\(TeX-master\\|tex-main-file\\): *\"\\(.+\\)\"" nil t) - (let ((file (match-string 2))) - (dolist (ext `("" ,(if (boundp 'TeX-default-extension) - (concat "." TeX-default-extension) - "") - ".tex" ".ltx" ".dtx" ".drv")) - (if (and (null latexenc-main-file) ;Stop at first. - (file-exists-p (concat file ext))) - (setq latexenc-main-file (concat file ext))))))) + (let ((var (match-string 1)) + (file (match-string 2))) + (when (safe-local-variable-p (intern var) file) + (dolist (ext `("" ,(if (boundp 'TeX-default-extension) + (concat "." TeX-default-extension) + "") + ".tex" ".ltx" ".dtx" ".drv")) + (if (and (null latexenc-main-file) ;Stop at first. + (file-exists-p (concat file ext))) + (setq latexenc-main-file (concat file ext)))))))) ;; try tex-modes tex-guess-main-file (when (and (not latexenc-dont-use-tex-guess-main-file-flag) (not latexenc-main-file)) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 02ee1242c72..e7b1522751f 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -89,6 +89,7 @@ tex-main-file if the variable is non-nil." :type '(choice (const :tag "None" nil) file) + :safe #'stringp :group 'tex-file) ;;;###autoload @@ -2213,6 +2214,10 @@ tex-guess-main-file header-re (+ (point) 10000) t)))) (throw 'found (expand-file-name buffer-file-name)))))))) +(unless (get 'TeX-master 'safe-local-variable) ;Don't override AUCTeX's setting. + (put 'TeX-master 'safe-local-variable + (lambda (x) (or (booleanp x) (stringp x))))) + (defun tex-main-file () "Return the relative name of the main file." (let* ((file (or tex-main-file --=-=-=-- From unknown Sat Jun 14 19:39:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70409: 30.0.50; `latexenc-find-file-coding-system` uses `TeX-master` before we know it's safe Resent-From: Arash Esbati Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Apr 2024 10:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70409 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 70409@debbugs.gnu.org Cc: monnier@iro.umontreal.ca X-Debbugs-Original-To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: 70409@debbugs.gnu.org, Stefan Monnier Received: via spool by submit@debbugs.gnu.org id=B.171326278923884 (code B ref -1); Tue, 16 Apr 2024 10:20:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Apr 2024 10:19:49 +0000 Received: from localhost ([127.0.0.1]:43013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwfum-0006D5-RV for submit@debbugs.gnu.org; Tue, 16 Apr 2024 06:19:49 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwfuj-0006Bk-5V for submit@debbugs.gnu.org; Tue, 16 Apr 2024 06:19:47 -0400 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 1rwfuQ-00048K-SF for bug-gnu-emacs@gnu.org; Tue, 16 Apr 2024 06:19:27 -0400 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 1rwfuP-0001Sv-MB; Tue, 16 Apr 2024 06:19:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=7m4sxYtsqXzmcn5GqQ8Yi2h3KraG6NM1jv9z+Ld+Q78=; b=npFdwRivdz2xNhuMGkQu BOmZvGdTWZGw0K42u1Puc8WbK6EcK2Q3/RutwzSmVAKvPP+qxgCIyC/1qX/B9r6Zf4+v+x/Nmhvbz qgXIhr6NwuAJOXnbzQGurO9pwkK9fgQgqLDGGlo+AOx29b1WqIN7ifLTEYqIhCshK2/U5/YUiOpFy wM0kIL+tJBFCEQS6U+dG3UZHVcY0ZbsLUbknjvC0fsgwSeHprld1PakiyzwIVodc5t+RmL1j6NQA0 77334auFGw25S3d/Dn2JjAvpOJCBSuRDK9OeVxYCygg5xfbC2o0pC/3ccLKLBaI13ayp/QO8ocoCL 01TZsPlST05GoQ==; From: Arash Esbati In-Reply-To: (Stefan Monnier via's message of "Mon, 15 Apr 2024 18:42:36 -0400") References: Date: Tue, 16 Apr 2024 12:19:21 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el > index 02ee1242c72..e7b1522751f 100644 > --- a/lisp/textmodes/tex-mode.el > +++ b/lisp/textmodes/tex-mode.el > @@ -89,6 +89,7 @@ tex-main-file > if the variable is non-nil." > :type '(choice (const :tag "None" nil) > file) > + :safe #'stringp > :group 'tex-file) > > ;;;###autoload > @@ -2213,6 +2214,10 @@ tex-guess-main-file > header-re (+ (point) 10000) t)))) > (throw 'found (expand-file-name buffer-file-name)))))))) > > +(unless (get 'TeX-master 'safe-local-variable) ;Don't override AUCTeX's setting. > + (put 'TeX-master 'safe-local-variable > + (lambda (x) (or (booleanp x) (stringp x))))) > + Is there a reason why leave out the values `dwim' and `shared'? tex.el defines `TeX-master' like this: (defcustom TeX-master t :safe (lambda (x) (or (stringp x) (member x (quote (t nil shared dwim)))))) Best, Arash From unknown Sat Jun 14 19:39:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70409: 30.0.50; `latexenc-find-file-coding-system` uses `TeX-master` before we know it's safe Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Apr 2024 11:50:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70409 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 70409@debbugs.gnu.org, monnier@iro.umontreal.ca Received: via spool by 70409-submit@debbugs.gnu.org id=B70409.17132681679634 (code B ref 70409); Tue, 16 Apr 2024 11:50:05 +0000 Received: (at 70409) by debbugs.gnu.org; 16 Apr 2024 11:49:27 +0000 Received: from localhost ([127.0.0.1]:43438 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwhJV-0002V6-Gn for submit@debbugs.gnu.org; Tue, 16 Apr 2024 07:49:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44152) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwhJT-0002Tp-3O for 70409@debbugs.gnu.org; Tue, 16 Apr 2024 07:49:24 -0400 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 1rwhJA-0002FR-UA; Tue, 16 Apr 2024 07:49:04 -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=n+PBZ9bai918Dt29TwVysA11hZle3hsr/Udq+5fgdzE=; b=B+J2jF5C3JyA Y+3dXV0M0tzYU3cL0yRoLlIUMZeioajNncXqeGfj5FJrHsxWAo/XOq2kdqhEiRYGblZFthVJHxs7A XWuA5wzwafW+eVinulExgOcm8Yic4l+yL/2s4vFx6WGuZpdK0r0A/ike1LozxytwkQPUE3UYCKjHt 8P2F7b4FUTmpf8P3ZaELHhdDln9MDJU4dRwST6Lb4533+6kf+3t9lNlRrCoA1XQne7Yl95A3/sOEO v4u9gXD5i4bVjZ5AvwSWlrVmAfh7ouen1mFBzK4UDVeOEysHyfmlVYTGSUtzp8XoRt3MPOFMAZ2ae WCH76AfCZW1UY1Japb/bpg==; Date: Tue, 16 Apr 2024 14:49:02 +0300 Message-Id: <86jzkxjzo1.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (bug-gnu-emacs@gnu.org) References: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: monnier@iro.umontreal.ca > Date: Mon, 15 Apr 2024 18:42:36 -0400 > From: Stefan Monnier via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > If I open a file `foo.tex` with a local variable setting of > `TeX-master: "paper.tex"` and that `paper.tex` file has a local > variable setting of `TeX-master: t`, I get the funny behavior that > Emacs first asks me whether to obey the `TeX-master: t` setting of > `paper.tex` before asking me whether to obey the `TeX-master: > "paper.tex"` setting of `foo.tex`, even though it obviously had to use > the `TeX-master: "paper.tex"` setting in order to decide to open the > `paper.tex` file (and ask me about its `TeX-master: t`). > > The corresponding backtrace looks as below: > > Debugger entered--Lisp error: (minibuffer-quit) > #() > read-char-from-minibuffer("Please type y, n, ! or i, or C-v/M-v to scroll: " (33 105 121 110 32)) > read-char-choice("Please type y, n, ! or i, or C-v/M-v to scroll: " (33 105 121 110 32)) > hack-local-variables-confirm(((TeX-master . t)) ((TeX-master . t)) nil nil) > hack-local-variables-filter(((TeX-master . t)) nil) > hack-local-variables(no-mode) > run-mode-hooks(latex-mode-hook) > latex-mode() > set-auto-mode-0(latex-mode nil) > set-auto-mode() > normal-mode(t) > after-find-file(nil nil) > find-file-noselect-1(# ".../paper.tex" t nil ".../paper.tex" (3064599 65026)) > find-file-noselect("paper.tex" t) > latexenc-find-file-coding-system((insert-file-contents ".../foo.tex" t nil nil nil)) > insert-file-contents(".../foo.tex" t) > find-file-noselect-1(# ".../foo.tex" nil nil ".../foo.tex" (3064581 65026)) > find-file-noselect(".../foo.tex") > command-line-1((".../foo.tex")) > command-line() > normal-top-level() > > showing that the problem is that `latexenc-find-file-coding-system` > is the function that opens `paper.tex` before the users had a chance to > confirm that they think this is safe. Is it correct for latexenc-find-file-coding-system to use find-file-noselect for this purpose? Why does it call insert-file-contents with 2nd arg non-nil, if all it needs is to find and process the encoding spec there? Alternatively, we could disable local-variable processing when calling latexenc-find-file-coding-system. WDYT? > I suggest the patch below which makes `latexenc-find-file-coding-system` > use `safe-local-variable-p` before using a file-local setting, and also > adds corresponding `safe-local-variable` settings for `TeX-master` and > `tex-main-file`. Is it really guaranteed that safe local variables will never cause similar problems? That they are safe doesn't mean they must be processed at this point. From unknown Sat Jun 14 19:39:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70409: 30.0.50; `latexenc-find-file-coding-system` uses `TeX-master` before we know it's safe Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Apr 2024 12:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70409 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 70409@debbugs.gnu.org Received: via spool by 70409-submit@debbugs.gnu.org id=B70409.17132720166610 (code B ref 70409); Tue, 16 Apr 2024 12:54:02 +0000 Received: (at 70409) by debbugs.gnu.org; 16 Apr 2024 12:53:36 +0000 Received: from localhost ([127.0.0.1]:43739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwiJc-0001iY-Gw for submit@debbugs.gnu.org; Tue, 16 Apr 2024 08:53:36 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:11853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwiJa-0001hg-IG for 70409@debbugs.gnu.org; Tue, 16 Apr 2024 08:53:35 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id A73894418A8; Tue, 16 Apr 2024 08:53:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1713271995; bh=oYC7tuwUuwWZXKCqjUPca5UnhJXu1Wm1CJNGUVOwVxc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=bbFhdzCFBNrGnHy90QcJl8xWHFinLifEn7HABkKU6WcNem8/QV9SF+hVJN3R1KeV0 5woU1+tqsPWT+1tIFWN+hk7Z5o4quDOmGd0xwdFGwVSvI/PiW7oCpS+ciU/6n4SzNV MaYTyo3DY2XK475O74kFZKdK//7KMUAj7JEerWZaMd/6JMpHi++vLe+4wIdf1gSKbc uduycvRTDdPlW7y6EplwJvcsedTSPtA+I+FJFG61clmRxqvCz9PNkrPS54aNWAfb1q lU/RYefLHL4oTXJj2a8tzJxRdxIPdvevBWxz7kCoYfr0uOR1dBZhpIRWdTqMcQtF7l CtNmZr6AmilgQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5ECA344188D; Tue, 16 Apr 2024 08:53:15 -0400 (EDT) Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3CD9A12039E; Tue, 16 Apr 2024 08:53:15 -0400 (EDT) From: Stefan Monnier In-Reply-To: <86jzkxjzo1.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 16 Apr 2024 14:49:02 +0300") Message-ID: References: <86jzkxjzo1.fsf@gnu.org> Date: Tue, 16 Apr 2024 08:53:13 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.002 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Is it correct for latexenc-find-file-coding-system to use > find-file-noselect for this purpose? That's another question. My question is instead whether it's safe for `latexenc-find-file-coding-system` to use the `TeX-master` setting in foo.tex`. I can imagine cases where that setting could be dangerous because it tricks the users into accessing a file they shouldn't access. > Is it really guaranteed that safe local variables will never cause > similar problems? No, but at least it gives the users a standard way to control whether to consider it safe or not. Stefan From unknown Sat Jun 14 19:39:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70409: 30.0.50; `latexenc-find-file-coding-system` uses `TeX-master` before we know it's safe Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Apr 2024 12:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70409 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Arash Esbati Cc: 70409@debbugs.gnu.org X-Debbugs-Original-Cc: "Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors" , 70409@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17132721017512 (code B ref -1); Tue, 16 Apr 2024 12:55:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Apr 2024 12:55:01 +0000 Received: from localhost ([127.0.0.1]:43759 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwiKz-0001wu-2M for submit@debbugs.gnu.org; Tue, 16 Apr 2024 08:55:01 -0400 Received: from lists.gnu.org ([2001:470:142::17]:41932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwiKv-0001vJ-Rl for submit@debbugs.gnu.org; Tue, 16 Apr 2024 08:54:58 -0400 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 1rwiKc-0006BR-L7 for bug-gnu-emacs@gnu.org; Tue, 16 Apr 2024 08:54:38 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rwiKb-0005sJ-6b; Tue, 16 Apr 2024 08:54:38 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D9F884418B5; Tue, 16 Apr 2024 08:54:34 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1713272073; bh=x/QQpTl8H1XNKoKIB/9r7+De1uq0xTJbSqdygUqtRQs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=lS5TFk6YayplsLRfGt1OpipF5cXbusw8wBMV27zIPxO1oc4Ns4jK4h+SABCNMRrGP 64S8RVxtt+BfJ7uDiApnYpGPW4YFEFbLQKytQF4uNYDpEBcfxt4vl2JmN0HmiiN71L g/grt81h/8o4q9KrIXezGUZe2vCWKJ45gAZSnjXGFFatdLjPMckPC2a20MJVpGeQM4 8wadpgTYeEdkP/zfA4H8fHq7THOD4tpQaFZWRw8zlR9coConFSwTq4tHDadQhuoZQB IOtDRXyeHz1bM1UXG9g1r5M60jsutOnD/5VSya9iUF2AL18GcC8/nCRe3hf5aneQ1R pTyNp/5eYquMg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B35BA44187C; Tue, 16 Apr 2024 08:54:33 -0400 (EDT) Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 52AE81202AB; Tue, 16 Apr 2024 08:54:33 -0400 (EDT) From: Stefan Monnier In-Reply-To: (Arash Esbati's message of "Tue, 16 Apr 2024 12:19:21 +0200") Message-ID: References: Date: Tue, 16 Apr 2024 08:54:32 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.002 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > Is there a reason why leave out the values `dwim' and `shared'? Because `tex-mode.el` doesn't use/support those values. Not a strong reason, admittedly. Stefan From unknown Sat Jun 14 19:39:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70409: 30.0.50; `latexenc-find-file-coding-system` uses `TeX-master` before we know it's safe Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Apr 2024 13:37:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70409 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 70409@debbugs.gnu.org Received: via spool by 70409-submit@debbugs.gnu.org id=B70409.171327458227231 (code B ref 70409); Tue, 16 Apr 2024 13:37:05 +0000 Received: (at 70409) by debbugs.gnu.org; 16 Apr 2024 13:36:22 +0000 Received: from localhost ([127.0.0.1]:43999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwiyx-00074l-Gr for submit@debbugs.gnu.org; Tue, 16 Apr 2024 09:36:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwiyr-000742-QO for 70409@debbugs.gnu.org; Tue, 16 Apr 2024 09:36:17 -0400 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 1rwiya-0006kl-1P; Tue, 16 Apr 2024 09:35:56 -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=psnzVSN6V2fBn3I0As3QaQDbYVcvAM80mNzrh+8MQdo=; b=mcm5PbnGU8nc pUgatlP1TJ9Zz8mJBfNUUyJKS39SM/ZUr9NCBgBc7I5aCqVkiBcLiGWLX5pGcSYsWpnukqtfN/4wP hzHPRJHf9ei13wIqFkVAZdv7RMfPX8faCFCeOD+2S6UBOD7fx5mM1DqUlau7s40QUz5PkJdJ6fUIF VNrEniycHBs0+nr8JEOUvnvN0CYl7GGxITpgkEu6kJPD7ptogxtjsKf2y8oBXWlcCh6O7Wbq2Uh6W 7npInbe8DXFEJurM+8efsYVjURTqC3bgyVuQKGJrxbxJ+gCLjjnIl1iQDAAUPFaR46eDQouq0xpyv too0V9B4uO9PLtBNo9vCAQ==; Date: Tue, 16 Apr 2024 16:35:53 +0300 Message-Id: <86zfttig5i.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Stefan Monnier on Tue, 16 Apr 2024 08:53:13 -0400) References: <86jzkxjzo1.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: 70409@debbugs.gnu.org > Date: Tue, 16 Apr 2024 08:53:13 -0400 > > > Is it correct for latexenc-find-file-coding-system to use > > find-file-noselect for this purpose? > > That's another question. My question is instead whether it's safe for > `latexenc-find-file-coding-system` to use the `TeX-master` setting in > foo.tex`. I can imagine cases where that setting could be dangerous > because it tricks the users into accessing a file they shouldn't access. But wouldn't processing the file in a "more literal" manner solve that problem as well? We only process file-local variables when we turn on the proper major mode, so avoiding to turn on a mode will also solve the problem you have, including unsafe variables. And finding the telltale signature of the file's encoding doesn't need any major mode's help, does it? From unknown Sat Jun 14 19:39:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70409: 30.0.50; `latexenc-find-file-coding-system` uses `TeX-master` before we know it's safe Resent-From: Arash Esbati Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Apr 2024 20:47:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70409 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 70409@debbugs.gnu.org X-Debbugs-Original-Cc: "Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors" , 70409@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171330039921716 (code B ref -1); Tue, 16 Apr 2024 20:47:03 +0000 Received: (at submit) by debbugs.gnu.org; 16 Apr 2024 20:46:39 +0000 Received: from localhost ([127.0.0.1]:45208 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwphN-0005dz-MB for submit@debbugs.gnu.org; Tue, 16 Apr 2024 16:46:39 -0400 Received: from lists.gnu.org ([2001:470:142::17]:57782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwphD-0005bX-V8 for submit@debbugs.gnu.org; Tue, 16 Apr 2024 16:46:31 -0400 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 1rwpgv-0004CB-PJ for bug-gnu-emacs@gnu.org; Tue, 16 Apr 2024 16:46:09 -0400 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 1rwpgu-0008IZ-Px; Tue, 16 Apr 2024 16:46:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=Bt/sYhgQFdIU2SUP/cEB4hwOHvsya1auMVdMqUPoNaw=; b=dNxpreNYAFZnx5QrNlpg JzsKkxalYnfpDpP7okbgAthIuq5k33pnFoizfQPlsgkbaMxkq0RfVmZkgduURMvU0P5OhGK/RlNbR qi06lQzyV/0brUPHlUsHE0A5iGkqhoAJuOdunkTBX2lrl8qZkUQU0NVi5IrjQiGPVBDXTCqKTDxD6 PfH3Yla7Tx17dkRVz5uQ+Hbnef7EFtQjcnGFpBK5rt2hflM3ML8SxECu9lNchbNeAbZt++gEhsuei 9ufcAw04BfYNEcKqJhUv1Oh4drFnNaSnhi3DvRI+B/60KtWlWkCgE21hilUqSdlyph5SNbp9qAuMB 6BKvK1YqC9Qnnw==; From: Arash Esbati In-Reply-To: (Stefan Monnier's message of "Tue, 16 Apr 2024 08:54:32 -0400") References: Date: Tue, 16 Apr 2024 22:46:05 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier writes: > Because `tex-mode.el` doesn't use/support those values. > Not a strong reason, admittedly. Thanks, then it's not necessary to cater for them, I think. Best, Arash From unknown Sat Jun 14 19:39:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#70409: 30.0.50; `latexenc-find-file-coding-system` uses `TeX-master` before we know it's safe Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Apr 2024 17:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70409 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 70409@debbugs.gnu.org Received: via spool by 70409-submit@debbugs.gnu.org id=B70409.171337656122156 (code B ref 70409); Wed, 17 Apr 2024 17:56:02 +0000 Received: (at 70409) by debbugs.gnu.org; 17 Apr 2024 17:56:01 +0000 Received: from localhost ([127.0.0.1]:47214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rx9Vn-0005l5-8P for submit@debbugs.gnu.org; Wed, 17 Apr 2024 13:56:00 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rx9Vj-0005ja-GW for 70409@debbugs.gnu.org; Wed, 17 Apr 2024 13:55:56 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E8E0D4415D4; Wed, 17 Apr 2024 13:55:36 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1713376535; bh=qHPNAZSgngkyuY1OOLetqnmYj8t5KTltlkX3g3qMG4o=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=AVTWGTBT7C5PZlbEGEutmVj0He6445q0a9rEegYv+sjGH5h5BAGFGK/vEysQELNoD vV9sOaq5zBjoGNNEl7JOo43y3910y/SRAv9W93Jpc4beUVV4Vn7ZolmspRq2ZYC36j AHvliuTFUEzxqLYIMdSpi01BaBVMxQ8mKdwrwmvmYMdnYo81kbv4Br3u+7e1fiHzJv KoLWCYAojj3JQ1O3gZ28Y8NqR8wkL9dRFp1J4hjLqa83fTqgui2l1foKX0csgQRknU bHLrX+Up4RoneWid8hFvBjSiq9OXZIoUWHbL0oELz3rIOVnQ5i+HqWUllvpp7/4t4u IZmd7PhloVF0A== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id AA46D4417AA; Wed, 17 Apr 2024 13:55:35 -0400 (EDT) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9DB94120618; Wed, 17 Apr 2024 13:55:35 -0400 (EDT) From: Stefan Monnier In-Reply-To: <86zfttig5i.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 16 Apr 2024 16:35:53 +0300") Message-ID: References: <86jzkxjzo1.fsf@gnu.org> <86zfttig5i.fsf@gnu.org> Date: Wed, 17 Apr 2024 13:52:49 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.089 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> > Is it correct for latexenc-find-file-coding-system to use >> > find-file-noselect for this purpose? >> That's another question. My question is instead whether it's safe for >> `latexenc-find-file-coding-system` to use the `TeX-master` setting in >> foo.tex`. I can imagine cases where that setting could be dangerous >> because it tricks the users into accessing a file they shouldn't access. > But wouldn't processing the file in a "more literal" manner solve that > problem as well? Could be. I'm just uncomfortable with the idea that we make use of the `TeX-master: "paper.tex"` local-variable setting before we even bother to check whether it obeys the usual `safe-local-variable-p` checks (and even if `enable-local-variables` is nil, AFAICT). Stefan