From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Nicolas =?UTF-8?Q?B=C3=A9rtolo?= Newsgroups: gmane.emacs.bugs Subject: bug#41242: Port feature/native-comp to Windows Date: Wed, 20 May 2020 12:46:32 -0300 Message-ID: References: <834ksi60zn.fsf@gnu.org> <83k11e4a0s.fsf@gnu.org> <83blmp4tob.fsf@gnu.org> <83o8qp1hfr.fsf@gnu.org> <837dxcv1po.fsf@gnu.org> <83imgvdf94.fsf@gnu.org> <83eerjde6k.fsf@gnu.org> <83a7227hkb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a212dc05a6164d55" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="118514"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41242@debbugs.gnu.org, Andrea Corallo To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 20 17:47:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbQw4-000UiM-Jy for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 May 2020 17:47:12 +0200 Original-Received: from localhost ([::1]:35084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbQw3-00006F-Ki for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 May 2020 11:47:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbQvu-0008Vk-U2 for bug-gnu-emacs@gnu.org; Wed, 20 May 2020 11:47:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jbQvu-0008Sg-JD for bug-gnu-emacs@gnu.org; Wed, 20 May 2020 11:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jbQvu-0004qH-Hu for bug-gnu-emacs@gnu.org; Wed, 20 May 2020 11:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas =?UTF-8?Q?B=C3=A9rtolo?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 May 2020 15:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41242 X-GNU-PR-Package: emacs Original-Received: via spool by 41242-submit@debbugs.gnu.org id=B41242.158998961218594 (code B ref 41242); Wed, 20 May 2020 15:47:02 +0000 Original-Received: (at 41242) by debbugs.gnu.org; 20 May 2020 15:46:52 +0000 Original-Received: from localhost ([127.0.0.1]:54061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbQvk-0004pp-BH for submit@debbugs.gnu.org; Wed, 20 May 2020 11:46:52 -0400 Original-Received: from mail-oi1-f175.google.com ([209.85.167.175]:32820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbQvj-0004pd-9g for 41242@debbugs.gnu.org; Wed, 20 May 2020 11:46:51 -0400 Original-Received: by mail-oi1-f175.google.com with SMTP id o24so3369825oic.0 for <41242@debbugs.gnu.org>; Wed, 20 May 2020 08:46:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=V7xESXowtRSy5CPAHvw5PUYQ+6akIVyQE/fjqXm1/hE=; b=Pv59PKfkxs5XYABcVCpIx5Z2NkRxG04dDSTeXmbBqHctkRbTQwKoWM5AhsXJVD/qj6 9tRr6ayQwkgubD+wIdlgGxKf375jFjLwgBkVNXf5sTE2Az8rQLeJ6+F5uvpvSIIGEO02 3SRX1EL9VgH1VYTSSQZ3+L3t9GH0MOT3QfrSKQpXkORzFFGEZPRmYhUR0wJZEtFK/Goe bB3BSMtVxzZx0svNTKIu8Jcki8cc7mgVlcLR3JETk4wKexdFFHy8YpEWxGe84+oIRuD5 i+AxGm6r7PJaeuZeZEBsUSy0NqrdAlY+cAH7t7jvnc1hsF+6Yia6il5LlqWz8+lSHRuk OdkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V7xESXowtRSy5CPAHvw5PUYQ+6akIVyQE/fjqXm1/hE=; b=Oc+kOq7hZdGgHuksL91wvvmnEB6F88LJ8Kp1iht9nayj2nNmgqw7H112134hBluxhO EHb7znvrv1LopDNpp813+6Vh0T85nwmG3BmSRvr6SCkyYsxMEdt086WorQuUDx5Kkzwi XcIASf5xewhKZTZz1scZAvkfyI/E5HutGgUPckuGu//ZH4kU6EgdtbakffiBZAVruIdp DID9xurS9rzgUXH53nCgeyHIrJb+ixQSXrB88R2YdU7qfTnKwuE1Kvzk2IvvrC4tCnzK 9OPck7bMRg8ckwROBrHULp/qrNp31jJtfHAJAlQkkm31UFV7KNVVrvb2BsJhBOarq4w4 e4CA== X-Gm-Message-State: AOAM532UMF+6sA7grs4+4/JpymRic+J9s6JwORCvFGqq/kLF03kPmi3x kDwq6pwGenhD6yEogER66NEC4dQQnyRiIoLJd1g= X-Google-Smtp-Source: ABdhPJwbDWNRt8y3agj8pVgxa+U8NWmkv1TOGxc+ov+d4/hfsglDO0btg6RSZR5w3hSiio0GNxERfuF8vhZCJU9TDOE= X-Received: by 2002:a54:4701:: with SMTP id k1mr3577408oik.175.1589989605509; Wed, 20 May 2020 08:46:45 -0700 (PDT) In-Reply-To: <83a7227hkb.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180661 Archived-At: --000000000000a212dc05a6164d55 Content-Type: text/plain; charset="UTF-8" > Can you explain what problem this solves, and how? It is especially > important to understand when will be emacs_root_dir first called > during a session. That's because it calls filename_from_ansi, which > AFAIR needs some setup that happens at the beginning of a session. When loading a dump file that contains native compiled elisp we try to find the .eln file. This uses Ffile_exists_p(). This function, in turn, calls Fexpand_file_name(). This function will use the root directory as `default_directory' as a fallback. Getting the root directory requires reading the $emacs_dir environment variable. This is setup later in the initialization process. This caused a crash. Fexpand_file_name() was trying to obtain the root directory even when it was not necessary because `default-directory' was not nil. My patch makes sure that this only happens when necessary. It turns out that the dump loading process does not set `default-directory' to nil, therefore Fexpand_file_name() does not need to find out the root directory and we avoid reading an environment variable that is not set yet. With this patch we avoid calling filename_from_ansi() too early (It is not the reason why Emacs crashed, but it is still a good idea to call it after it has been setup properly. Nico --000000000000a212dc05a6164d55 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> Can you explain what problem this solves, and how?=C2= =A0 It is especially
> important to understand when will be emacs_roo= t_dir first called
> during a session.=C2=A0 That's because it ca= lls filename_from_ansi, which
> AFAIR needs some setup that happens a= t the beginning of a session.

When loading a dump file that contains= native compiled elisp we try to find the
.eln file. This uses Ffile_exi= sts_p(). This function, in turn, calls
Fexpand_file_name(). This functio= n will use the root directory as
`default_directory' as a fallback.<= br>
Getting the root directory requires reading the $emacs_dir environme= nt variable.
This is setup later in the initialization process. This cau= sed a crash.

Fexpand_file_name() was trying to obtain the root direc= tory even when it was not
necessary because `default-directory' was = not nil. My patch makes sure that this
only happens when necessary.
<= br>It turns out that the dump loading process does not set `default-directo= ry' to
nil, therefore Fexpand_file_name() does not need to find out = the root directory
and we avoid reading an environment variable that is = not set yet.

With this patch we avoid calling filename_from_ansi() t= oo early (It is not the
reason why Emacs crashed, but it is still a good= idea to call it after it has
been setup properly.

Nico
--000000000000a212dc05a6164d55--