GNU bug report logs - #66534
30.0.50; [PATCH] Expand file-name of ~/.emacs before attempt to load it

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Christoph <just.mychris@HIDDEN>; Keywords: patch; dated Sat, 14 Oct 2023 01:07:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 66534 <at> debbugs.gnu.org:


Received: (at 66534) by debbugs.gnu.org; 14 Oct 2023 12:46:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 14 08:46:24 2023
Received: from localhost ([127.0.0.1]:48103 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qre2B-0004KA-8F
	for submit <at> debbugs.gnu.org; Sat, 14 Oct 2023 08:46:24 -0400
Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:60673)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <just.mychris@HIDDEN>) id 1qrabH-0008T0-0V
 for 66534 <at> debbugs.gnu.org; Sat, 14 Oct 2023 05:06:23 -0400
Received: by mail-ej1-x635.google.com with SMTP id
 a640c23a62f3a-99bdeae1d0aso454466366b.1
 for <66534 <at> debbugs.gnu.org>; Sat, 14 Oct 2023 02:05:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=googlemail.com; s=20230601; t=1697274353; x=1697879153; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=ehFqExKq2LRK23v/E5qLexApUMovVg5wUnJvWwSkYRw=;
 b=SXK5Kj97LbVE58RjyTk+MeeyOVjmtW6NIuVvdDIlnpbZ5xrBK3hjnp+jSNYBl3evYe
 Ep9n5vH+AKUgcFcsxx+MGpF2e+HBjaYiD1VPkM7gXaLsXddhTKLzCTlbkT3FLogRnU8R
 DoXV6ZpZ58yuvmSJ2uCA+vHqU4djKZfLE2HHfHADoFDuUJeLgwT3Xr2ahXnjPkATZMNJ
 QMDG/TxtZK1kQGuEupaWUzFzHXOGlszAmJhf4rd7UNfqYKAVRgisBqyBDlkZsxJENC0Q
 PTJ4wlATrAZKtB5xq/UeZGOioyb8PAJOVnx2aolaVpKeYygy60xvCzgnrtNFjprRuukr
 vToA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1697274353; x=1697879153;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=ehFqExKq2LRK23v/E5qLexApUMovVg5wUnJvWwSkYRw=;
 b=kCNETnkJXg8VxMX+6gPu9BNUrqtsD2kOQQ8GuBVIN6OAqsDSEeDvcN4SVp0tsaxBZ6
 3rOY7hh6KHlyGeEwHpMooOX+qXRihPZVYveZGh931IpuVLhAw/beNNMdJ618bMV0JV99
 saKDQDqrGgq7KYzG76o9dunmm3Q0S8StiCfx94lYxNLs43m9if2rZr+6hDl8ysj2FVan
 GUhm7Lcb3ugr0BbyCCVH2BgpW3Vs6yQ+3xFij8geWPuyStE9ANOu46ttlHUCCyBqRc2J
 46Bt2hcBFRr3c89PTIIHI5ogogY9113dqmmfT76Oar7NWgNQcM6NYrfrP46R6vidMHcs
 vGCw==
X-Gm-Message-State: AOJu0YyqVudGX0uLZyZhmxTr9nUGVNTenBuEuB2eKdStEov/x1oCtPBr
 3l5hT7y922z5t3bhbkBASgOxRQ5PFsl0z0ZBzgk=
X-Google-Smtp-Source: AGHT+IGaffvYBEN3GO2813qD0BIjl1vYkoYb17S9MS7ocrSL1XCjStAq8oTo2kFJTE8xv3yz5qBvK/CstqQOoFZGPmM=
X-Received: by 2002:a17:906:6a01:b0:9bd:ac0f:83dc with SMTP id
 qw1-20020a1709066a0100b009bdac0f83dcmr3489373ejc.54.1697274353448; Sat, 14
 Oct 2023 02:05:53 -0700 (PDT)
MIME-Version: 1.0
References: <CAK9rt1qmf-5gP6EXYiMHNw7LwbziUVsstZ-gs=ss8h9NStXVUw@HIDDEN>
 <87cyxhhdhd.fsf@HIDDEN>
In-Reply-To: <87cyxhhdhd.fsf@HIDDEN>
From: Christoph <just.mychris@HIDDEN>
Date: Sat, 14 Oct 2023 11:05:42 +0200
Message-ID: <CAK9rt1o_C8aJs_fDOa0d36_qM7E26=z9B=ruMjsWphGeVhkSKw@HIDDEN>
Subject: Re: bug#66534: 30.0.50; [PATCH] Expand file-name of ~/.emacs before
 attempt to load it
To: Andreas Schwab <schwab@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66534
X-Mailman-Approved-At: Sat, 14 Oct 2023 08:46:21 -0400
Cc: "Christoph via Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>,
 66534 <at> debbugs.gnu.org
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 Sat, Oct 14, 2023 at 9:25=E2=80=AFAM Andreas Schwab <schwab@HIDDEN=
rg> wrote:
>
> On Okt 13 2023, Christoph via "Bug reports for GNU Emacs, the Swiss army =
knife of text editors" wrote:
>
> > I noticed that during startup, emacs tries to load ~/.emacs (with
> > different extensions) many times over.  You can see this by using
> > strace and tracing the openat syscall.  The problem is, that `load'
> > does not expand the ~/ in the filename passed to it.  So it does not
> > recognize the file as being absolute and tries to resolve it using
> > the load-path.
>
> That's probably a bug in complete_filename_p.
>

I am not so sure if complete_filename_p should be able to recognize
these kinds of paths, or if `load' should expand the filename before
using it.  I am not familiar with all supported platforms, but it might
be tricky to check if a filename is absolute, without expanding it
beforehand.

For instance, what about filenames that start with a series of "../".
I guess they should be considered to be absolute, if the path goes up
to the root.

