bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28875: 25.3.50; set-default-file-modes ignores execution bits


From: Andreas Schwab
Subject: bug#28875: 25.3.50; set-default-file-modes ignores execution bits
Date: Tue, 17 Oct 2017 16:03:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

On Okt 17 2017, Tino Calancha <tino.calancha@gmail.com> wrote:

> emacs -Q:
> (let ((foo (make-temp-file "foo")) mode)
>   (with-file-modes #o755 (write-region "" nil foo nil 0))
>   ;; (set-file-modes foo #o755)
>   (setq mode (nth 8 (file-attributes foo)))
>   (delete-file foo) mode)
> => "-rw-------"
>
> To set foo file permissions to "-rwxr-xr-x" I need uncomment
> (set-file-modes foo #o755) above.
> Why? Is for security reasons?

make-temp-file already creates the file (with restrictive modes), so
with-file-modes has no effect (write-region does not change the mode of
existing files).  But write-region also never sets the x bits in the
first place, it uses #o666 as the base mode.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





reply via email to

[Prev in Thread] Current Thread [Next in Thread]