gnome-session & umask



Standard disclaimer: I'm not a hacker, I don't know how X really works and
the following may be 100% nonsense. If I send this to this list, it's
because I hope it can help.

Today I discovered that my gnome-terminal umask was 000 and I found that
the culprit was gnome-session: basically "grep umask strace_output" shows
a umask(0) as the last umask call.

BTW: using gnome CVS from today, RH6.0 & XFree86 3.3.3.1 (the *-52
rpms).

I think I tracked it down to gnome-core/gsm/ice.c in initialize_ice():

  if (! SmsInitialize (GsmVendor, VERSION, new_client, NULL,
                       auth_proc, sizeof error, error) ||
      ! IceListenForConnections (&num_sockets, &sockets,
                                 sizeof error, error))
     .......

It seems that before that call to IceListenForConnections the umask is ok
but not after the call. Using gdb I found this backtrace:

#0  0x40469360 in __umask ()
#1  0x40122172 in _IceTransSocketUNIXCreateListener ()
#2  0x40123dcf in _IceTransCreateListener ()
#3  0x4012450e in _IceTransMakeAllCOTSServerListeners ()
#4  0x4011a976 in IceListenForConnections ()
#5  0x804c9c8 in initialize_ice () at ice.c:152
#6  0x804cf01 in main (argc=1, argv=0xbffffc64) at main.c:96
#7  0x403decb3 in __libc_start_main (main=0x804ced4 <main>, argc=1, 
    argv=0xbffffc64, init=0x804a354 <_init>, fini=0x804f20c <_fini>, 
    rtld_fini=0x4000a350 <_dl_fini>, stack_end=0xbffffc5c)
    at ../sysdeps/generic/libc-start.c:78

and in gnome-session output there's:
_IceTransSocketUNIXCreateListener: mkdir(/tmp/.ICE-unix) failed, errno =
17
_IceTransMakeAllCOTSServerListeners: failed to create listener for local

My guess: _IceTransSocketUNIXCreateListener set the umask to 0, tries to
mkdir(/tmp/.ICE-unix) but that dir exists (errno=17) and returns without
resetting the umask.

Questions:
1) Is this a bug in _IceTransSocketUNIXCreateListener ?
2) Has anyone experienced this before?
3) As a workaround I put

  gint old_mask;
  [...]
  old_umask=umask(0);
  umask(old_umask);

  if (! SmsInitialize (GsmVendor, VERSION, new_client, NULL,
                       auth_proc, sizeof error, error) ||
      ! IceListenForConnections (&num_sockets, &sockets,
                                 sizeof error, error))
    {
      g_warning (error);
      exit (1);
    }

  umask(old_umask);
  [...]

and I have my umask again != 0, but I don't like this.
Where I can report this (non-gnome) bug? Who is the culprit ? :-)

I hope not to have wasted your time with a silly problem...

Regards,
Zun.




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