On the other hand, the documentation of `load' does not mention
absolute paths at all and states, This function searches the
directories on `load-path'.  So I can't say what the expected behaviour
of load is with paths that aren't expanded, but are absolute.

I am hesitant with changing the C code, because I am not very familiar
with it and just started to get into it, so I thought it might be more
appropriate to change it on the Lisp side, since all the other paths
to init files are fully expanded before passing them to load.

But yes, as I wrote before, I think this behaviour of load could be
considered a bug as well.

-- Christoph




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66534; Package emacs. Full text available.

Message received at 66534 <at> debbugs.gnu.org:


Received: (at 66534) by debbugs.gnu.org; 14 Oct 2023 12:46:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 14 08:46:23 2023
Received: from localhost ([127.0.0.1]:48101 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qre2A-0004K7-0x
	for submit <at> debbugs.gnu.org; Sat, 14 Oct 2023 08:46:23 -0400
Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:58532)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <just.mychris@HIDDEN>) id 1qraZr-0008QA-Hi
 for 66534 <at> debbugs.gnu.org; Sat, 14 Oct 2023 05:05:10 -0400
Received: by mail-ed1-x535.google.com with SMTP id
 4fb4d7f45d1cf-53e08e439c7so4483380a12.0
 for <66534 <at> debbugs.gnu.org>; Sat, 14 Oct 2023 02:04:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=googlemail.com; s=20230601; t=1697274266; x=1697879066; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=a/LUX47i9ycfVy33mIqr0qgRIgGyfZpB5SEF98ij2W8=;
 b=W4E8qLJ5TFV95ZScCL5mz4SemfiucuD19LGz/JO3zJIFu1gf9V5Knz16WPEe4JUOPB
 Pc/VuaN81gKDuajPZaqK+ZchDy7sGgXpQLl+MSo2E9mvrN8UDbgYyijZR6HiNxjza331
 KSnhcg4U7hOpbmusm7tNcrewOf5izDukrd31b8/plhV64gVgnz28UYBRs9BVjK6/UG4C
 jGc0676lh7uaaZ3gmmRgK3dfAPLt1rbF0DQpveHRomgaB+d9JhPFbrmTAgJm4ExkAkPL
 zCNu9W0cQW+RJPmXL7VcGi9iRx3vwQrZRjL0nYLet9c3CGx959fpiEt3Ts799nP4BnTC
 b8IQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1697274266; x=1697879066;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=a/LUX47i9ycfVy33mIqr0qgRIgGyfZpB5SEF98ij2W8=;
 b=CZR5NvmOz7lcFSzSX/2jthwDoaUoGbJOTfv53cFHbNQiL1HaHENRrGlb9kIw27RFhv
 ZKoUw3YFSfH/pXSF8N1XXNAYMDiCou5xI2yZWebfqB4TPq8FtWitAxIfT9tF11I7XDGR
 qLG8FCHUF6hYsHUsQqwKalj8vPJhpI6dmUtMbJJ34gAiqZuXTJ90AaCfd4AlHV8sx2RI
 0SWJ27iz5d8L+i+HUFRkVkqEdYouc29IqZHugfFsRWPMzwbCw9RzEPaIc0rC2QJmWVZt
 67q9A8o3cg9LDdZswN/TCCQq0DiYHCNu1Hl5rPFAly6ppEPEvGhLeB2u6raI9Q4O64kG
 AzoQ==
X-Gm-Message-State: AOJu0YyE6blPZUNp3KasumOkEznNFdmfZZmjBhuwtEjDdJ1MYWJ4wx0D
 +ZZDMAKfm4bp2+RoMRuiWvGX8unPUwP4XSEH2XyzwWkZ3sg=
X-Google-Smtp-Source: AGHT+IF3lVmsMqHY0eXXp7aEyDCYIh5Lkyic6Utsri0vYksYGic4H8e1/Sx02lZzkr/HYS2PwxNZ2wvIxtq8bobKOxo=
X-Received: by 2002:a05:6402:b0f:b0:536:aead:3486 with SMTP id
 bm15-20020a0564020b0f00b00536aead3486mr20827589edb.40.1697274265974; Sat, 14
 Oct 2023 02:04:25 -0700 (PDT)
MIME-Version: 1.0
References: <CAK9rt1qmf-5gP6EXYiMHNw7LwbziUVsstZ-gs=ss8h9NStXVUw@HIDDEN>
 <83r0lxsnhz.fsf@HIDDEN>
In-Reply-To: <83r0lxsnhz.fsf@HIDDEN>
From: Christoph <just.mychris@HIDDEN>
Date: Sat, 14 Oct 2023 11:04:14 +0200
Message-ID: <CAK9rt1pjAci_JocMibY=k+icW+LkMz+5RaLcSKMRVrMppRQuOg@HIDDEN>
Subject: Re: bug#66534: 30.0.50; [PATCH] Expand file-name of ~/.emacs before
 attempt to load it
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66534
X-Mailman-Approved-At: Sat, 14 Oct 2023 08:46:21 -0400
Cc: 66534 <at> debbugs.gnu.org
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 Sat, Oct 14, 2023 at 8:54=E2=80=AFAM Eli Zaretskii <eliz@HIDDEN> wrote:
>
> > Date: Fri, 13 Oct 2023 20:41:16 +0200
> > From:  Christoph via "Bug reports for GNU Emacs,
> >  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> >
> > I noticed that during startup, emacs tries to load ~/.emacs (with
> > different extensions) many times over.  You can see this by using
> > strace and tracing the openat syscall.  The problem is, that `load'
> > does not expand the ~/ in the filename passed to it.  So it does not
> > recognize the file as being absolute and tries to resolve it using
> > the load-path.
> >
> > While resolving the path in the openp function in lread.c,
> > `expand-file-name' is used with the default directory being the
> > elements of the load-path.  Since for `expand-file-name', ~/.emacs is
> > an absolute path, it returns the path unchanged, and load tries to
> > load ~/.emacs many times over.
>
> I don't understand what you are saying here.  The last sentence is
> incorrect, as evidenced by the following:
>
>   (expand-file-name "~/.emacs" "/tmp")
>    =3D> "/home/eliz/.emacs"
>
> IOW, "~/.emacs" is indeed treated by Emacs as an absolute file name,
> but expand-file-name does NOT return "~/.emacs" unchanged.

What I meant is "unchanged" in the regard to the default
directory. You can give any default directory to expand-file-name and
it will always return the first argument in its expanded form, if the
expanded form of the first argument is an absolute path.

>
> So please explain what exactly is the problem you see here, and in
> particular what issues that problem causes in your case.
>
> Thanks.

If you start Emacs without an ~/.emacs file, and with using .emacs.d
and not .config/emacs, I think there is a difference as well, Emacs
will try to load ~/.emacs `(length load-path)' times.  If I start
Emacs with strace -e openat I see the following lines 147 times:

