bug 219448

G. Milde g.milde@web.de
Thu, 12 May 2005 09:19:56 +0200

On 11.05.05, Jörg Sommer wrote:
> G. Milde schrieb am Wed 11. May, 14:09 (+0200):
> > On 11.05.05, Paul Boekholt wrote:

> > > A locally installed JED should probably not load a debian-specific file just
> > > because it is on Debian and a Debian JED happens to be installed as well.
> > 
> > This raises the more generic question: should a locally installed program
> > read configuration files in /etc/ (which might belong to non-local
> > programs or be just leftovers)?
> I think, no.

After reaching agreement on this list, we should contact John (and/or the
jed-users list) and propose a change to site.sl. (See my current
suggestion below.)

Details to discuss:

> > if (is_substr(JED_ROOT, "/usr/local") == 1)
> Isn't JED_ROOT[[:10]] == "/usr/local" better.

I prefer the is_substr() variant, because it doesn't hard-code the length
of the search string (so maintaining is easier). But this is a matter of
taste, I'd let John decide.

One could even look for "/local" (not necessarily starting at 1) and
prepend the path-component up to "local" to "/etc/jed.conf":

  $1 = "/etc/jed.conf";
  $2 = is_substr(JED_ROOT, "/local");
  if ($2)
    $1 = JED_ROOT[[:$2]] + "/local" + $1;

This would allow path like "/mnt/my-nfs-system/usr/local/".

> > BTW: Is there need for /usr/etc/jed.conf or could this one leaved out
> > making the code even easier by dropping the foreach loop.
> Yes, it should be removed, because it is not FHS compliant.

I am in favour of removing it too.  Still we might have to ask whether
someone uses it (on some non FHS compliant but otherwise UNIXish system)
and keep it for backwards compatibility. (Remember, the world is even
more complex than Linux.)

> > Should we keep the test for defaults.sl under UNIX or could it be skipped?

> No, skip it.

Fine. (This would need an adaption of the documentation, though.

Now my suggestion:

%  This code fragment looks for the existence of a configuration file 
%  ("jed.conf" on UNIX, "defaults.sl" else) and loads it.  
%  The configuration file IS NOT distributed with JED.

#ifdef UNIX
if (is_substr(JED_ROOT, "/usr/local"))
  $1 = "/usr/local/etc/jed.conf";
  $1 = "/etc/jed.conf";
if (1 == file_status ($1))
  () = evalfile ($1);
if (strlen(expand_jedlib_file("defaults.sl")))
  () = evalfile("defaults");


G.Milde web.de