Re: bug on SunOS 4
- From: Owen Taylor <owt1 cornell edu>
- To: David Monniaux <monniaux clipper ens fr>
- Cc: GTK+ list <gtk-list redhat com>
- Subject: Re: bug on SunOS 4
- Date: 03 Apr 1998 14:03:43 -0500
David Monniaux <monniaux@clipper.ens.fr> writes:
> getcwd() is broken on SunOS 4. That results in gimp freezing X when
> selecting "Open" from the file menu.
>
> Here underneath is a patch to have Gtk use getwd() instead.
>
> Observation: the X freeze is due to some grab being released too late.
> It is a bad idea IMHO to do file I/O while have a X grab.
> That grab should therefore be released quicker.
Currently, on button release GTK first activates the menu item,
then deactivates the menu. (Hides it and removes the grab)
This is probably not that great - because the pointer grab shouldn't
be held after the user releases the button. Popping up the window
first however may cause the user to think that nothing happened
if the operation takes a long time. (The UI won't respond, but
the users attempts to do something will be processed later)
Probably the right thing to do is to release the the pointer grab,
but leave the window up and keep a gtk_grab_add on it.
> As for the source of the bug with getcwd() on SunOS 4, it is some
> neverending wait4(). getcwd on SunOS 4 (contrary to getwd) is implemented
> with a pipe() and vfork() (the actual function runs in another process).
> The signal handling after this is badly done, maybe interfering with the
> one for GTK.
This is a tricky one - getwd() is non-portable BSD'ism. Even where
it is available, I'm not sure it is a good idea to use it instead
of getcwd - it looks like an invitation to buffer overruns
char *getwd(char *buf);
Is how it is defined in my Linux libc5 manual pages, which says:
getwd, which is only prototyped if __USE_BSD is defined,
will malloc(3) an array big enough to hold the absolute
pathname of the current working directory.
Which seems to be just incorrect. IN glibc, getwd expect buf
to be at least PATH_MAX bytes long, and if the pathname is longer,
returns NULL. (And stringifies the error message into buf!)
The filesel code uses a buffer of MAXPATHLEN==PATH_MAX, so assuming
MAXPATHLEN is correct, getwd probably is safe. But it would be nice to
use it only when absolutely necessary. It's not clear to me
how one would write a configure test that would test for the
problem you are reporting.
So unless you can figure out why GTK is calling wait4 to fail
(which seems like a major problem in itself), I think the
proper thing to do is to put the getwd() in a #ifdef specific
to SunOS 4. Is #ifdef sun right?
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]