openat(AT_FDCWD, "/home/chris/.emacs", O_RDONLY|O_CLOEXEC) =3D -1 ENOENT
(No such file or directory)
openat(AT_FDCWD, "/home/chris/.emacs.gz", O_RDONLY|O_CLOEXEC) =3D -1
ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/chris/.emacs.so", O_RDONLY|O_CLOEXEC) =3D -1
ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/chris/.emacs.so.gz", O_RDONLY|O_CLOEXEC) =3D -1
ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/chris/.emacs.elc", O_RDONLY|O_CLOEXEC) =3D -1
ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/chris/.emacs.elc.gz", O_RDONLY|O_CLOEXEC) =3D -1
ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/chris/.emacs.el", O_RDONLY|O_CLOEXEC) =3D -1
ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/chris/.emacs.el.gz", O_RDONLY|O_CLOEXEC) =3D -1
ENOENT (No such file or directory)

But Emacs should only try to load the file once.  The problem is that
the path to ~/.emacs is not expanded before it is handed to `load' and
load basically does:

(dolist (path load-path)
  (low-level-load (expand-file-name "~/.emacs" path)))

where low-level-load is some magic function which really loads a file.
There is off course more going on, like iterating over the extension
and such, but I want to keep it simple, since I am not familiar with
it at all.

`load' does check if the given path is absolute and
changes its behavior.  If the path is absolute, `load' does not take the
load-path into account, but paths beginning with "~/" are not recognized as
beeing absolute, hence the paths should be expanded before passing them
to `load'.

Because all the other paths to init files (early-init.el and init.el)
are expanded before they are passed to `load', I think "~/.emacs"
should be expanded as well.

There is also the question if `load' itself should be able to handle
paths that begin with "~/" correctly, or if the user is expected to
expand paths before passing them to `load'.

Regards, Christoph




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66534; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Oct 2023 12:46:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 14 08:46:26 2023
Received: from localhost ([127.0.0.1]:48105 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qre2C-0004KI-Hj
	for submit <at> debbugs.gnu.org; Sat, 14 Oct 2023 08:46:26 -0400
Received: from lists.gnu.org ([2001:470:142::17]:58994)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <just.mychris@HIDDEN>) id 1qrabK-0008TR-PW
 for submit <at> debbugs.gnu.org; Sat, 14 Oct 2023 05:06:27 -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 <just.mychris@HIDDEN>)
 id 1qraaq-0007Uq-Js
 for bug-gnu-emacs@HIDDEN; Sat, 14 Oct 2023 05:05:56 -0400
Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <just.mychris@HIDDEN>)
 id 1qraap-0002Me-1q
 for bug-gnu-emacs@HIDDEN; Sat, 14 Oct 2023 05:05:56 -0400
Received: by mail-ej1-x631.google.com with SMTP id
 a640c23a62f3a-99c1c66876aso451761566b.2
 for <bug-gnu-emacs@HIDDEN>; Sat, 14 Oct 2023 02:05:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=googlemail.com; s=20230601; t=1697274353; x=1697879153; darn=gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=ehFqExKq2LRK23v/E5qLexApUMovVg5wUnJvWwSkYRw=;
 b=LuKkBKKBn/2Tkr40iQ23baOJhp4hwhW3Lpk6F82wHt7ngd+gW79nuvO6og+Z5bZA6T
 JG4Cg7WRUuHfpqyDj7pw64Fsz5B5cl4r09F1kuYgt+gOiSOvMVP75rz3C3cps07DTBOV
 8Qrm3AyJPFvrJQYnCWVZKNc2O1LHgOMzwekKEixYga4BUeM3wbFuSJqtw/QkMIUZKhlN
 lXbDOer3u7RuouLtKT8ky+YLKuOXPEA0vwJ41q2TtCoabvVUASNQIG6XrakUh1cNZ1ik
 YXYoM/nCxC/ankRWUHxKePea06B66IrBwAvaKFju1aBOoWVIxfnRIoNPkKJRgA0Gd5b3
 +pGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1697274353; x=1697879153;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=ehFqExKq2LRK23v/E5qLexApUMovVg5wUnJvWwSkYRw=;
 b=AulOgWuiy6+B2a3ZuT9QLwXR/ozV5sryUcauFvSa09Cj76T7NGeqLz8HjFQSeoRaLm
 qNaMe+GinE5NwynOdHBT4+xQzJHxot8evqy87AjsXKE6be2OTCL7aYGY1Zl3D1qG2nj2
 /Y6DYSSqnCEttFSHT1usBBwxbYII+EtDf/2XeCzl9IE4lWWNnECyXZ7xtXAhVgmZjGTZ
 9MVenaDjLahHxUqwFIRxI2AbRZtAhyGNCdZt/ZViwhyMJTZDOY4iZiy9KzILsZuIuAR2
 kP9PfRLHvnAALJI3q5VxoNdcTYt2tF6ad7BTYAbKIojm3KN5Ug1QFes2Ar7m6asRqE4R
 az+g==
X-Gm-Message-State: AOJu0YzBto0G9ep//RN2/asKaYtYVm1boOQqJXC6w+Xl7jrFXVyaDitB
 i6NI8jOZnc3uqXkNdIbkYn0godz3j8sOORIElFmf3fX/tkuGHQ==
X-Google-Smtp-Source: AGHT+IGaffvYBEN3GO2813qD0BIjl1vYkoYb17S9MS7ocrSL1XCjStAq8oTo2kFJTE8xv3yz5qBvK/CstqQOoFZGPmM=
X-Received: by 2002:a17:906:6a01:b0:9bd:ac0f:83dc with SMTP id
 qw1-20020a1709066a0100b009bdac0f83dcmr3489373ejc.54.1697274353448; Sat, 14
 Oct 2023 02:05:53 -0700 (PDT)
MIME-Version: 1.0
References: <CAK9rt1qmf-5gP6EXYiMHNw7LwbziUVsstZ-gs=ss8h9NStXVUw@HIDDEN>
 <87cyxhhdhd.fsf@HIDDEN>
In-Reply-To: <87cyxhhdhd.fsf@HIDDEN>
From: Christoph <just.mychris@HIDDEN>
Date: Sat, 14 Oct 2023 11:05:42 +0200
Message-ID: <CAK9rt1o_C8aJs_fDOa0d36_qM7E26=z9B=ruMjsWphGeVhkSKw@HIDDEN>
Subject: Re: bug#66534: 30.0.50; [PATCH] Expand file-name of ~/.emacs before
 attempt to load it
To: Andreas Schwab <schwab@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2a00:1450:4864:20::631;
 envelope-from=just.mychris@HIDDEN; helo=mail-ej1-x631.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-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sat, 14 Oct 2023 08:46:21 -0400
Cc: "Christoph via Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>,
 66534 <at> debbugs.gnu.org
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 (/)

On Sat, Oct 14, 2023 at 9:25=E2=80=AFAM Andreas Schwab <schwab@HIDDEN=
rg> wrote:
>
> On Okt 13 2023, Christoph via "Bug reports for GNU Emacs, the Swiss army =
knife of text editors" wrote:
>
> > I noticed that during startup, emacs tries to load ~/.emacs (with
> > different extensions) many times over.  You can see this by using
> > strace and tracing the openat syscall.  The problem is, that `load'
> > does not expand the ~/ in the filename passed to it.  So it does not
> > recognize the file as being absolute and tries to resolve it using
> > the load-path.
>
> That's probably a bug in complete_filename_p.
>

