discuss-gnustep
[Top][All Lists]
Advanced

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

Re: bug in NSUserDefaults


From: Erik Dalen
Subject: Re: bug in NSUserDefaults
Date: Sun, 10 Feb 2002 13:01:06 +0100 (CET)

On Sun, 10 Feb 2002, Richard Frith-Macdonald wrote:

>
> On Sunday, February 10, 2002, at 08:17 AM, Erik Dalen wrote:
>
> >
> >
> > On Sun, 10 Feb 2002, Richard Frith-Macdonald wrote:
> >
> >>
> >> On Saturday, February 9, 2002, at 11:19 PM, Erik Dalen wrote:
> >>
> >>>
> >>> hi
> >>>
> >>> I've spent the last few hours trying to install GNUstep with
> >>> GNUSTEP_USER_ROOT=~ instead of =~/GNUstep
> >>> and I've noticed that there's a quite serious but in NSUserDefaults,
> >>> the
> >>> GNUSTEP_USER_ROOT is hardcoded in it.
> >>
> >> I don't think that's a bug ... the GNUSTEP_USER_ROOT environment
> >> variable is
> >> intended to define one of the places where you can fine application,
> >> libraries
> >> and other resources.  That doesn't mean that *all* resources will or
> >> should
> >> be stored there.
> >>
> > but it automatically creates ~/GNUstep for the .GNUstepdefaults. And
> > then
> > it creates ~/GNUstep/Library for the font-cacher. Even though that one
> > (should) use ~/Library in my case.
>
> Actually, I think the font caching code does that, not the defaults code.
> That might be considered a bug in the font cacher ... not sure.
>

It is the NSUserDefaults.m code that does that.


> > Also if it should have a fixed location for .GNUstepdefaults, why not
> > have
> > it in ~/ ? It would be hidden anyway, and that would take away the need
> > for creating the ~/GNUstep directory when it's not needed.
>
> Because that's not the standard location.  The GNUstep directory is used
> as standard to keep things clearly in one place ... it's up to the user
> to then mess that up if they wish :-)
>


> >> The thing about defaults is they need to be both private and writable,
> >> so
> >> you really can't work with other peoples defaults, and if your program
> >> is
> >> running setuid so that the user it's running as is not the same as the
> >> one it was started as, it needs to change where it gets/puts defaults
> >> info.  This means it has to compute the location of the defaults - it
> >> might well use different defaults databases during oen program run, and
> >> using any environment variable would be bound to be wrong for all but
> >> one
> >> of them.
> >
> > Well, most GNUstep installations would have the same user root.
> > make-services in System/Makefiles/GNUstep.sh wouldn't funtcion well
> > otherwise. As you can't set another USER_ROOT before running GNUstep.sh,
> > and it would be quite pointless to set another after running GNUstep.sh
>
> I'm not sure what you are saying here.  Perhaps you are making a case for
> removing the GNUSTEP_USER_ROOT environment variable?  I'm not sure that
> it's
> very useful myself.
> One interesting option would be to keep the defaults in a standard
> location
> for each user as at present, and have the defaults database contain a
> value
> to do what GNUSTEP_USER_ROOT does now - essentially specify where apps
> and
> their resources are to be found.  However, defaults really *are* a
> special
> case ... there is a mechanism for the application to be notified when
> they
> change (letting the app update cached info it read from the defaults
> system earlier).  There is no such standard mechanism to let the app know
> that standard file paths have changed.
>
> PS. have to go out for the day now ... if you want to talk further, don't
> expect a prompt response.
>

What I'm saying is that as GNUSTEP_USER_ROOT is defined in
System/Makefiles/GNUstep.sh it would be difficult to have ~/GNUstep for
one user and ~ for another one.
So I think that suid applications that should use a different
GNUSTEP_USER_ROOT really is a non-issue. Of course the code could check
for a .GNUstepDefaults in ~/GNUstep if it can't find it in the
GNUSTEP_USER_ROOT. But when if it can't find it in either location it
should create it in GNUSTEP_USER_ROOT.

And the creation of the Library directory should be removed from
NSUserDefaults.m IMO and put in the font-cacher instead.

/Erik




reply via email to

[Prev in Thread] Current Thread [Next in Thread]