Subject: bug#37445: closed (Re: bug#37445: 27.0.50; Permission denied after make install)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 19 Sep 2019 06:58:02 +0000

Your bug report

#37445: 27.0.50; Permission denied after make install

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
37445: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=37445
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#37445: 27.0.50; Permission denied after make install
From: Paul Eggert <[email-masked]>
To: Tino Calancha <[email-masked]>
Cc: [email-masked]
Date: Wed, 18 Sep 2019 23:57:23 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

I installed the attached patch, which should fix the bug even when PICKY_EACCES 
is nonzero. Boldly closing the bug report.
>From dff4f9c759f5cf19047719716ea5ee8ffdc3006e Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Wed, 18 Sep 2019 23:53:46 -0700
Subject: [PATCH] Omit some overenthusiastic file-truename calls

Problem reported by Tino Calancha (Bug#37445).
* src/emacs.c (init_cmdargs): Call file-truename only if
needed, i.e., if invocation-directory ends in "/i386/" on
WINDOWSNT.
* src/lread.c (readevalloop): If the sourcename is not
absolute, make it absolute.  There is no need to convert
non-absolute files into truenames, since absolute files are
not converted into truenames.
(init_lread): Do not convert source-directory into a truename
at startup.  There is no need to do so in a dumped Emacs since
an absolute file name suffices.  The source directory might
not even exist any more, or might have been replaced by an
interloper who takes advantage of the truename calculation.
(syms_of_lread): Remove Qfile_truename; no longer needed.
---
 src/emacs.c | 14 +++++++++-----
 src/lread.c | 11 +++--------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/emacs.c b/src/emacs.c
index eb732810db..8a8d8b558e 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -479,9 +479,6 @@ init_cmdargs (int argc, char **argv, int skip_args, char const *original_pwd)
 
   if (!NILP (Vinvocation_directory))
     {
-      if (NILP (Vpurify_flag) && !NILP (Ffboundp (Qfile_truename)))
-        Vinvocation_directory = call1 (Qfile_truename, Vinvocation_directory);
-
       dir = Vinvocation_directory;
 #ifdef WINDOWSNT
       /* If we are running from the build directory, set DIR to the
@@ -490,8 +487,15 @@ init_cmdargs (int argc, char **argv, int skip_args, char const *original_pwd)
       if (SBYTES (dir) > sizeof ("/i386/") - 1
 	  && 0 == strcmp (SSDATA (dir) + SBYTES (dir) - sizeof ("/i386/") + 1,
 			  "/i386/"))
-	dir = Fexpand_file_name (build_string ("../.."), dir);
-#else  /* !WINDOWSNT */
+	{
+	  if (NILP (Vpurify_flag))
+	    {
+	      Lisp_Object file_truename = intern ("file-truename");
+	      if (!NILP (Ffboundp (file_truename)))
+		dir = call1 (file_truename, dir);
+	    }
+	  dir = Fexpand_file_name (build_string ("../.."), dir);
+	}
 #endif
       name = Fexpand_file_name (Vinvocation_name, dir);
       while (1)
diff --git a/src/lread.c b/src/lread.c
index 99e0ce30ba..4f3446b09d 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1999,11 +1999,10 @@ readevalloop (Lisp_Object readcharfun,
 	    (NILP (lex_bound) || EQ (lex_bound, Qunbound)
 	     ? Qnil : list1 (Qt)));
 
-  /* Try to ensure sourcename is a truename, except whilst preloading.  */
+  /* Ensure sourcename is absolute, except whilst preloading.  */
   if (!will_dump_p ()
-      && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename))
-      && !NILP (Ffboundp (Qfile_truename)))
-    sourcename = call1 (Qfile_truename, sourcename) ;
+      && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename)))
+    sourcename = Fexpand_file_name (sourcename, Qnil);
 
   LOADHIST_ATTACH (sourcename);
 
