On 13Jun15 22:55 -0700, Ian Zimmerman wrote:
> On 2015-06-13 21:59 -0700, Tom Fowle wrote:
> 
> Tom> I often save individual incomming emails in seperate files in my
> Tom> home directory with the mutt "s" command.  In any session, the
> Tom> first time I save to a particular file it goes fine.  However if I
> Tom> try to save another message to the same file, I get "Permission
> Tom> denied."
> 
> Tom> checking the permission of the file it is -rw- --- ---
> 
> Tom> I can, of course open another console and chmod to correct this
> Tom> without leaving mutt, but I don't recall this problem with my
> Tom> previously installed old fedora.
> 
> Wait, something is odd here.  Are you running mutt as a different user?
> If not, why would it have any trouble writing to a file with 0600
> permissions?  Those two bits are _user_ read and write, after all.
> 
> I think you should attack this angle before you try to change the
> permissions.

I think it is worth to solve the trouble of file permissions. FMPOV this
behaviour is not typical to unix philosophy, because you cannot
influence file modes via the umask syscall.

This behaviour also bothered me, even though I use just one UID
basically. See below for my reasons to work on it, if interested.

> strace may be your friend.

Code rules. In my current mutt (Mutt 1.5.23+89 (0255b37be491)
(2014-03-12)) I find two locations, where umask and mode bits are set
hard-coded, so no way to modify without re-compiling.

First, main.c:599
  
  umask (077);

  This could be set to 022, which also opens other permissions to other
  users. So you should know if you really want it.

Second, lib.c:645 and :657

  if ((fd = open (safe_file, flags, 0600)) < 0)

  Here again, when files are opened in a safe way when writing out
  attachements, file mode bits are set hard-coded :/

  Here you can set 0666 as mode bits. The open syscall also binary-ands
  (&) the bits from the umask setting, either set them globally to 022
  in main.c or - the way I'd propose - change umask before writing out
  attachements and then reset to the previous one.


Finally, here is my trouble with it. I got used to save attachments to
~/public_html/$somewhere to have them available remotely via browser. I
always had to chmod a+r manually to enable all users including the web
server process to read that files.

In addition, these hard-coded umask and file mode bit settings are in
the mutt source repositories (see version reference above), so I think
the same behaviour should be seen on fedora, but I don't about any
patches from their side.

Cheers,

-- 
Bastian

Reply via email to