I am not so sure if complete_filename_p should be able to recognize
these kinds of paths, or if `load' should expand the filename before
using it.  I am not familiar with all supported platforms, but it might
be tricky to check if a filename is absolute, without expanding it
beforehand.

For instance, what about filenames that start with a series of "../".
I guess they should be considered to be absolute, if the path goes up
to the root.

On the other hand, the documentation of `load' does not mention
absolute paths at all and states, This function searches the
directories on `load-path'.  So I can't say what the expected behaviour
of load is with paths that aren't expanded, but are absolute.

I am hesitant with changing the C code, because I am not very familiar
with it and just started to get into it, so I thought it might be more
appropriate to change it on the Lisp side, since all the other paths
to init files are fully expanded before passing them to load.

But yes, as I wrote before, I think this behaviour of load could be
considered a bug as well.

-- Christoph




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66534; Package emacs. Full text available.

Message received at 66534 <at> debbugs.gnu.org:


Received: (at 66534) by debbugs.gnu.org; 14 Oct 2023 07:26:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 14 03:26:21 2023
Received: from localhost ([127.0.0.1]:47750 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qrZ2T-0004w0-MR
	for submit <at> debbugs.gnu.org; Sat, 14 Oct 2023 03:26:21 -0400
Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]:35353)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <whitebox@HIDDEN>) id 1qrZ2P-0004vl-G4
 for 66534 <at> debbugs.gnu.org; Sat, 14 Oct 2023 03:26:20 -0400
Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
 by mail-out.m-online.net (Postfix) with ESMTP id 4S6w002W2Zz1sBqm;
 Sat, 14 Oct 2023 09:25:52 +0200 (CEST)
Received: from localhost (dynscan1.mnet-online.de [192.168.6.68])
 by mail.m-online.net (Postfix) with ESMTP id 4S6vzz71H3z1qqlS;
 Sat, 14 Oct 2023 09:25:51 +0200 (CEST)
X-Virus-Scanned: amavis at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.182])
 by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024)
 with ESMTP id KBk9vdpIcbZH; Sat, 14 Oct 2023 09:25:51 +0200 (CEST)
X-Auth-Info: DZwjL0Ha23tgyHTh8ypxzDQaVqTDMLUn1gtRdcq87AESC1jkJLgu+houIMjoANPA
Received: from igel.home (aftr-62-216-205-242.dynamic.mnet-online.de
 [62.216.205.242])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mail.mnet-online.de (Postfix) with ESMTPSA;
 Sat, 14 Oct 2023 09:25:51 +0200 (CEST)
Received: by igel.home (Postfix, from userid 1000)
 id 067AA2C13A5; Sat, 14 Oct 2023 09:25:50 +0200 (CEST)
From: Andreas Schwab <schwab@HIDDEN>
To: Christoph via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#66534: 30.0.50; [PATCH] Expand file-name of ~/.emacs before
 attempt to load it
In-Reply-To: <CAK9rt1qmf-5gP6EXYiMHNw7LwbziUVsstZ-gs=ss8h9NStXVUw@HIDDEN>
 (Christoph via's message of "Fri, 13 Oct 2023 20:41:16 +0200")
References: <CAK9rt1qmf-5gP6EXYiMHNw7LwbziUVsstZ-gs=ss8h9NStXVUw@HIDDEN>
X-Yow: I put aside my copy of ``BOWLING WORLD'' and think
 about GUN CONTROL legislation..
Date: Sat, 14 Oct 2023 09:25:50 +0200
Message-ID: <87cyxhhdhd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 66534
Cc: 66534 <at> debbugs.gnu.org, Christoph <just.mychris@HIDDEN>
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.5 (-)

On Okt 13 2023, Christoph via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> I noticed that during startup, emacs tries to load ~/.emacs (with
> different extensions) many times over.  You can see this by using
> strace and tracing the openat syscall.  The problem is, that `load'
> does not expand the ~/ in the filename passed to it.  So it does not
> recognize the file as being absolute and tries to resolve it using
> the load-path.

