Subject: Re: [PATCH 1/1] Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir

From: Johannes Sixt <[email-masked]>
Date: Wed, 04 May 2011 16:39:54 +0200

Am 5/4/2011 15:58, schrieb Kacper Kornet:
> On Wed, May 04, 2011 at 07:52:30AM +0200, Johannes Sixt wrote:
>> Looking closer, the patch introduces git_etcdir for no good reason,
>> IIUC.
>> It should just re-use sysconfdir (the meaning of this variable is to
>> point
>> to the etc directory).
> 
> And the first version of my patch did it. However Junio has written:
> 
>> But this part in the Makefile outside the context of the patch bothers
>> me.  It seems to imply that sysconfdir is _not_ that variable you want
>> to
>> define later.
>>
>>    # Among the variables below, these:
>>    #   gitexecdir
>>    #   template_dir
>>    #   mandir
>>    #   infodir
>>    #   htmldir
>>    #   ETC_GITCONFIG (but not sysconfdir)
>>    #   ETC_GITATTRIBUTES
>>    # can be specified as a relative path some/where/else;
>>
>> So I have a suspicion that your patch as is will break when prefix is
>> set
>> to something other than /usr directory.  I don't think anybody in-tree
>> currently uses sysconfdir, but that does not mean nobody will ever do.
> 
>>>From that I understood that he prefers sysconfdir to be always an
> absolute path.

Junio's worries should not be discarded lightly. But in this case they are
unfounded. Digging the history shows:

b51b8bbf (Create a sysconfdir variable, and use it for ETC_GITCONFIG,
2007-04-24) introduced the variable to be able to treat the special case
where prefix == /usr. It was never intended as a user-settable value.

In 49fa65a7 (Allow the built-in exec path to be relative to the command
invocation path, 2008-07-23), I added the comment above because at that
time, a relocatable build should be requested by setting ETC_GITCONFIG to
a relative path, but not by changing sysconfdir. (The comment sounds as if
the user can set sysconfdir, but I did not intend to say that.)

026fa0d5 (Move computation of absolute paths from Makefile to runtime (in
preparation for RUNTIME_PREFIX), 2009-01-18) practically obsoleted
sysconfdir. In particular, it removed one of the cases where the value of
sysconfdir mattered, leaving only the reference where it is guaranteed to
be set to /etc. This commit could have removed sysconfdir entirely.

6df42ab9 (Add global and system-wide gitattributes, 2010-09-01) added
another consumer of sysconfdir, but in the same spirit as ETC_GITCONFIG.

So, I don't think that sysconfdir must survive. It was always only a
helper variable to shorten the code.

-- Hannes