X-Loop: help-debbugs@HIDDEN
Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter'
Resent-From: Augusto Stoffel <arstoffel@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 17 Apr 2024 18:24:04 +0000
Resent-Message-ID: <handler.70440.B.171337823912940 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 70440
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 70440 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.171337823912940
(code B ref -1); Wed, 17 Apr 2024 18:24:04 +0000
Received: (at submit) by debbugs.gnu.org; 17 Apr 2024 18:23:59 +0000
Received: from localhost ([127.0.0.1]:47371 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1rx9wr-0003MP-41
for submit <at> debbugs.gnu.org; Wed, 17 Apr 2024 14:23:58 -0400
Received: from lists.gnu.org ([2001:470:142::17]:53690)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <arstoffel@HIDDEN>) id 1rx9wo-0003LJ-OO
for submit <at> debbugs.gnu.org; Wed, 17 Apr 2024 14:23:56 -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 <arstoffel@HIDDEN>)
id 1rx9wW-0006Y9-Ba
for bug-gnu-emacs@HIDDEN; Wed, 17 Apr 2024 14:23:36 -0400
Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <arstoffel@HIDDEN>)
id 1rx9wU-00029k-Fx
for bug-gnu-emacs@HIDDEN; Wed, 17 Apr 2024 14:23:36 -0400
Received: by mail-ej1-x633.google.com with SMTP id
a640c23a62f3a-a5568bef315so29818466b.1
for <bug-gnu-emacs@HIDDEN>; Wed, 17 Apr 2024 11:23:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1713378212; x=1713983012; darn=gnu.org;
h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc
:subject:date:message-id:reply-to;
bh=9wPg521bRrBGo+8PDrIfBWcFqB6Cu0RWd5esso3cMg8=;
b=GMLTjkipjzs6wKIji4VbnfCfRUepo44n4tbSyFBgQGushDMX+5+HPI3rfs1UFBCYU+
DEnGmkesDO+8Jwphm2owztl5KHCMRF36G6fGBkfJB4Me+VSC63sgF2/W0VFnh/QSo80J
t9oygtZRw2+5QRgI5q1YTuNnZMVutDuMsPbKJkKev7VJpgVdKq/dGMvz1+OSwgs9k2bG
wzGUPv+Ieh0vsmxAyGS8v0bHBC1IXcgn+y5LF/7eJ+l7R+CiuK4iZ48YTcWp8qxgzJDo
g6heFFLn46X1F5fomoh2ckBT2AvYHrQmD2WFnmASJef/gplfUzLwXCZCbMy+0iG2m1k0
m5Ag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1713378212; x=1713983012;
h=mime-version:user-agent:message-id:date:subject:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=9wPg521bRrBGo+8PDrIfBWcFqB6Cu0RWd5esso3cMg8=;
b=dz5TlThs+5+PGXZt0S2Xvi7rLEkNP4wHYBA12+5+xagArEPZO14C6fnUcYLSPA8LUO
yMrNMWQIAE1P+YCUkKOgmuZYnPXn6lvz+RQ46pFlDeH1GzD71T1VSC8h2jdaPcssAw6O
YqWspNafQ4ei0IB1idPgYxyioUnAK5YMHQDIof9mbwurcEaFV+i58I5UZppOYUlLN5tD
rpdcY7CLdQ3cIgQC9yl1un6dtxCYJd8GI9hMIExobhKBQlUdPSUb7n8MZccd0PWG2Z5K
9tUOXLrDY5A9Xe3DRnv1viupLa6hFZ5JsGnYMWy5r+L7SLyNg02YG+xpqzxQ0YoZuhj6
ifUA==
X-Gm-Message-State: AOJu0YwT0Nh/lSCNSOodAEAqxYxDhhKwKTGtTRjNL9bucqHyZfcGjZDF
UZ2KigPBMePk0gztLM+ovoZRF/K20VtpMX0zMijzwA5KoCjUBy0d3nGp2g==
X-Google-Smtp-Source: AGHT+IGiV7S7bhMFJZAxFdhc4iAsrcgcSoNmSzN83SHaGwWHDdWsPNzO7xq/T5ADBPpPZhAzMyumVg==
X-Received: by 2002:a17:907:7256:b0:a55:622c:7e with SMTP id
ds22-20020a170907725600b00a55622c007emr1661365ejc.36.1713378212272;
Wed, 17 Apr 2024 11:23:32 -0700 (PDT)
Received: from ars3 ([2a02:8109:8a87:ff00::6223])
by smtp.gmail.com with ESMTPSA id
cx10-20020a170906c80a00b00a51b5282837sm8437472ejb.15.2024.04.17.11.23.31
for <bug-gnu-emacs@HIDDEN>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 17 Apr 2024 11:23:31 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
Date: Wed, 17 Apr 2024 20:23:30 +0200
Message-ID: <87h6fzj1b1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a00:1450:4864:20::633;
envelope-from=arstoffel@HIDDEN; helo=mail-ej1-x633.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 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
--=-=-=
Content-Type: text/plain
Tags: patch
The attachment should be self-explanatory, otherwise let me know.
--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
filename=0001-Use-P-switch-when-calling-python-interpreter.patch
From 04db8a3fbb29f497fdc728f4413aea162650b30b Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@HIDDEN>
Date: Wed, 17 Apr 2024 20:17:22 +0200
Subject: [PATCH] Use -P switch when calling 'python-interpreter'
This excludes the current directory from Python's module load path,
which can be unsafe.
* lisp/progmodes/python.el (python--list-imports): Use -P switch
(python--do-isort): Use -P switch
(python-fix-imports): Use -P switch
---
lisp/progmodes/python.el | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 85279d3e84b..180a8357aad 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -6805,7 +6805,7 @@ python--list-imports
(append
(split-string-shell-command
python-interpreter-args)
- `("-c" ,python--list-imports)
+ `("-Pc" ,python--list-imports)
(list (or name "")))))
(with-current-buffer buffer
(apply #'call-process
@@ -6814,7 +6814,7 @@ python--list-imports
(append
(split-string-shell-command
python-interpreter-args)
- `("-c" ,python--list-imports)
+ `("-Pc" ,python--list-imports)
(list (or name ""))
(mapcar #'file-local-name source))))))
lines)
@@ -6862,7 +6862,7 @@ python--do-isort
(append
(split-string-shell-command
python-interpreter-args)
- '("-m" "isort" "-")
+ '("-Pm" "isort" "-")
args)))
(tick (buffer-chars-modified-tick)))
(unless (eq 0 status)
@@ -6940,7 +6940,7 @@ python-fix-imports
(append
(split-string-shell-command
python-interpreter-args)
- '("-m" "pyflakes"))))
+ '("-Pm" "pyflakes"))))
(goto-char (point-min))
(when (looking-at-p ".* No module named pyflakes$")
(error "%s couldn't find pyflakes" python-interpreter))
--
2.44.0
--=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Augusto Stoffel <arstoffel@HIDDEN> Subject: bug#70440: Acknowledgement ([PATCH] Use -P switch when calling 'python-interpreter') Message-ID: <handler.70440.B.171337823912940.ack <at> debbugs.gnu.org> References: <87h6fzj1b1.fsf@HIDDEN> X-Gnu-PR-Message: ack 70440 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 70440 <at> debbugs.gnu.org Date: Wed, 17 Apr 2024 18:24:05 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 70440 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 70440: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D70440 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN
Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter'
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 17 Apr 2024 19:15:01 +0000
Resent-Message-ID: <handler.70440.B70440.17133812534116 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 70440
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Augusto Stoffel <arstoffel@HIDDEN>, kobarity <kobarity@HIDDEN>
Cc: 70440 <at> debbugs.gnu.org
Received: via spool by 70440-submit <at> debbugs.gnu.org id=B70440.17133812534116
(code B ref 70440); Wed, 17 Apr 2024 19:15:01 +0000
Received: (at 70440) by debbugs.gnu.org; 17 Apr 2024 19:14:13 +0000
Received: from localhost ([127.0.0.1]:47644 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1rxAjV-00014K-8W
for submit <at> debbugs.gnu.org; Wed, 17 Apr 2024 15:14:13 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49958)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <eliz@HIDDEN>) id 1rxAjT-00013w-8Q
for 70440 <at> debbugs.gnu.org; Wed, 17 Apr 2024 15:14:11 -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 <eliz@HIDDEN>)
id 1rxAjA-00049d-RO; Wed, 17 Apr 2024 15:13:52 -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=utEHf2Ajv1+ezhmTXjxjEix8qHx0/C5SqwOLAGocPkg=; b=XHDyvaZlr/64
BTWPuCV203Rc1KTaOwbH+4pHwWu7H3VorKzvETg4tjgn3pQ25TqOxJPngbhfiGj12pzz7+j/yTr91
6+nLmuK9Az+8K/O4/anAIUKPq+z3loGsV7wdx47ckm9ZeI52EV0jRS4rbr/eNf6TCwSLqBRUFiZcF
C2hpopVLUuh2MV+Z5zBggTYaRevyd7LCRvp9qvxQWaGD8oYs49jlXpelSnltbPYjasoMBgNyULwj/
EFKZpkkXcLrS77XrRZ7xhOHdAYrFfJodbJXCx2KMNQgHxFhXDVZI1b+dVHYdhFr4DbykpPW2yrfxA
9YxC8L28Jsl9DWqUbcXAAg==;
Date: Wed, 17 Apr 2024 22:13:49 +0300
Message-Id: <861q73hkeq.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87h6fzj1b1.fsf@HIDDEN> (message from Augusto Stoffel on Wed,
17 Apr 2024 20:23:30 +0200)
References: <87h6fzj1b1.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
> From: Augusto Stoffel <arstoffel@HIDDEN>
> Date: Wed, 17 Apr 2024 20:23:30 +0200
>
> The attachment should be self-explanatory, otherwise let me know.
>
>
> >From 04db8a3fbb29f497fdc728f4413aea162650b30b Mon Sep 17 00:00:00 2001
> From: Augusto Stoffel <arstoffel@HIDDEN>
> Date: Wed, 17 Apr 2024 20:17:22 +0200
> Subject: [PATCH] Use -P switch when calling 'python-interpreter'
>
> This excludes the current directory from Python's module load path,
> which can be unsafe.
>
> * lisp/progmodes/python.el (python--list-imports): Use -P switch
> (python--do-isort): Use -P switch
> (python-fix-imports): Use -P switch
> ---
> lisp/progmodes/python.el | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
> index 85279d3e84b..180a8357aad 100644
> --- a/lisp/progmodes/python.el
> +++ b/lisp/progmodes/python.el
> @@ -6805,7 +6805,7 @@ python--list-imports
> (append
> (split-string-shell-command
> python-interpreter-args)
> - `("-c" ,python--list-imports)
> + `("-Pc" ,python--list-imports)
> (list (or name "")))))
> (with-current-buffer buffer
> (apply #'call-process
> @@ -6814,7 +6814,7 @@ python--list-imports
> (append
> (split-string-shell-command
> python-interpreter-args)
> - `("-c" ,python--list-imports)
> + `("-Pc" ,python--list-imports)
> (list (or name ""))
> (mapcar #'file-local-name source))))))
> lines)
> @@ -6862,7 +6862,7 @@ python--do-isort
> (append
> (split-string-shell-command
> python-interpreter-args)
> - '("-m" "isort" "-")
> + '("-Pm" "isort" "-")
> args)))
> (tick (buffer-chars-modified-tick)))
> (unless (eq 0 status)
> @@ -6940,7 +6940,7 @@ python-fix-imports
> (append
> (split-string-shell-command
> python-interpreter-args)
> - '("-m" "pyflakes"))))
> + '("-Pm" "pyflakes"))))
> (goto-char (point-min))
> (when (looking-at-p ".* No module named pyflakes$")
> (error "%s couldn't find pyflakes" python-interpreter))
> --
> 2.44.0
>
Thanks.
kobarity, any comments?
X-Loop: help-debbugs@HIDDEN
Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter'
Resent-From: kobarity <kobarity@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 18 Apr 2024 15:27:03 +0000
Resent-Message-ID: <handler.70440.B70440.171345400429669 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 70440
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Augusto Stoffel <arstoffel@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
Cc: 70440 <at> debbugs.gnu.org
Received: via spool by 70440-submit <at> debbugs.gnu.org id=B70440.171345400429669
(code B ref 70440); Thu, 18 Apr 2024 15:27:03 +0000
Received: (at 70440) by debbugs.gnu.org; 18 Apr 2024 15:26:44 +0000
Received: from localhost ([127.0.0.1]:53030 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1rxTet-0007iT-4i
for submit <at> debbugs.gnu.org; Thu, 18 Apr 2024 11:26:43 -0400
Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:52439)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <kobarity@HIDDEN>) id 1rxTeq-0007hc-LU
for 70440 <at> debbugs.gnu.org; Thu, 18 Apr 2024 11:26:41 -0400
Received: by mail-pf1-x42d.google.com with SMTP id
d2e1a72fcca58-6ed054f282aso906768b3a.0
for <70440 <at> debbugs.gnu.org>; Thu, 18 Apr 2024 08:26:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1713453981; x=1714058781; darn=debbugs.gnu.org;
h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from
:message-id:date:from:to:cc:subject:date:message-id:reply-to;
bh=fQPV5YwkqxQCplC3b2R/AGfe9IP0waz5ptaCzJs46VM=;
b=CNQHYsIR7w0QXH1TQWjmadt8DevWhLxqk7i77BZiNwTYs8A0NX9uWB1bpl/42APuBB
4qwdZ8Q4o4LiOlpajXaZyB/sFWohzOdZiPWI/JgRID7e7Wu3rS+RuBXeWJR5MBg9PHNN
+qgS0AEUakVft5TLmzDbqAN8p32n7SlzG/Tak4ftToalJD6DhZTJlU09BO5VBemPVZ2m
Pg6K4qD6CB/RLxWjLVwgndt7f44al3RNvzfF0Frzda2V0VJ6LO9s7SOBeVNKCwjoQyyx
2dKWvVy1Tc571fKeWo7hLPqEG4pIPzC1ZfQ+K5npl/E0j1rk0t7oUnA2gxr6V8ez5h0V
twEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1713453981; x=1714058781;
h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from
:message-id:date:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=fQPV5YwkqxQCplC3b2R/AGfe9IP0waz5ptaCzJs46VM=;
b=pqrwHxJE0xHUGMJ2ld9MlBlMtWiebzNfz56/K9wSaBS5XqCsn/Ak1fNZtjGPhY4GSn
S+0cGwnduLZs2EcrVferrOIsB95IwxpG2xF7mIA+k0/Lr1Whn1dRbN2gTZkiMYK0ZHiW
XuLySVv6m8hIhfG9r+f9iPRvVwAf93WeSY+hyUyzOQWOT2G6sFQ+ieGCyZctadouwyJ0
5KenfjzEdXn5wEuHjYDEBU7X0sFVXgrZCnp7l5w6FpxApuUs7OHbZQoDf8JPrMe2uDzk
5MBtCdcJe7KuPAPgmewuVpI4VhY2QbMEIMCADZukjgSyNipuTBHZ8koEygWt8wxAkLX2
UxEg==
X-Gm-Message-State: AOJu0YyYqobMwtC2MfIr7XBeiu0P0zfyQUfNVAzwP2mVKgpFHqnTvcV0
UzvP1VtuEvhAyfbn4i+wRZo8MDCRmByiXicuOivzAovRpI/zXsYp
X-Google-Smtp-Source: AGHT+IHfI7qyPVs6EuoCm7oxGwTdHWFMzsJ3Cw66aznRcYTIUgL84ru9MhLlzI/x3N45VDDiLt+qkA==
X-Received: by 2002:a05:6a21:3e01:b0:1aa:8442:21ba with SMTP id
bk1-20020a056a213e0100b001aa844221bamr3509248pzc.21.1713453981173;
Thu, 18 Apr 2024 08:26:21 -0700 (PDT)
Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161])
by smtp.gmail.com with ESMTPSA id
h15-20020a170902680f00b001e89e7b2b74sm850061plk.235.2024.04.18.08.26.19
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 18 Apr 2024 08:26:20 -0700 (PDT)
Date: Fri, 19 Apr 2024 00:25:46 +0900
Message-ID: <eke7y19aofph.wl-kobarity@HIDDEN>
From: kobarity <kobarity@HIDDEN>
In-Reply-To: <861q73hkeq.fsf@HIDDEN>
References: <87h6fzj1b1.fsf@HIDDEN>
<861q73hkeq.fsf@HIDDEN>
User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue)
FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0
Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)
MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue")
Content-Type: text/plain; charset=US-ASCII
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Eli Zaretskii wrote:
> > From: Augusto Stoffel <arstoffel@HIDDEN>
> > Date: Wed, 17 Apr 2024 20:23:30 +0200
> >
> > The attachment should be self-explanatory, otherwise let me know.
> >
> >
> > >From 04db8a3fbb29f497fdc728f4413aea162650b30b Mon Sep 17 00:00:00 2001
> > From: Augusto Stoffel <arstoffel@HIDDEN>
> > Date: Wed, 17 Apr 2024 20:17:22 +0200
> > Subject: [PATCH] Use -P switch when calling 'python-interpreter'
> >
> > This excludes the current directory from Python's module load path,
> > which can be unsafe.
> >
> > * lisp/progmodes/python.el (python--list-imports): Use -P switch
> > (python--do-isort): Use -P switch
> > (python-fix-imports): Use -P switch
> > ---
> > lisp/progmodes/python.el | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
> > index 85279d3e84b..180a8357aad 100644
> > --- a/lisp/progmodes/python.el
> > +++ b/lisp/progmodes/python.el
> > @@ -6805,7 +6805,7 @@ python--list-imports
> > (append
> > (split-string-shell-command
> > python-interpreter-args)
> > - `("-c" ,python--list-imports)
> > + `("-Pc" ,python--list-imports)
> > (list (or name "")))))
> > (with-current-buffer buffer
> > (apply #'call-process
> > @@ -6814,7 +6814,7 @@ python--list-imports
> > (append
> > (split-string-shell-command
> > python-interpreter-args)
> > - `("-c" ,python--list-imports)
> > + `("-Pc" ,python--list-imports)
> > (list (or name ""))
> > (mapcar #'file-local-name source))))))
> > lines)
> > @@ -6862,7 +6862,7 @@ python--do-isort
> > (append
> > (split-string-shell-command
> > python-interpreter-args)
> > - '("-m" "isort" "-")
> > + '("-Pm" "isort" "-")
> > args)))
> > (tick (buffer-chars-modified-tick)))
> > (unless (eq 0 status)
> > @@ -6940,7 +6940,7 @@ python-fix-imports
> > (append
> > (split-string-shell-command
> > python-interpreter-args)
> > - '("-m" "pyflakes"))))
> > + '("-Pm" "pyflakes"))))
> > (goto-char (point-min))
> > (when (looking-at-p ".* No module named pyflakes$")
> > (error "%s couldn't find pyflakes" python-interpreter))
> > --
> > 2.44.0
> >
>
> Thanks.
>
> kobarity, any comments?
The -P switch is new, introduced in CPython 3.11, so I don't think it
can be added unconditionally. Furthermore, `python-interpreter' may
not be CPython. Isn't it enough to customize
`python-interpreter-args'?
X-Loop: help-debbugs@HIDDEN
Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter'
Resent-From: Augusto Stoffel <arstoffel@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 18 Apr 2024 15:53:02 +0000
Resent-Message-ID: <handler.70440.B70440.17134555648940 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 70440
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: kobarity <kobarity@HIDDEN>
Cc: 70440 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
Received: via spool by 70440-submit <at> debbugs.gnu.org id=B70440.17134555648940
(code B ref 70440); Thu, 18 Apr 2024 15:53:02 +0000
Received: (at 70440) by debbugs.gnu.org; 18 Apr 2024 15:52:44 +0000
Received: from localhost ([127.0.0.1]:53168 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1rxU44-0002K8-8A
for submit <at> debbugs.gnu.org; Thu, 18 Apr 2024 11:52:44 -0400
Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]:54351)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <arstoffel@HIDDEN>) id 1rxU43-0002K2-1N
for 70440 <at> debbugs.gnu.org; Thu, 18 Apr 2024 11:52:43 -0400
Received: by mail-ej1-x62a.google.com with SMTP id
a640c23a62f3a-a555faf94fcso113910366b.0
for <70440 <at> debbugs.gnu.org>; Thu, 18 Apr 2024 08:52:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1713455543; x=1714060343; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=lLzMxAWR3H5mCnNMxEyc0zRQyvytda0uZnh2OR3c+CE=;
b=abeOw6Qi13+qQBz/ojvAegnXZAs+FBSAwoAyCkBfGPN/LAEYyIYK4G8PMXL9SeVosr
eI9oDybd/DPx0o0S0sFV399vuARRjUDPR3rGT1bwHK4NkutJEmK3xGLRTSt3HvLYy3/U
4wDSfm2bqKaUmaxWfMOpYEMg6BigaOkXOdv/b3LlKuSmsCwfbB9Pgod7qs1WmJoMOo/v
i9Pw+6hOCc9UaEzLogzSRE1Dnl4sQjG0a6MHztKEbWYkLQRMdB/vHmotJAYv0OUJM0I2
Fl/zuCRKo4WB0cchKRAvzSBHsWw3dMKClIyePfk38o6yitWq9f7ju1qDKPXCtYK1JOcG
3tGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1713455543; x=1714060343;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=lLzMxAWR3H5mCnNMxEyc0zRQyvytda0uZnh2OR3c+CE=;
b=XYn4bVxRkJLd9TV4gumh9OXp80x3oJS6lXG7D8NIHAd2wKtwHp6EBNjbC+KzUx2C42
Gx/2CLpkYy/J95Z8vxYgWY3qKLmfVvADe3g8XKdQYUTml8qrCSBsCzI+FM8Ohne1sOs2
YQY3ERbkyARhDCNDENYWEfSZVSRZoTny5flMUTm/5K9mGicp0zlLN8tPibFc+0e5Josq
EzQzCEi8xrMvWPKeZqsC0usL9hgROu2UPSXJJX6pLCmjyzcHszmch7yRMc93uiHXCWmt
Tpkq7kyr2EygCcs54WUjZE2QUps06p7v7ZO7qLSpmrVYHOUwCK3Gh9UJbQ3EkUYjv2sK
Cmfw==
X-Forwarded-Encrypted: i=1;
AJvYcCU4E0ijytzRDBxI1mG7kuoMoycT2WtFAy31rhDvenCFpvZ4kfzicfcUqdb/GRqZ9pf0ClqXmsmLC8G/aTIYSQZFsB3q9WI=
X-Gm-Message-State: AOJu0YzcayNRme04FMUfYwqzCWiIS+SoSBdYgUI79OVJPBx3g0Eq6O7I
0DX7EpBDWk04elpPUCNBKLiAq5Ma7ghHlIVrgMLkn5+lq0umpPL3gtKJ1duT
X-Google-Smtp-Source: AGHT+IHRZTnA8tDdSdP+Zay7SMEpWr+/1FqwLkh6mw33g3DJuwPU7bbwDHQ6Wk1hhZbziK+lgksoGw==
X-Received: by 2002:a17:906:4c54:b0:a46:65fd:969d with SMTP id
d20-20020a1709064c5400b00a4665fd969dmr1927099ejw.71.1713455542935;
Thu, 18 Apr 2024 08:52:22 -0700 (PDT)
Received: from ars3 ([2a02:8109:8a87:ff00::6223])
by smtp.gmail.com with ESMTPSA id
u14-20020a170906b10e00b00a5534758ef7sm1070910ejy.148.2024.04.18.08.52.21
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 18 Apr 2024 08:52:22 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <eke7y19aofph.wl-kobarity@HIDDEN> (kobarity@HIDDEN's
message of "Fri, 19 Apr 2024 00:25:46 +0900")
References: <87h6fzj1b1.fsf@HIDDEN> <861q73hkeq.fsf@HIDDEN>
<eke7y19aofph.wl-kobarity@HIDDEN>
Date: Thu, 18 Apr 2024 17:52:21 +0200
Message-ID: <87sezihdmy.fsf@HIDDEN>
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 <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On Fri, 19 Apr 2024 at 00:25, kobarity wrote:
> The -P switch is new, introduced in CPython 3.11, so I don't think it
> can be added unconditionally. Furthermore, `python-interpreter' may
> not be CPython. Isn't it enough to customize
> `python-interpreter-args'?
Ah, too bad. So let's send that option via environment variables. I'll
make a new patch when I get the chance.
This patch is a quite important fix and shouldn't be left to a
customization. Without it, you need to trust the .py files in the
current directory. Moreover any name clashes with the built-in library
module names can crash the commands (just happened to me).
X-Loop: help-debbugs@HIDDEN
Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter'
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 18 Apr 2024 15:59:03 +0000
Resent-Message-ID: <handler.70440.B70440.171345590211772 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 70440
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Augusto Stoffel <arstoffel@HIDDEN>
Cc: 70440 <at> debbugs.gnu.org, kobarity@HIDDEN
Received: via spool by 70440-submit <at> debbugs.gnu.org id=B70440.171345590211772
(code B ref 70440); Thu, 18 Apr 2024 15:59:03 +0000
Received: (at 70440) by debbugs.gnu.org; 18 Apr 2024 15:58:22 +0000
Received: from localhost ([127.0.0.1]:53194 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1rxU9U-00033c-Vu
for submit <at> debbugs.gnu.org; Thu, 18 Apr 2024 11:58:22 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:40022)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <eliz@HIDDEN>) id 1rxU9S-00032M-0f
for 70440 <at> debbugs.gnu.org; Thu, 18 Apr 2024 11:58:19 -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 <eliz@HIDDEN>)
id 1rxU93-0004Iy-SG; Thu, 18 Apr 2024 11:57:55 -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=XCt6Ig6Fxmw9/YarWoy8uctgR0Fsr+5h3q/oZPtdN8c=; b=qcYkAMU2jE4N
iqnp5tDSb63y1n23r5bZC+PULs4e1B9htB1oqT0lkXcLIB1kL0y/QHiuZdAhdcANpLwrbTIs+BTIb
AJl7HErBa+dyH+imPQOaBgpSPql4qTkJW8QbLvDBbwUDlpgRgIz3QzZbP4z6Y+FlwurVENImLSwxJ
4qrgZW1vXWYaohGzcisLoFT0OiyI6AmR6pcb7tav+Dty6zwPfjCL1wPtNQWOHTWDZYRX5OKUQATN4
LB3i6KW9Zhmrs6qpr1pi/2kgEpFO90NcIn/MRrL8cmAeUeVMZtX4hIdGxXcDZ+md+bIC8aSOCKGMv
x4P/2ArYEA+fz5l1mCwVXQ==;
Date: Thu, 18 Apr 2024 18:57:38 +0300
Message-Id: <86wmoud5ot.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87sezihdmy.fsf@HIDDEN> (message from Augusto Stoffel on Thu,
18 Apr 2024 17:52:21 +0200)
References: <87h6fzj1b1.fsf@HIDDEN> <861q73hkeq.fsf@HIDDEN>
<eke7y19aofph.wl-kobarity@HIDDEN> <87sezihdmy.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
> From: Augusto Stoffel <arstoffel@HIDDEN>
> Cc: Eli Zaretskii <eliz@HIDDEN>, 70440 <at> debbugs.gnu.org
> Date: Thu, 18 Apr 2024 17:52:21 +0200
>
> On Fri, 19 Apr 2024 at 00:25, kobarity wrote:
>
> > The -P switch is new, introduced in CPython 3.11, so I don't think it
> > can be added unconditionally. Furthermore, `python-interpreter' may
> > not be CPython. Isn't it enough to customize
> > `python-interpreter-args'?
>
> Ah, too bad. So let's send that option via environment variables. I'll
> make a new patch when I get the chance.
Maybe we should discuss this before you sit down to write and text the
code. Pushing things into the environment has its downsides: those
environment variables then affect all the subordinate processes,
including their children, grandchildren etc. This is not always
wanted.
One alternative to environment variables would be detecting whether -P
is supported before the first time we invoke Python. We do similar
stuff for Grep and other programs we invoke.
X-Loop: help-debbugs@HIDDEN
Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter'
Resent-From: Augusto Stoffel <arstoffel@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 18 Apr 2024 16:03:04 +0000
Resent-Message-ID: <handler.70440.B70440.171345617914085 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 70440
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 70440 <at> debbugs.gnu.org, kobarity@HIDDEN
Received: via spool by 70440-submit <at> debbugs.gnu.org id=B70440.171345617914085
(code B ref 70440); Thu, 18 Apr 2024 16:03:04 +0000
Received: (at 70440) by debbugs.gnu.org; 18 Apr 2024 16:02:59 +0000
Received: from localhost ([127.0.0.1]:53215 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1rxUDz-0003f3-2L
for submit <at> debbugs.gnu.org; Thu, 18 Apr 2024 12:02:59 -0400
Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:60545)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <arstoffel@HIDDEN>) id 1rxUDv-0003di-V3
for 70440 <at> debbugs.gnu.org; Thu, 18 Apr 2024 12:02:57 -0400
Received: by mail-ej1-x635.google.com with SMTP id
a640c23a62f3a-a51addddbd4so101490166b.0
for <70440 <at> debbugs.gnu.org>; Thu, 18 Apr 2024 09:02:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1713456156; x=1714060956; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=ctqcodJ8its27RyEal7tFLcvWxoAPMKHP0uVerDjJz8=;
b=Nm1XqX6MGcPK8es7PPd8Q0Omf/SB8ZAiDe3BxltXo1FPrVg9IMlgwPAI0AI5KyUrHp
r5rsnQTqAsDvOPTwsOVzPbqh5EOwrkkuuPym4SNQpkKUvzUnMUkPb4WCRe2VgBaI/mqs
Fk7/8U8NgpSd+L8IMbOFKtDBXQ+bmQe1UfSL8mvIBzmwsT8Jwt58VOEFt788TMcCWgQN
xlpjmp7LyfujmCY/Xvc2lHLhzaURmfV2xBcfPlXT31qNGuJCf8hRCQ5dQcmTVRP09tXI
ybNtK50lnHMzyDBF/oh1ZDYbs9EYyQ0QgIN9pAwETFWpf8fL5eQrK1N+FdlFnpDa2Aek
bUDg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1713456156; x=1714060956;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=ctqcodJ8its27RyEal7tFLcvWxoAPMKHP0uVerDjJz8=;
b=JInVxezkouXLdrRbTreub3kvjjiQ9TKjFuqWNR1rtmTZB/SVPjVrcBSxjLweI8ZYog
YuKLcYq2CrBIhWez3Yqe/p/jipg+nMWtvJKezhPsMBh7qeap02uDc7/ouBhFf5jB7o9A
Hq+zpDvxWww656BshauMzzS1kWjubtlTc1rrKguyNKMjQx2B+jDYFFXJL2dhoQcYm2gE
GFsFRGo4yKsHucP858DqCxYJBr05WyeKV2APi+yYtKB3v/SYBTQGGx3B5FE/jMQyA2G8
NGXEH2rgQIeYdqj2Fski0djMxyOpbKyutQ57pOWTO3E+S4I2XLYvcpNsR6T0l9zZTBtG
qMlg==
X-Forwarded-Encrypted: i=1;
AJvYcCWNY+0Q/St5ly5bl4oP0zYIRRjYWGZFaj6OrZtOqHYMuJH+4hfzEqkf8uZGUbPLMRgkrNaecOGG7P/GafwwbqiYi0eshPg=
X-Gm-Message-State: AOJu0YxCHSQAxVtsWJ76EVp7/mEmsLZtHMxiHGBT7pRwm3IpNge2qcjF
JF1Jfr5/gMbfDSA0wzeyyDhEs7eDpYsJ/nkHc+5297wL9BH0ZeHWtIKmqbDg
X-Google-Smtp-Source: AGHT+IFX98llqWR2aHN/QIECFguahlwvvnu67Uubp8oro9yO6/fgHQyACwL6egngyAmvzryi6g7Spg==
X-Received: by 2002:a17:906:c08b:b0:a55:6d0a:74a2 with SMTP id
f11-20020a170906c08b00b00a556d0a74a2mr1711163ejz.40.1713456156088;
Thu, 18 Apr 2024 09:02:36 -0700 (PDT)
Received: from ars3 ([2a02:8109:8a87:ff00::6223])
by smtp.gmail.com with ESMTPSA id
w25-20020a17090633d900b00a51cdde5d9bsm1067800eja.225.2024.04.18.09.02.35
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 18 Apr 2024 09:02:35 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <86wmoud5ot.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 18 Apr
2024 18:57:38 +0300")
References: <87h6fzj1b1.fsf@HIDDEN> <861q73hkeq.fsf@HIDDEN>
<eke7y19aofph.wl-kobarity@HIDDEN> <87sezihdmy.fsf@HIDDEN>
<86wmoud5ot.fsf@HIDDEN>
Date: Thu, 18 Apr 2024 18:02:34 +0200
Message-ID: <87o7a6hd5x.fsf@HIDDEN>
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 <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On Thu, 18 Apr 2024 at 18:57, Eli Zaretskii wrote:
>> From: Augusto Stoffel <arstoffel@HIDDEN>
>> Cc: Eli Zaretskii <eliz@HIDDEN>, 70440 <at> debbugs.gnu.org
>> Date: Thu, 18 Apr 2024 17:52:21 +0200
>>
>> On Fri, 19 Apr 2024 at 00:25, kobarity wrote:
>>
>> > The -P switch is new, introduced in CPython 3.11, so I don't think it
>> > can be added unconditionally. Furthermore, `python-interpreter' may
>> > not be CPython. Isn't it enough to customize
>> > `python-interpreter-args'?
>>
>> Ah, too bad. So let's send that option via environment variables. I'll
>> make a new patch when I get the chance.
>
> Maybe we should discuss this before you sit down to write and text the
> code. Pushing things into the environment has its downsides: those
> environment variables then affect all the subordinate processes,
> including their children, grandchildren etc. This is not always
> wanted.
In this case we would just let-bind the env variable for this specific
subprocess call only. It's no different than passing a command-line
switch.
> One alternative to environment variables would be detecting whether -P
> is supported before the first time we invoke Python. We do similar
> stuff for Grep and other programs we invoke.
X-Loop: help-debbugs@HIDDEN
Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter'
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 18 Apr 2024 16:15:04 +0000
Resent-Message-ID: <handler.70440.B70440.171345685519011 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 70440
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Augusto Stoffel <arstoffel@HIDDEN>
Cc: 70440 <at> debbugs.gnu.org, kobarity@HIDDEN
Received: via spool by 70440-submit <at> debbugs.gnu.org id=B70440.171345685519011
(code B ref 70440); Thu, 18 Apr 2024 16:15:04 +0000
Received: (at 70440) by debbugs.gnu.org; 18 Apr 2024 16:14:15 +0000
Received: from localhost ([127.0.0.1]:53269 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1rxUOt-0004wY-15
for submit <at> debbugs.gnu.org; Thu, 18 Apr 2024 12:14:15 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:39734)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <eliz@HIDDEN>) id 1rxUOq-0004vg-Im
for 70440 <at> debbugs.gnu.org; Thu, 18 Apr 2024 12:14:13 -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 <eliz@HIDDEN>)
id 1rxUOX-0007A4-J0; Thu, 18 Apr 2024 12:13:53 -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=B3lLtzdHqXChY8tZz93vHNgjah8vuofqdjYVPGp2HB0=; b=IurQR1E4qw2q
etAOk7iGHz86ibJIicw9TWkf1tijRAZrQ6P02VIDUHA0pJj9dIGAQM5fCB2Ut8Lh9MCyj3phnMugu
P0KKlvjglGotCH/LX3PWYBy5ePUwAcQ/feHcbvYKb8BOy+96COBfNcDmSYvlVTgRuFu5m3kgpBvNR
dhEdgwg+/sKavUegCK62yz1XH9HfSvUe2Rzfn3ba2gaqnGsq/xnJ+AIlhVpycMEKrQBmuQB6HB5Hi
/2PcWPEnqtJO5uu33nmh0jXUMkX5jSpfPOM05HJ4jr1/vXZ3ldUks7mBPkWSE6TcA5/D1zG6l96Nk
Nj1+VscsiW10rFAsqmSBbw==;
Date: Thu, 18 Apr 2024 19:13:47 +0300
Message-Id: <86v84ed4xw.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87o7a6hd5x.fsf@HIDDEN> (message from Augusto Stoffel on Thu,
18 Apr 2024 18:02:34 +0200)
References: <87h6fzj1b1.fsf@HIDDEN> <861q73hkeq.fsf@HIDDEN>
<eke7y19aofph.wl-kobarity@HIDDEN> <87sezihdmy.fsf@HIDDEN>
<86wmoud5ot.fsf@HIDDEN> <87o7a6hd5x.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
> From: Augusto Stoffel <arstoffel@HIDDEN>
> Cc: kobarity@HIDDEN, 70440 <at> debbugs.gnu.org
> Date: Thu, 18 Apr 2024 18:02:34 +0200
>
> On Thu, 18 Apr 2024 at 18:57, Eli Zaretskii wrote:
>
> >> From: Augusto Stoffel <arstoffel@HIDDEN>
> >> Cc: Eli Zaretskii <eliz@HIDDEN>, 70440 <at> debbugs.gnu.org
> >> Date: Thu, 18 Apr 2024 17:52:21 +0200
> >>
> >> On Fri, 19 Apr 2024 at 00:25, kobarity wrote:
> >>
> >> > The -P switch is new, introduced in CPython 3.11, so I don't think it
> >> > can be added unconditionally. Furthermore, `python-interpreter' may
> >> > not be CPython. Isn't it enough to customize
> >> > `python-interpreter-args'?
> >>
> >> Ah, too bad. So let's send that option via environment variables. I'll
> >> make a new patch when I get the chance.
> >
> > Maybe we should discuss this before you sit down to write and text the
> > code. Pushing things into the environment has its downsides: those
> > environment variables then affect all the subordinate processes,
> > including their children, grandchildren etc. This is not always
> > wanted.
>
> In this case we would just let-bind the env variable for this specific
> subprocess call only. It's no different than passing a command-line
> switch.
Don't then the child processes of that python subprocess inherit the
same variable in their environments? That's what I meant by what I
wrote above: all of the descendants of our sub-process will inherit
the variable.
X-Loop: help-debbugs@HIDDEN
Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter'
Resent-From: Augusto Stoffel <arstoffel@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 19 Apr 2024 06:10:01 +0000
Resent-Message-ID: <handler.70440.B70440.171350695015822 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 70440
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: kobarity <kobarity@HIDDEN>
Cc: 70440 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>
Received: via spool by 70440-submit <at> debbugs.gnu.org id=B70440.171350695015822
(code B ref 70440); Fri, 19 Apr 2024 06:10:01 +0000
Received: (at 70440) by debbugs.gnu.org; 19 Apr 2024 06:09:10 +0000
Received: from localhost ([127.0.0.1]:56949 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1rxhQs-000478-83
for submit <at> debbugs.gnu.org; Fri, 19 Apr 2024 02:09:10 -0400
Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:57460)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <arstoffel@HIDDEN>) id 1rxhQp-000470-TR
for 70440 <at> debbugs.gnu.org; Fri, 19 Apr 2024 02:09:08 -0400
Received: by mail-ed1-x531.google.com with SMTP id
4fb4d7f45d1cf-56e56ee8d5cso2361748a12.2
for <70440 <at> debbugs.gnu.org>; Thu, 18 Apr 2024 23:08:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1713506927; x=1714111727; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=xFOVhqc674409pHr1o0cS+LI5DzBexhTPKaHlTUPI80=;
b=bJOfAK/KPVadAyQYTPshyjPl7T6z4Od1OlqSOk0kW58wBt8pLWDpU63Q0D1YUNZcTC
qsSVvsEJubTs558SjTDRHHYb9TqANkKZeQqz3dyEsnYJpu6lAl6CaozCmgOrQPvWNriY
IEPdbVhP1kuBUOfAKTi1U9QArQeuYi/XNzqgSGFUDySf+N9Pd556FvbI6L+Sm9F4hTsP
TMZSLohDq3uCH6ZH9DBLTpaw8bceTdhatw9llk62WxBbHmPxmniZiWN3jRsGzvf7RcUc
8gn+RIsFhg8HTM1Ltv043tJt/TEE/PwErmhnPYx5bKbth1gD8teIeDvclgecO186NgYg
f/uQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1713506927; x=1714111727;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=xFOVhqc674409pHr1o0cS+LI5DzBexhTPKaHlTUPI80=;
b=fDpyYdlWaoOpDWWcYb6V5xp4vqm9qzWWvrS7hHbvM8pZudyj33HyLebzduzVKyjZPg
7wgUyI92IeuUK2oTkmYN/zvYKuqrPzT8tsXytr3RwJQJI839G7Jp3nuPByOb+hrCK5wT
In4Bi4kAQ2yonjpwyGKdI1eSO5pV1suvwUmtIsjwztFzL0YvEkYS/lcHhiA45MboYQ7V
vcCTBRxyUejcYt6Uszk+00f5U5ohl1cy/AuGxr15roGzk8d0zLNNDgnTLoOhUR7EYwZQ
Kb5QmpBgBMr4puppBXm00Nc5VetP3Ee2JEG2z3X4rXltPy0jkxOr3uZbdN+w398IsAzd
uLwg==
X-Forwarded-Encrypted: i=1;
AJvYcCUc7q9jGvhSlDz5MJNufsE6BTGiTHWu7oSmQm5TNbzEP/AuGMPQ4AMT2FF39D6oOjDBeUpgbeb7mwnYyTF6Ql7v/wNXoUM=
X-Gm-Message-State: AOJu0YwpBpsOnokuMQhc+AHBvp5X2GS59cr3sxhcgvmAZOSroyYjx9mZ
oi/rQba6bkLqn8AGlos5w5azhyMdDChQTB44hnDNmEG6jWOyaRzkfkaFpw==
X-Google-Smtp-Source: AGHT+IGIoxD4/XeGx4KAzBCKmQDu06Q5PtcU5jh+TNlEFwN40LUhYABedcSzFdaoZkBm7U3eNCBpqA==
X-Received: by 2002:a17:906:f255:b0:a52:2284:d97f with SMTP id
gy21-20020a170906f25500b00a522284d97fmr744593ejb.25.1713506927113;
Thu, 18 Apr 2024 23:08:47 -0700 (PDT)
Received: from ars3 ([2a02:8109:8a87:ff00::6223])
by smtp.gmail.com with ESMTPSA id
25-20020a170906311900b00a52331a9bdasm1753855ejx.48.2024.04.18.23.08.45
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 18 Apr 2024 23:08:46 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
In-Reply-To: <eke7y19aofph.wl-kobarity@HIDDEN> (kobarity@HIDDEN's
message of "Fri, 19 Apr 2024 00:25:46 +0900")
References: <87h6fzj1b1.fsf@HIDDEN> <861q73hkeq.fsf@HIDDEN>
<eke7y19aofph.wl-kobarity@HIDDEN>
Date: Fri, 19 Apr 2024 08:08:43 +0200
Message-ID: <87jzkthok4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
--=-=-=
Content-Type: text/plain
On Fri, 19 Apr 2024 at 00:25, kobarity wrote:
> The -P switch is new, introduced in CPython 3.11, so I don't think it
> can be added unconditionally. Furthermore, `python-interpreter' may
> not be CPython. Isn't it enough to customize
> `python-interpreter-args'?
After sleeping on this, I recommend using -P anyway and simply failing
if the installed Python is too old.
The reason is that this has a security implication, similar to the
recent Org mode Latex preview situation. Without -P the user is tacitly
trusting the contents of the current directory. By tricking an user
into downloading a malicious file with an intentional name clash (say
via git pull), arbitrary code could in principle be executed on the
user's machine.
The -P switch completely removes this possibility, and conversely,
without -P there seems to be no reasonable way to make Python safe.
I've attached a new patch that informs the user why the commands failed
when Python is too old, which is good enough in my opinion. Note also
that this change only affects the Python import management commands,
which is a very handy but by no means essential feature.
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=0001-Use-P-switch-when-calling-python-interpreter.patch
From 2cca02440069a31546eff04c8cd6c00b171a85a2 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@HIDDEN>
Date: Wed, 17 Apr 2024 20:17:22 +0200
Subject: [PATCH] Use -P switch when calling 'python-interpreter'
This excludes the current directory from Python's module load path,
which can be unsafe.
* lisp/progmodes/python.el (python--list-imports, python--do-isort),
(python-fix-imports): Use -P switch
(python--list-imports-check-status): Warn about old Python versions
missing the -P switch.
---
lisp/progmodes/python.el | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 85279d3e84b..304aa2d9d6e 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -6744,9 +6744,9 @@ python--list-imports
try:
from isort import find_imports_in_stream, find_imports_in_paths
except ModuleNotFoundError:
- exit(2)
-except ImportError:
exit(3)
+except ImportError:
+ exit(4)
query, files, result = argv[1] or None, argv[2:], {}
@@ -6781,8 +6781,9 @@ python--list-imports-check-status
(unless (eq 0 status)
(let* ((details
(cond
- ((eq 2 status) " (maybe isort is missing?)")
- ((eq 3 status) " (maybe isort version is older than 5.7.0?)")
+ ((eq 2 status) " (maybe Python version is older than 3.11?)")
+ ((eq 3 status) " (maybe isort is missing?)")
+ ((eq 4 status) " (maybe isort version is older than 5.7.0?)")
(t "")))
(msg
(concat "%s exited with status %s" details)))
@@ -6805,7 +6806,7 @@ python--list-imports
(append
(split-string-shell-command
python-interpreter-args)
- `("-c" ,python--list-imports)
+ `("-Pc" ,python--list-imports)
(list (or name "")))))
(with-current-buffer buffer
(apply #'call-process
@@ -6814,7 +6815,7 @@ python--list-imports
(append
(split-string-shell-command
python-interpreter-args)
- `("-c" ,python--list-imports)
+ `("-Pc" ,python--list-imports)
(list (or name ""))
(mapcar #'file-local-name source))))))
lines)
@@ -6862,7 +6863,7 @@ python--do-isort
(append
(split-string-shell-command
python-interpreter-args)
- '("-m" "isort" "-")
+ '("-Pm" "isort" "-")
args)))
(tick (buffer-chars-modified-tick)))
(unless (eq 0 status)
@@ -6940,7 +6941,7 @@ python-fix-imports
(append
(split-string-shell-command
python-interpreter-args)
- '("-m" "pyflakes"))))
+ '("-Pm" "pyflakes"))))
(goto-char (point-min))
(when (looking-at-p ".* No module named pyflakes$")
(error "%s couldn't find pyflakes" python-interpreter))
--
2.44.0
--=-=-=--
X-Loop: help-debbugs@HIDDEN
Subject: bug#70440: [PATCH] Use -P switch when calling 'python-interpreter'
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 19 Apr 2024 07:16:03 +0000
Resent-Message-ID: <handler.70440.B70440.171351093223708 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 70440
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Augusto Stoffel <arstoffel@HIDDEN>
Cc: 70440 <at> debbugs.gnu.org, kobarity@HIDDEN
Received: via spool by 70440-submit <at> debbugs.gnu.org id=B70440.171351093223708
(code B ref 70440); Fri, 19 Apr 2024 07:16:03 +0000
Received: (at 70440) by debbugs.gnu.org; 19 Apr 2024 07:15:32 +0000
Received: from localhost ([127.0.0.1]:57256 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1rxiT5-00069N-K2
for submit <at> debbugs.gnu.org; Fri, 19 Apr 2024 03:15:32 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:56344)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <eliz@HIDDEN>) id 1rxiT3-0005lr-5g
for 70440 <at> debbugs.gnu.org; Fri, 19 Apr 2024 03:15:30 -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 <eliz@HIDDEN>)
id 1rxiSj-0006jd-NZ; Fri, 19 Apr 2024 03:15:09 -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=ZcNOgNikurQxYN5cNJeIJfgVy0FAdu3NFxYZmv+7ACQ=; b=dgYaAXdhPPR7
l5bNHz+a6us+wEYlMyekvP6TPM2CnV4TYwMm2HnRHep9ZxtyOqg888ok/qsgl1piZZCTGyMrELJiR
DZELPFj2glyAFrRrKix7EBxw7pp6W8JFJgZ4EB4T2QQDBx10b49h6TN4OPkfSTcpysLTdw6EYX0BJ
+XgRwaUrkcZ9wjfbojcHriZrZaPPudJVEmVNqRyi6U97/nWswhEQYz1s/6y6v5tQBY/Q0/bRMWrsR
id/qqdfsYPsdrHoI+4HSlUK1VACFjMlcWOf80yutdBWu/kacn9RM/66bIsIFeS9gETH2ELQvE8quY
WlOUKFSoY6gxp2L0hCBxRQ==;
Date: Fri, 19 Apr 2024 10:15:06 +0300
Message-Id: <861q71dds5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87jzkthok4.fsf@HIDDEN> (message from Augusto Stoffel on Fri,
19 Apr 2024 08:08:43 +0200)
References: <87h6fzj1b1.fsf@HIDDEN> <861q73hkeq.fsf@HIDDEN>
<eke7y19aofph.wl-kobarity@HIDDEN> <87jzkthok4.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
> From: Augusto Stoffel <arstoffel@HIDDEN>
> Cc: Eli Zaretskii <eliz@HIDDEN>, 70440 <at> debbugs.gnu.org
> Date: Fri, 19 Apr 2024 08:08:43 +0200
>
> On Fri, 19 Apr 2024 at 00:25, kobarity wrote:
>
> > The -P switch is new, introduced in CPython 3.11, so I don't think it
> > can be added unconditionally. Furthermore, `python-interpreter' may
> > not be CPython. Isn't it enough to customize
> > `python-interpreter-args'?
>
> After sleeping on this, I recommend using -P anyway and simply failing
> if the installed Python is too old.
>
> The reason is that this has a security implication, similar to the
> recent Org mode Latex preview situation. Without -P the user is tacitly
> trusting the contents of the current directory. By tricking an user
> into downloading a malicious file with an intentional name clash (say
> via git pull), arbitrary code could in principle be executed on the
> user's machine.
>
> The -P switch completely removes this possibility, and conversely,
> without -P there seems to be no reasonable way to make Python safe.
>
> I've attached a new patch that informs the user why the commands failed
> when Python is too old, which is good enough in my opinion. Note also
> that this change only affects the Python import management commands,
> which is a very handy but by no means essential feature.
Doing it this way would be an annoyance. Users could have
less-than-the-latest Python (or non-CPython version) installed for any
number of reasons, and it is not our business to annoy them because of
this. Security of using Python is not our concern, it is the user's
concern.
So I'd prefer that the change probed the support for the -P switch
when the relevant Emacs commands/functions are first invoked, and used
that if -P is supported, without any annoying messages. Do you see
any problems with such an approach?
Thanks.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.