That's probably a bug in complete_filename_p.

-- 
Andreas Schwab, schwab@HIDDEN
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66534; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Oct 2023 07:26:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 14 03:26:35 2023
Received: from localhost ([127.0.0.1]:47753 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qrZ2h-0004wU-02
	for submit <at> debbugs.gnu.org; Sat, 14 Oct 2023 03:26:35 -0400
Received: from lists.gnu.org ([2001:470:142::17]:36856)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <whitebox@HIDDEN>) id 1qrZ2d-0004wB-V6
 for submit <at> debbugs.gnu.org; Sat, 14 Oct 2023 03:26:34 -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 <whitebox@HIDDEN>)
 id 1qrZ28-00061k-F3
 for bug-gnu-emacs@HIDDEN; Sat, 14 Oct 2023 03:26:00 -0400
Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <whitebox@HIDDEN>)
 id 1qrZ25-0003HS-Ba
 for bug-gnu-emacs@HIDDEN; Sat, 14 Oct 2023 03:25:59 -0400
Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
 by mail-out.m-online.net (Postfix) with ESMTP id 4S6w002W2Zz1sBqm;
 Sat, 14 Oct 2023 09:25:52 +0200 (CEST)
Received: from localhost (dynscan1.mnet-online.de [192.168.6.68])
 by mail.m-online.net (Postfix) with ESMTP id 4S6vzz71H3z1qqlS;
 Sat, 14 Oct 2023 09:25:51 +0200 (CEST)
X-Virus-Scanned: amavis at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.182])
 by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024)
 with ESMTP id KBk9vdpIcbZH; Sat, 14 Oct 2023 09:25:51 +0200 (CEST)
X-Auth-Info: DZwjL0Ha23tgyHTh8ypxzDQaVqTDMLUn1gtRdcq87AESC1jkJLgu+houIMjoANPA
Received: from igel.home (aftr-62-216-205-242.dynamic.mnet-online.de
 [62.216.205.242])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mail.mnet-online.de (Postfix) with ESMTPSA;
 Sat, 14 Oct 2023 09:25:51 +0200 (CEST)
Received: by igel.home (Postfix, from userid 1000)
 id 067AA2C13A5; Sat, 14 Oct 2023 09:25:50 +0200 (CEST)
From: Andreas Schwab <schwab@HIDDEN>
To: Christoph via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#66534: 30.0.50; [PATCH] Expand file-name of ~/.emacs before
 attempt to load it
