* bug#28244: 26.0.50; byte-compiled files have mode 0600
@ 2017-08-26 20:13 Sven Joachim
2017-08-27 6:10 ` Paul Eggert
0 siblings, 1 reply; 2+ messages in thread
From: Sven Joachim @ 2017-08-26 20:13 UTC (permalink / raw)
To: 28244; +Cc: Sven Joachim
I have observed that byte-compiled files have permissions 0600,
regardless of the umask (mine is 022). This is bad, especially for
system-wide installations.
Looking at the lisp/ directory, this has started between August 2 and
August 8 this year.
,----
| -rw------- 1 sven src 82133 Aug 8 17:15 replace.elc
| -rw------- 1 sven src 23081 Aug 8 17:15 ls-lisp.elc
| -rw-r--r-- 1 sven src 70177 Aug 2 11:36 whitespace.elc
| -rw-r--r-- 1 sven src 3546 Aug 2 11:36 password-cache.elc
`----
Commit 785a4a1d52fd ("Fix a couple of make-temp-file races") is likely
the culprit, but I haven't verified that.
In GNU Emacs 26.0.50 (build 2, i686-pc-linux-gnu, GTK+ Version 2.24.31)
of 2017-08-26 built on turtle
Repository revision: cc7530cae09b0aa4d648d92ca0f82c81439a6b34
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
System Description: Debian GNU/Linux
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Compiling /tmp/strokes.el...done
Wrote /tmp/strokes.elc
Configured using:
'configure --build i686-linux-gnu --host i686-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var
--infodir=/usr/share/info/emacs-snapshot --mandir=/usr/share/man
--without-pop
--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/26.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.0.50/site-lisp:/usr/share/emacs/site-lisp
--without-wide-int --disable-silent-rules --without-compress-install
--with-x=yes --with-x-toolkit=gtk2 --without-gconf --without-gsettings
build_alias=i686-linux-gnu host_alias=i686-linux-gnu 'CFLAGS=-g -O2
-fdebug-prefix-map=/usr/local/src/emacs=. -fstack-protector-strong
-Wformat -Werror=format-security' 'LDFLAGS=-Wl,-z,relro
-Wl,--as-needed' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2 -DDEBIAN
-DSITELOAD_PURESIZE_EXTRA=5000''
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS NOTIFY ACL
LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 LIBSYSTEMD
Important settings:
value of $LC_COLLATE: C
value of $LANG: de_DE.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
shell-dirtrack-mode: t
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message subr-x puny seq dired
dired-loaddefs rfc822 mml easymenu mml-sec epa derived epg epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils easy-mmode compile tramp
tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete
comint ansi-color ring parse-time format-spec advice auth-source cl-seq
eieio byte-opt eieio-core cl-macs gv eieio-loaddefs password-cache
bytecomp byte-compile cl-loaddefs cl-lib cconv elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar 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 dbusbind inotify
dynamic-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)
Memory information:
((conses 8 222247 10475)
(symbols 24 22368 2)
(miscs 20 47 151)
(strings 16 35213 2713)
(string-bytes 1 1000149)
(vectors 8 38737)
(vector-slots 4 768883 14334)
(floats 8 55 61)
(intervals 28 263 2)
(buffers 528 12))
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#28244: 26.0.50; byte-compiled files have mode 0600
2017-08-26 20:13 bug#28244: 26.0.50; byte-compiled files have mode 0600 Sven Joachim
@ 2017-08-27 6:10 ` Paul Eggert
0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2017-08-27 6:10 UTC (permalink / raw)
To: Sven Joachim; +Cc: 28244-done
[-- Attachment #1: Type: text/plain, Size: 147 bytes --]
Thanks for reporting that bug. It was indeed an unintended consequence of my
earlier change. I installed the attached patch, which should fix it.
[-- Attachment #2: 0001-Fix-over-protection-of-byte-compiled-files.patch --]
[-- Type: text/x-patch, Size: 2672 bytes --]
From 7207e4a3d533d959eebbb947235f741b1586722b Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 26 Aug 2017 23:07:01 -0700
Subject: [PATCH] Fix over-protection of byte-compiled files
Problem reported by Sven Joachim (Bug#28244).
Also, fix similar problem for autoload files.
* lisp/emacs-lisp/autoload.el (autoload--save-buffer):
Set temp file modes to the buffer-file-name file modes (or 666
if not available) as adjusted by umask.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file):
Set temp file modes to 666 as adjusted by umask.
---
lisp/emacs-lisp/autoload.el | 8 +++++++-
lisp/emacs-lisp/bytecomp.el | 5 +++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 4a9bd6d..e811ee2 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -873,12 +873,18 @@ autoload-generate-file-autoloads
;; For parallel builds, to stop another process reading a half-written file.
(defun autoload--save-buffer ()
"Save current buffer to its file, atomically."
- ;; Copied from byte-compile-file.
+ ;; Similar to byte-compile-file.
(let* ((version-control 'never)
(tempfile (make-temp-file buffer-file-name))
+ (default-modes (default-file-modes))
+ (temp-modes (logand default-modes #o600))
+ (desired-modes (logand default-modes
+ (or (file-modes buffer-file-name) #o666)))
(kill-emacs-hook
(cons (lambda () (ignore-errors (delete-file tempfile)))
kill-emacs-hook)))
+ (unless (= temp-modes desired-modes)
+ (set-file-modes tempfile desired-modes))
(write-region (point-min) (point-max) tempfile nil 1)
(backup-buffer)
(rename-file tempfile buffer-file-name t))
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index d769a15..48bbd61 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1896,10 +1896,15 @@ byte-compile-file
;; parallel bootstrap), it does not risk getting a
;; half-finished file. (Bug#4196)
(tempfile (make-temp-file target-file))
+ (default-modes (default-file-modes))
+ (temp-modes (logand default-modes #o600))
+ (desired-modes (logand default-modes #o666))
(kill-emacs-hook
(cons (lambda () (ignore-errors
(delete-file tempfile)))
kill-emacs-hook)))
+ (unless (= temp-modes desired-modes)
+ (set-file-modes tempfile desired-modes))
(write-region (point-min) (point-max) tempfile nil 1)
;; This has the intentional side effect that any
;; hard-links to target-file continue to
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-27 6:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-26 20:13 bug#28244: 26.0.50; byte-compiled files have mode 0600 Sven Joachim
2017-08-27 6:10 ` Paul Eggert
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.