Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 560528 - ~net-misc/tinc-1.1: wrong localstatedir
Summary: ~net-misc/tinc-1.1: wrong localstatedir
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-15 09:59 UTC by Vadim A. Misbakh-Soloviov (mva)
Modified: 2022-05-03 16:40 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vadim A. Misbakh-Soloviov (mva) gentoo-dev 2015-09-15 09:59:58 UTC
Hi! I've noticed that "econf" in tinc-1.1* ebuild by default specifies '--localstatedir=/var/lib' to tinc's configure script, which leads to errors like:
```
$ tinc -n mynet dump connections
Could not open pid file /var/lib/run/tinc.mynet.pid: No such file or directory
```

because, in source code, it using it as "/var" replacement:

```
src/uml_device.c:               xasprintf(&device, LOCALSTATEDIR "/run/%s.umlsocket", identname);
src/names.c:            xasprintf(&logfilename, LOCALSTATEDIR SLASH "log" SLASH "%s.log", identname);
src/names.c:            xasprintf(&pidfilename, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname);
src/Makefile.in:localstatedir = @localstatedir@
src/Makefile.in:AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -DSBINDIR=\"$(sbindir)\"
src/Makefile.am:AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" -DSBINDIR=\"$(sbindir)\"
src/vde_device.c:               xasprintf(&device, LOCALSTATEDIR "/run/vde.ctl");
```

Should I report that "misuse" (if any) upstream or should I post fixed ebuild here (I think, it will be enough to just add --localstatedir=/var manually in econf arguments)?
Comment 1 Anthony Basile gentoo-dev 2015-10-09 00:12:15 UTC
(In reply to Vadim A. Misbakh-Soloviov (mva) from comment #0)
> 
> Should I report that "misuse" (if any) upstream or should I post fixed
> ebuild here (I think, it will be enough to just add --localstatedir=/var
> manually in econf arguments)?

can you test adding --localstatedir=/var and see if it fixes your problem
Comment 2 Vadim A. Misbakh-Soloviov (mva) gentoo-dev 2016-10-15 07:32:13 UTC
Sorry, missed your answer
Yes, manual addition of
> --localstatedir=/var
fixes the problem.
Although, shouldn't packages be patched to use /run directly instead of /var/run?
Comment 3 Anthony Basile gentoo-dev 2016-10-15 11:21:54 UTC
(In reply to Vadim A. Misbakh-Soloviov (mva) from comment #2)
> Sorry, missed your answer
> Yes, manual addition of
> > --localstatedir=/var
> fixes the problem.
> Although, shouldn't packages be patched to use /run directly instead of
> /var/run?

Yeah, I agree.  I'll prepare a patch.
Comment 4 Anthony Basile gentoo-dev 2016-10-15 12:15:02 UTC
Can you please test tinc-1.1_pre14-r2.ebuild and close this bug if everything works for you.  Its working at my end.

For posterity: I had to fix both the logfile and pidfile paths because both were being placed under LOCALSTATEDIR which is wrong.  Upstream is clearly misunderstanding the correct LFS use of /var/lib.  I've hard coded the correct paths.  If upstream really wants the paths to the pidfile and logfile to be configurable, they should edit configure.ac and AC_DEFINE LOGFILENAME and PIDFILENAME to be whatever values are picked up from ./configure with some switch like --with-logfile=... and --with-pidfile=...

@dlan.  You're thoughts?  I push this through upstream if you think this is a good idea.
Comment 5 Yixun Lan archtester gentoo-dev 2016-10-15 14:16:38 UTC
(In reply to Anthony Basile from comment #4)
> 
> @dlan.  You're thoughts?  I push this through upstream if you think this is
> a good idea.

@blueness, yes, I always think it's a good idea to push patches back to upstream which would make us carry less (thus much more clean ebuild), thanks
Comment 6 Benda Xu gentoo-dev 2017-03-12 05:30:06 UTC
Hi, this bug is affecting tinc-1.0.31, too.

Is the patch pushed upstream?
Comment 7 Benda Xu gentoo-dev 2017-03-12 05:47:10 UTC
All the LOCALSTATEDIR macros in the package are used to construct /var/log and /var/run.  I think the easiest fix is to pass --localstatedir=/var.
Comment 8 Vadim A. Misbakh-Soloviov (mva) gentoo-dev 2017-10-29 21:35:19 UTC
By the way, can you (anybody) port current patch to support prefix installations (at least, don't hardcode /var/log and /run)?