In-Reply-To: <CAK9rt1qmf-5gP6EXYiMHNw7LwbziUVsstZ-gs=ss8h9NStXVUw@HIDDEN>
 (Christoph via's message of "Fri, 13 Oct 2023 20:41:16 +0200")
References: <CAK9rt1qmf-5gP6EXYiMHNw7LwbziUVsstZ-gs=ss8h9NStXVUw@HIDDEN>
X-Yow: I put aside my copy of ``BOWLING WORLD'' and think
 about GUN CONTROL legislation..
Date: Sat, 14 Oct 2023 09:25:50 +0200
Message-ID: <87cyxhhdhd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2001:a60:0:28:0:1:25:1;
 envelope-from=whitebox@HIDDEN; helo=mail-out.m-online.net
X-Spam_score_int: -23
X-Spam_score: -2.4
X-Spam_bar: --
X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9,
 HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_LOW=-0.7,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On Okt 13 2023, Christoph via "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" wrote: > I noticed that during startup, 
 emacs tries to load ~/.emacs (with > different extensions) many times over.
 You can see this by using > strace and tracing the openat syscall. The problem
 is, that `lo [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
 mail domains are different
X-Debbugs-Envelope-To: submit
Cc: 66534 <at> debbugs.gnu.org, Christoph <just.mychris@HIDDEN>
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.2 (/)

On Okt 13 2023, Christoph via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> I noticed that during startup, emacs tries to load ~/.emacs (with
> different extensions) many times over.  You can see this by using
> strace and tracing the openat syscall.  The problem is, that `load'
> does not expand the ~/ in the filename passed to it.  So it does not
> recognize the file as being absolute and tries to resolve it using
> the load-path.

That's probably a bug in complete_filename_p.

-- 
Andreas Schwab, schwab@HIDDEN
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66534; Package emacs. Full text available.

Message received at 66534 <at> debbugs.gnu.org:


Received: (at 66534) by debbugs.gnu.org; 14 Oct 2023 06:54:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 14 02:54:33 2023
Received: from localhost ([127.0.0.1]:47711 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qrYXg-0003yN-Qr
	for submit <at> debbugs.gnu.org; Sat, 14 Oct 2023 02:54:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:46724)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1qrYXd-0003y8-K4
 for 66534 <at> debbugs.gnu.org; Sat, 14 Oct 2023 02:54: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 1qrYXA-0004eP-Qc; Sat, 14 Oct 2023 02:54:00 -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=Ceqq5hYp7WRKbUXS80Lmx4AWLke8SHHHCGwLzKwqB8I=; b=WH3PezK2vwJD
 UhgS62c8cnUuglleQ1vvkwYrVe9dqFsY1P346W20qc5sFhna3p1IqFIAx6wrRUs6+SuwkOB6RYG9o
 vRTcO3rLRVaz+Rdy4jDNvyVGBFYb/l6jTwiqwpfIlb9yAA72uwNRtNH/fYReSP1S83OYPjibDr5i2
 Mz7gTn/pu5JIr7P19mljUQa/S+l0UV/VzPCSTUaPMYgXIig2IbrAdn8cCh52V5iw1YJWxd3ZQt0TT
 xs1lXa9ysAVul/leN7kbKNQuDIzg90W0UfESnOOG1O0Dul0gPpm38CRASDbUlHTvV2Covw6S+2xow
 yWmJ3dDSujB7F33M9lIkfw==;
Date: Sat, 14 Oct 2023 09:54:00 +0300
Message-Id: <83r0lxsnhz.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Christoph <just.mychris@HIDDEN>
In-Reply-To: <CAK9rt1qmf-5gP6EXYiMHNw7LwbziUVsstZ-gs=ss8h9NStXVUw@HIDDEN>
 (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#66534: 30.0.50;
 [PATCH] Expand file-name of ~/.emacs before attempt to load it
References: <CAK9rt1qmf-5gP6EXYiMHNw7LwbziUVsstZ-gs=ss8h9NStXVUw@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66534
Cc: 66534 <at> debbugs.gnu.org
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 (---)

> Date: Fri, 13 Oct 2023 20:41:16 +0200
> From:  Christoph via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> I noticed that during startup, emacs tries to load ~/.emacs (with
> different extensions) many times over.  You can see this by using
> strace and tracing the openat syscall.  The problem is, that `load'
> does not expand the ~/ in the filename passed to it.  So it does not
> recognize the file as being absolute and tries to resolve it using
> the load-path.
> 
> While resolving the path in the openp function in lread.c,
> `expand-file-name' is used with the default directory being the
> elements of the load-path.  Since for `expand-file-name', ~/.emacs is
> an absolute path, it returns the path unchanged, and load tries to
> load ~/.emacs many times over.

I don't understand what you are saying here.  The last sentence is
incorrect, as evidenced by the following:

  (expand-file-name "~/.emacs" "/tmp")
   => "/home/eliz/.emacs"

IOW, "~/.emacs" is indeed treated by Emacs as an absolute file name,
but expand-file-name does NOT return "~/.emacs" unchanged.

So please explain what exactly is the problem you see here, and in
particular what issues that problem causes in your case.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66534; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Oct 2023 01:06:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 13 21:06:24 2023
Received: from localhost ([127.0.0.1]:47594 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qrT6j-0000Fz-5H
	for submit <at> debbugs.gnu.org; Fri, 13 Oct 2023 21:06:24 -0400
Received: from lists.gnu.org ([2001:470:142::17]:44978)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <just.mychris@HIDDEN>) id 1qrN6m-0001gu-EF
 for submit <at> debbugs.gnu.org; Fri, 13 Oct 2023 14:42:01 -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 <just.mychris@HIDDEN>)
 id 1qrN6J-0007lX-KR
 for bug-gnu-emacs@HIDDEN; Fri, 13 Oct 2023 14:41:31 -0400
Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <just.mychris@HIDDEN>)
 id 1qrN6H-0004rf-RL
 for bug-gnu-emacs@HIDDEN; Fri, 13 Oct 2023 14:41:31 -0400
Received: by mail-ej1-x62e.google.com with SMTP id
 a640c23a62f3a-9ad8a822508so390275566b.0
 for <bug-gnu-emacs@HIDDEN>; Fri, 13 Oct 2023 11:41:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=googlemail.com; s=20230601; t=1697222487; x=1697827287; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=jfeXwVsYwEPEtob8o7w51YKa7janekjYDFhEIY/w280=;
 b=SfJjgv0TEGn3d8OPWKRK7f9am/p46dHkVtzWPlpKMtPsh/j3OBD0sVXHvCtC0Gg6od
 zgnmtR0KXJs0HhnNWtFJaA5E8PGubBeiYr9lsf37lxj0Z8JVAWooyHSfyNrKrXq5SFre
 b5WuLkhRAInMTwa7Y7VPkYSBxOVf3UiMKgzmGcqLiiYyFbDdkE3NQb3QtPweW/IsR0db
 KZ/sBX4AJSKZ3D9VSab912smRrzmxHsE99xzViPx5esJ8BwVkLLHGE38WTkrrAjtYnkt
 Db2BA3vozSVthRMKOYPN9wb7jlfYsqyGpoKO+y9ckoJoLnJ9Tap4f9kWHLhtFbhB3RKm
 IIgg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1697222487; x=1697827287;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=jfeXwVsYwEPEtob8o7w51YKa7janekjYDFhEIY/w280=;
 b=u6WWM2sZNfT0iYOKkCQJl63jMcIPlkme5oMtHczkYxXsIsVnbpjtp29NwURkk6DIm/
 8WXL7XwD9WnXuAUCeRP7E2KC5c4HErFP2XWDt27EGNlWM9q5HDxKSsp2hNQRTl9pk0UR
 K4yMY0euKQF4Popihfaxc2AVFq+AGaOHDUMSEVYFhwpCfgdrqGVfar8aqCY+YZpmiY4j
 GUo04Y/KLeK6MU7sZjBGZuIhhzGdOsRUOlMksEcxmObA1kUrEXoMabiRIdzhpDco3Ggu
 Yxgxr66K4ysz4UhmKAJXODoCAity7yue5TQSZDxS/ryGdrXEAk7t8eWqzVeL5uplTNo0
 JfyA==
X-Gm-Message-State: AOJu0YzWZHPRCBvlS0AFjAL5C/cBGICCxK5B9Fdty/LPrN2hHtXQrL85
 j2o5VEEHMWgv4818/eZTv1+axapiAMg4kZWRIqiHnZRwJ/o=
X-Google-Smtp-Source: AGHT+IF1jsmKyG5YJPq7ZYtWyjmMbQKzTtl8n4RG4RosSIVHfor8nDQmsk1eJQHBd8OWtOoZhr0RdF2a4EW70nzpiuE=
X-Received: by 2002:a17:907:7635:b0:9a5:c9a4:ba19 with SMTP id
 jy21-20020a170907763500b009a5c9a4ba19mr25639068ejc.47.1697222487376; Fri, 13
 Oct 2023 11:41:27 -0700 (PDT)
MIME-Version: 1.0
From: Christoph <just.mychris@HIDDEN>
Date: Fri, 13 Oct 2023 20:41:16 +0200
Message-ID: <CAK9rt1qmf-5gP6EXYiMHNw7LwbziUVsstZ-gs=ss8h9NStXVUw@HIDDEN>
Subject: 30.0.50;
 [PATCH] Expand file-name of ~/.emacs before attempt to load it
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/mixed; boundary="000000000000771b0406079d677c"
Received-SPF: pass client-ip=2a00:1450:4864:20::62e;
 envelope-from=just.mychris@HIDDEN; helo=mail-ej1-x62e.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-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 13 Oct 2023 21:06:20 -0400
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 (/)

--000000000000771b0406079d677c
Content-Type: text/plain; charset="UTF-8"

Hi,

I noticed that during startup, emacs tries to load ~/.emacs (with
different extensions) many times over.  You can see this by using
strace and tracing the openat syscall.  The problem is, that `load'
does not expand the ~/ in the filename passed to it.  So it does not
recognize the file as being absolute and tries to resolve it using
the load-path.

While resolving the path in the openp function in lread.c,
`expand-file-name' is used with the default directory being the
elements of the load-path.  Since for `expand-file-name', ~/.emacs is
an absolute path, it returns the path unchanged, and load tries to
load ~/.emacs many times over.  I am not sure if the behavior of
`load' should also be considered a bug, but since all the other paths
of init files are resolved using `expand-file-name', I guess the same
should be done for the ~/.emacs path as well.

-- Christoph

--000000000000771b0406079d677c
Content-Type: text/x-patch; charset="US-ASCII"; 
	name="0001-Expand-file-name-of-.emacs-before-attempt-to-load-it.patch"
Content-Disposition: attachment; 
	filename="0001-Expand-file-name-of-.emacs-before-attempt-to-load-it.patch"
Content-Transfer-Encoding: base64
Content-ID: <f_lnoyefzu0>
X-Attachment-Id: f_lnoyefzu0

RnJvbSA0MmJjNDI4NDcwZjBiNjkwN2NmYzgxNzE4ZjM1MDgzYTJkZjMwZDEyIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/Q2hyaXN0b3BoPTIwRz1DMz1CNnR0c2Noa2Vz
Pz0gPGp1c3QubXljaHJpc0Bnb29nbGVtYWlsLmNvbT4KRGF0ZTogRnJpLCAxMyBPY3QgMjAyMyAy
MDoxOTo0OCArMDIwMApTdWJqZWN0OiBbUEFUQ0hdIEV4cGFuZCBmaWxlLW5hbWUgb2Ygfi8uZW1h
Y3MgYmVmb3JlIGF0dGVtcHQgdG8gbG9hZCBpdC4KCiogbGlzcC9zdGFydHVwLmVsIChjb21tYW5k
LWxpbmUpOgpFeHBhbmQgdGhlIG5hbWUgb2YgdGhlIH4vLmVtYWNzIChvciBpdHMgb3RoZXIgdmFy
aWFudCkKaW5pdGlhbGl6YXRpb24gZmlsZS1uYW1lIGJlZm9yZSBwYXNzaW5nIHRoZSBhYnNvbHV0
ZSBwYXRoIHRvIGxvYWQuCk90aGVyd2lzZSwgbG9hZCBkb2VzIG5vdCByZWNvZ25pemUgdGhlIHBh
dGggdG8gYmUgYWJzb2x1dGUgYW5kIHVzZXMgdGhlCmxvYWQtcGF0aCB0byBmaW5kIHRoZSBmaWxl
LgotLS0KIGxpc3Avc3RhcnR1cC5lbCB8IDQwICsrKysrKysrKysrKysrKysrKysrKy0tLS0tLS0t
LS0tLS0tLS0tLS0KIDEgZmlsZSBjaGFuZ2VkLCAyMSBpbnNlcnRpb25zKCspLCAxOSBkZWxldGlv
bnMoLSkKCmRpZmYgLS1naXQgYS9saXNwL3N0YXJ0dXAuZWwgYi9saXNwL3N0YXJ0dXAuZWwKaW5k
ZXggNjMyOWUzZWE4ZDAuLjczZTI3NDM5ZTUwIDEwMDY0NAotLS0gYS9saXNwL3N0YXJ0dXAuZWwK
KysrIGIvbGlzcC9zdGFydHVwLmVsCkBAIC0xNDkzLDI1ICsxNDkzLDI3IEBAIGNvbW1hbmQtbGlu
ZQogICAgIDs7IExvYWQgdGhhdCB1c2VyJ3MgaW5pdCBmaWxlLCBvciB0aGUgZGVmYXVsdCBvbmUs
IG9yIG5vbmUuCiAgICAgKHN0YXJ0dXAtLWxvYWQtdXNlci1pbml0LWZpbGUKICAgICAgKGxhbWJk
YSAoKQotICAgICAgIChjb25kCi0JKChlcSBzdGFydHVwLWluaXQtZGlyZWN0b3J5IHhkZy1kaXIp
IG5pbCkKLSAgICAgICAgKChlcSBzeXN0ZW0tdHlwZSAnbXMtZG9zKQotICAgICAgICAgKGNvbmNh
dCAifiIgaW5pdC1maWxlLXVzZXIgIi9fZW1hY3MiKSkKLSAgICAgICAgKChub3QgKGVxIHN5c3Rl
bS10eXBlICd3aW5kb3dzLW50KSkKLSAgICAgICAgIChjb25jYXQgIn4iIGluaXQtZmlsZS11c2Vy
ICIvLmVtYWNzIikpCi0gICAgICAgIDs7IEVsc2UgZGVhbCB3aXRoIHRoZSBXaW5kb3dzIHNpdHVh
dGlvbi4KLSAgICAgICAgKChkaXJlY3RvcnktZmlsZXMgIn4iIG5pbCAiXFxgXFwuZW1hY3NcXChc
XC5lbGM/XFwpP1xcJyIpCi0gICAgICAgICA7OyBQcmVmZXIgLmVtYWNzIG9uIFdpbmRvd3MuCi0g
ICAgICAgICAifi8uZW1hY3MiKQotICAgICAgICAoKGRpcmVjdG9yeS1maWxlcyAifiIgbmlsICJc
XGBfZW1hY3NcXChcXC5lbGM/XFwpP1xcJyIpCi0gICAgICAgICA7OyBBbHNvIHN1cHBvcnQgX2Vt
YWNzIGZvciBjb21wYXRpYmlsaXR5LCBidXQgd2FybiBhYm91dCBpdC4KLSAgICAgICAgIChwdXNo
IGAoaW5pdGlhbGl6YXRpb24KLSAgICAgICAgICAgICAgICAgLChmb3JtYXQtbWVzc2FnZQotICAg
ICAgICAgICAgICAgICAgICJgX2VtYWNzJyBpbml0IGZpbGUgaXMgZGVwcmVjYXRlZCwgcGxlYXNl
IHVzZSBgLmVtYWNzJyIpKQotICAgICAgICAgICAgICAgZGVsYXllZC13YXJuaW5ncy1saXN0KQot
ICAgICAgICAgIn4vX2VtYWNzIikKLSAgICAgICAgKHQgOzsgQnV0IGRlZmF1bHQgdG8gLmVtYWNz
IGlmIF9lbWFjcyBkb2VzIG5vdCBleGlzdC4KLSAgICAgICAgICJ+Ly5lbWFjcyIpKSkKKyAgICAg
ICAoaWYgKGVxIHN0YXJ0dXAtaW5pdC1kaXJlY3RvcnkgeGRnLWRpcikKKyAgICAgICAgICAgbmls
CisgICAgICAgICAoZXhwYW5kLWZpbGUtbmFtZQorICAgICAgICAgIChjb25kCisgICAgICAgICAg
ICgoZXEgc3lzdGVtLXR5cGUgJ21zLWRvcykKKyAgICAgICAgICAgIChjb25jYXQgIn4iIGluaXQt
ZmlsZS11c2VyICIvX2VtYWNzIikpCisgICAgICAgICAgICgobm90IChlcSBzeXN0ZW0tdHlwZSAn
d2luZG93cy1udCkpCisgICAgICAgICAgICAoY29uY2F0ICJ+IiBpbml0LWZpbGUtdXNlciAiLy5l
bWFjcyIpKQorICAgICAgICAgICA7OyBFbHNlIGRlYWwgd2l0aCB0aGUgV2luZG93cyBzaXR1YXRp
b24uCisgICAgICAgICAgICgoZGlyZWN0b3J5LWZpbGVzICJ+IiBuaWwgIlxcYFxcLmVtYWNzXFwo
XFwuZWxjP1xcKT9cXCciKQorICAgICAgICAgICAgOzsgUHJlZmVyIC5lbWFjcyBvbiBXaW5kb3dz
LgorICAgICAgICAgICAgIn4vLmVtYWNzIikKKyAgICAgICAgICAgKChkaXJlY3RvcnktZmlsZXMg
In4iIG5pbCAiXFxgX2VtYWNzXFwoXFwuZWxjP1xcKT9cXCciKQorICAgICAgICAgICAgOzsgQWxz
byBzdXBwb3J0IF9lbWFjcyBmb3IgY29tcGF0aWJpbGl0eSwgYnV0IHdhcm4gYWJvdXQgaXQuCisg
ICAgICAgICAgICAocHVzaCBgKGluaXRpYWxpemF0aW9uCisgICAgICAgICAgICAgICAgICAgICwo
Zm9ybWF0LW1lc3NhZ2UKKyAgICAgICAgICAgICAgICAgICAgICAiYF9lbWFjcycgaW5pdCBmaWxl
IGlzIGRlcHJlY2F0ZWQsIHBsZWFzZSB1c2UgYC5lbWFjcyciKSkKKyAgICAgICAgICAgICAgICAg
IGRlbGF5ZWQtd2FybmluZ3MtbGlzdCkKKyAgICAgICAgICAgICJ+L19lbWFjcyIpCisgICAgICAg
ICAgICh0IDs7IEJ1dCBkZWZhdWx0IHRvIC5lbWFjcyBpZiBfZW1hY3MgZG9lcyBub3QgZXhpc3Qu
CisgICAgICAgICAgICAifi8uZW1hY3MiKSkpKSkKICAgICAgKGxhbWJkYSAoKQogICAgICAgIChl
eHBhbmQtZmlsZS1uYW1lCiAgICAgICAgICJpbml0LmVsIgotLSAKMi40Mi4wCgo=
--000000000000771b0406079d677c--




Acknowledgement sent to Christoph <just.mychris@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#66534; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 14 Oct 2023 13:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.