🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.vm.bug
Article #119

Re: VM problem?

#119
From: Eyvind Ness
Date: Wed, 11 Nov 1992 08:10
68 lines
2924 bytes
  | Date: Tue, 10 November 1992, 22:30 GMT
  | From: Gilbert Harman
  |
  | In checking whether my INBOX~ folder was global readable, I
  | discovered it was not but that almost all my vm folders are
  | readable, no doubt because my umask is 022.  Is there a way
  | to get new vm folders not to be global readable if I want my
  | permissions to be more permissive for most new files?

How about utilising GNU Emacs' write-file-hooks variable:

(setq vm-mode-hooks '(vm-mode-init))

(defun vm-mode-init ()
  (our-mail-mode-local-variables)
  ;; From bottom of vm.el:
  (or (memq 'vm-write-file-hook write-file-hooks)
      (setq write-file-hooks
	    (cons 'vm-write-file-hook write-file-hooks))))

(defun our-mail-mode-local-variables ()
  (make-local-variable 'make-backup-files)
  (make-local-variable 'write-file-hooks)
  (setq write-file-hooks '(mail-chmod-exit-hook))
  (setq make-backup-files nil))

(defun mail-chmod-exit-hook ()
  (condition-case c
      (prog1 t
	(let* ((write-file-hooks nil)	;ignore other hooks
	       (cmd2 "/bin/chgrp")
	       (options2 "other")
	       (umask ?\37)		;octal - strip off last 5 bits
	       (file (buffer-file-name))
	       (modes (file-modes file)))
	  (set-file-modes file (logand modes (lognot umask)))
	  (save-buffer)
	  ;; NB! no hooks for save-buffer - otherwise a recursive call.
	  ;; For NFS backups - make sure root has read access:
	  (call-process cmd2 nil nil nil options2 file)))
    (error
     ;; Make sure we always return nil if this code crashes so that other
     ;; write-file-hooks get called.
     (prog1 nil
       (message "%s" c) (sit-for 5)))))


I have the same umask as you have, 022, but this does not affect the
above code at all (in fact it uses #'set-file-modes to explicitly set
the folder permissions).

Hope this helps.

Cheers,
Eyvind.


~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
  Eyvind Ness         Internet: Eyvind.Ness@HRP.No
  Research Scientist  Voicenet: +47 9 183100 ext. 275
  CRS Division        Faxnet:   +47 9 187109
  OECD HRP            Papernet: PO Box 173, N-1751 Halden, Norway

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

- Listen, I know that your friends are my friends and vice versa. I've
thought about that. You can have them.
	(Bret Easton Ellis, American Psycho)
Technical Details
Message-ID: <9211110811.AA08539@dole.hrp.no>
Path: arc1-ca.pugleaf.net!sparky!uunet!wendy-fate.uu.net!bug-vm

Show Full Headers
Complete Article Headers
x-gateway: rodan.UU.NET from bug-vm to gnu.emacs.vm.bug; Wed, 11 Nov 1992 03:10:51 EST
From: eyvind.ness@hrp.no (Eyvind Ness)
Posted-Date: Wed, 11 Nov 92 8:11 GMT
Received-Date: Wed, 11 Nov 92 09:10:37 +0100
Message-ID: <9211110811.AA08539@dole.hrp.no>
Reply-To: Eyvind.Ness@hrp.no
Subject: Re: VM problem?
X-Mailer: GNU Emacs 18.58.20 with VM 5.21 (beta)
Date: Wed, 11 Nov 1992 08:10:53 GMT
Newsgroups: gnu.emacs.vm.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!wendy-fate.uu.net!bug-vm
Sender: bug-vm-request@uunet.uu.net
Lines: 68