[gnu.emacs] umask

armin@nmpcad.se (Armin Seidel) (02/28/90)

I am wondering wether it is possible in emacs to define the UNIX file
creation mode mask. On our Apollo system, emacs creates and saves
files with rw-rw-rw- ignoring the files' original protection rights
and my umask setting.

Do you have some useful hint?

        Thanks
        Armin
--
-----------------------------------------------------------------------------
Armin Seidel                                       |  Phone: +46 (8) 752 1179
Swedish Institute of Microelectronics              |  Fax:   +46 (8) 750 8056
P.O. Box 1193                                      |  
S-164 22 Kista, Sweden                             |
E-mail: armin@inmic.se, {uunet,mcvax,munnari,ukc,unido}!sunic!nmpcad.se!armin
-----------------------------------------------------------------------------

nhess@dvlseq.oracle.com (Nate Hess) (03/01/90)

In article <ARMIN.90Feb28082701@basn.nmpcad.se>, armin@nmpcad (Armin Seidel) writes:

>I am wondering wether it is possible in emacs to define the UNIX file
>creation mode mask. On our Apollo system, emacs creates and saves
>files with rw-rw-rw- ignoring the files' original protection rights
>and my umask setting.

If you'll look in {...}/src/fileio.c, you'll notice a line or two that
look something like

	fd = creat (name, 0666);

You could add code that would replace the 0666 with your current umask,
and then recompile.

--woodstock
-- 
	   "What I like is when you're looking and thinking and looking
	   and thinking...and suddenly you wake up."   - Hobbes

nhess@oracle.com or ...!uunet!oracle!nhess or (415) 598-3046

deven@rpi.edu (Deven T. Corzine) (03/02/90)

armin@nmpcad (Armin Seidel) writes:

Armin> I am wondering wether it is possible in emacs to define the
Armin> UNIX file creation mode mask. On our Apollo system, emacs
Armin> creates and saves files with rw-rw-rw- ignoring the files'
Armin> original protection rights and my umask setting.

On 28 Feb 90 20:27:06 GMT, nhess@dvlseq.oracle.com (Nate Hess) said:

Nate> If you'll look in {...}/src/fileio.c, you'll notice a line or
Nate> two that look something like

Nate> 	fd = creat (name, 0666);

Nate> You could add code that would replace the 0666 with your current umask,
Nate> and then recompile.

No!  If your umask is 22 (a common default) then this would create
files with permissios ----w--w- ...  obviously unintended.  There
should be a umask function (available as a primitive) which simply
accepts an argument and calls umask(arg).  That creat is just fine.
Why there is no umask call is beyond me.  (I just scanned the source
directories, no sign of one hidden anywhere.  *sigh*)

Deven
-- 
Deven T. Corzine        Internet:  deven@rpi.edu, shadow@pawl.rpi.edu
Snail:  2151 12th St. Apt. 4, Troy, NY 12180   Phone:  (518) 274-0327
Bitnet:  deven@rpitsmts, userfxb6@rpitsmts     UUCP:  uunet!rpi!deven
Simple things should be simple and complex things should be possible.