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: Tino Calancha
Subject: bug#28875: 25.3.50; set-default-file-modes ignores execution bits
Date: Tue, 17 Oct 2017 23:25:07 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)



On Tue, 17 Oct 2017, Andreas Schwab wrote:

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.

Thank you for th enice explanation.  I understand now.
I think I was fooled by the docstring of `set-default-file-modes':
"Set the file permission bits for newly created files..."

I thought that setting will be used by the functions in my snippet.





reply via email to

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