Re: BUG REPORT tin 1.9.6 release 20101126 ("Burnside") [UNIX]

Urs Janßen <[email protected]> Mon, 8 Aug 2011 17:39:06 +0200
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
On Mon, Aug 08, 2011 at 02:38:01PM +0200, Vincent Lefevre wrote:

>>> Concerning the configure options, I wonder why the default for
>>> --with-defaults-dir is /etc/tin and not the directory where
>>> tin.defaults was installed ($sysconfdir/etc/tin). This is quite
>>> inconsistent and suppose this is a bug.

>> --with-defaults-dir is documented as defaulting to /etc/tin and not to
>> $sysconfdir/tin or whatever so I can't see a bug here.

> Yes, the behavior follows the documentation, but what I mean
> is why --with-defaults-dir defaults to /etc/tin and not to
> $sysconfdir/etc/tin? I don't see any reason to install the

that would default to /usr/local/etc/etc/tin

> defaults somewhere and read them in another place! Of course

installation is done to

	$(DESTDIR)$(INS_SYSDEF_DIR)

choosen by --with-install-prefix (=DESTDIR) (defaults to /)
and --with-defaults-dir= (INS_SYSDEF_DIR) (defaults to /etc/tin/)
so the full default is /etc/tin/

but you are right there is a bug in configure.in as it sets
TIN_DEFAULTS_DIR (the place which is used for reading the defaults file)
just to INS_SYSDEF_DIR, not to DESTDIR/INS_SYSDEF_DIR, but uses
$(DESTDIR)$(INS_SYSDEF_DIR) for initiall installation. that's a bug, but I'm
currently unsure how to fix this.

inm short src:Makefile.in uses:

DESTDIR = @DESTDIR@
INS_SYSDEF_DIR  = @TIN_DEFAULTS_DIR@
$(INSTALL) -m 644 $(DOCDIR)/tin.defaults $(DESTDIR)$(INS_SYSDEF_DIR)/tin.defaults

but include/autoconf.hin has

#       undef TIN_DEFAULTS_DIR

and the configure macro used is

CF_WITH_PATH(defaults-dir,
        [  --with-defaults-dir=PATH
                          directory containing tin.defaults file
                         ],
        TIN_DEFAULTS_DIR,/etc/tin)
AC_DEFINE_UNQUOTED(TIN_DEFAULTS_DIR,"$TIN_DEFAULTS_DIR")

tin.h has:

#ifdef TIN_DEFAULTS_DIR
#	define TIN_DEFAULTS TIN_DEFAULTS_DIR,TIN_DEFAULTS_BUILTIN
#endif

and init.c:read_site_config() tries to open each path given in
TIN_DEFAULTS"/tin.defaults" and stops after the first match.

- removing $(DESTDIR) from Mailefile.in would break --with-install-prefix.
- prepending $(DESTDIR) to the value of TIN_DEFAULTS_DIR in the configure
  macro would require remvoibng the $(DESTDIR) prefix from the makefile rule
  which makes things less understandable

looks like we have to do something like:
define DESTDIR in autoconf.h[in] and prepend it tin.h like
#define	TIN_DEFAULTS DESTDIR##TIN_DEFAULTS_DIR,TIN_DEFAULTS_BUILTIN

BTW IIRC --with-install-prefix was introduced before
AC_PREFIX_DEFAULT(/usr/local) was added to configure.in
and nobody cleaned that up (i.e. use --prefix instead).

> the current solution is to use --with-defaults-dir too, but
> I find this behavior very unintuitive and it is easy to miss
> this second configure option. So, I'm just suggesting that
> the behavior and the documentation be changed to the default
> $sysconfdir/etc/tin.

as stated above that would lead to /usr/local/etc/etc/tin, so if we are
going to do such a change that should be ${sysconfdir}"/tin"

> FYI, one uses a different prefix for MacPorts software to avoid
> conflicts with software from the vendor (Apple). As both kinds
> of software (having different versions) are installed in parallel,
> one needs a different place for configuration files.

something like this

	--prefix=/foo/ \
	--with-defaults-dir=/foo/etc/tin/

without giving --with-install-prefix might solve your problem, but indeed
isn't very intuitive.

urs
-- 
"Only whimps use tape backup: _real_ men just upload their important stuff
 on ftp, and let the rest of the world mirror it ;)" - Linus