@@ -4678,9 +4677,6 @@ load_path_default (void)
 void
 init_lread (void)
 {
-  if (NILP (Vpurify_flag) && !NILP (Ffboundp (Qfile_truename)))
-    Vsource_directory = call1 (Qfile_truename, Vsource_directory);
-
   /* First, set Vload_path.  */
 
   /* Ignore EMACSLOADPATH when dumping.  */
@@ -5100,7 +5096,6 @@ this variable will become obsolete.  */);
   DEFSYM (Qload, "load");
   DEFSYM (Qload_file_name, "load-file-name");
   DEFSYM (Qeval_buffer_list, "eval-buffer-list");
-  DEFSYM (Qfile_truename, "file-truename");
   DEFSYM (Qdir_ok, "dir-ok");
   DEFSYM (Qdo_after_load_evaluation, "do-after-load-evaluation");
 
-- 
2.17.1

Subject: 27.0.50; Permission denied after make install
From: Tino Calancha <[email-masked]>
To: [email-masked]
Date: Wed, 18 Sep 2019 09:02:25 +0000 (UTC)
List-Id: <debbugs-submit.debbugs.gnu.org>

X-Debbugs-Cc: Paul Eggert <[email-masked]>

I get a permission denied error
after commit 9dc306b1db08196684d05a474148e16305adbad0

The following steps reproduce the error (you need 2 users to test it)

# Install Emacs w/ the first user
$ whoami
ec2-user
$ cd ~/soft/emacs-master
$ make && sudo make install
# Launch Emasc w/ the second user
$ su user_foo
$ cd
$ emacs
emacs: Reading symbolic link: Permission denied, /home/ec2-user/soft

In GNU Emacs 27.0.50 (build 8, x86_64-pc-linux-gnu)
  of 2019-09-18 built
Repository revision: 9dc306b1db08196684d05a474148e16305adbad0
Repository branch: master
System Description: Amazon Linux 2

Recent messages:
For information about GNU Emacs and the GNU system, type C-? C-a.
C-x C-g is undefined
Omitting...
(Nothing to omit)
Omitting...
Omitted 2 lines.
Collecting branch info...done
Pull from remote repository 'origin'? (y or n) y
Collecting branch info...done
git pull origin done!

Configured using:
  'configure --with-libxml2'

Configured features:
SOUND NOTIFY INOTIFY LIBSELINUX GNUTLS LIBXML2 ZLIB THREADS PDUMPER GMP

Important settings:
   value of $LANG: en_US.UTF-8
   locale-coding-system: utf-8-unix

Major mode: Gited

Minor modes in effect:
   shell-dirtrack-mode: t
   display-time-mode: t
   winner-mode: t
   simpleclip-mode: t
   show-paren-mode: t
   minibuffer-depth-indicate-mode: t
   gited-hide-details-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   electric-indent-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   buffer-read-only: t
   line-number-mode: t
   transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug shell mule-util cl-extra term/xterm
xterm server manoj-dark-theme time smtpmail sendmail bookmark+
bookmark+-key bookmark+-1 gnus-sum url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap shr image
svg dom gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source utf7 netrc nnoo parse-time iso8601 gnus-spec gnus-int
gnus-range message rmc puny rfc822 mml mml-sec epa derived epg
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader gnus-win bookmark+-bmu org-element avl-tree
generator help-mode org advice org-macro org-footnote org-pcomplete
pcomplete org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs format-spec
cal-menu calendar cal-loaddefs bookmark+-lit bookmark+-mac bookmark pp
misc emacs-lock winner xml git-handlers pcase ibuf-macs dired-x
dired-aux usl rect ibuffer ibuffer-loaddefs thingatpt simpleclip edmacro
kmacro cl paren mb-depth grep compile comint regexp-opt ansi-color ring
gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
text-property-search time-date mail-utils mm-util mail-prsvr wid-edit
cus-start cus-load gited find-func vc-git diff-mode easy-mmode dired
dired-loaddefs gited-ci finder-inf info tool-bar package easymenu
browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type tabulated-list
replace newcomment text-mode elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow isearch timer select mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads inotify
multi-tty make-network-process emacs)

Memory information:
((conses 16 290467 26391)
  (symbols 48 24391 2)
  (strings 32 75778 2373)
  (string-bytes 1 2664995)
  (vectors 16 29579)
  (vector-slots 8 317353 13828)
  (floats 8 235 339)
  (intervals 56 616 91)
  (buffers 992 15))