Bug 1935653 - Option --runstatedir doesn't work properly
Summary: Option --runstatedir doesn't work properly
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: autoconf
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Frédéric Bérat
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1937406
Blocks: 1831941
TreeView+ depends on / blocked
 
Reported: 2021-03-05 10:34 UTC by Filip Januš
Modified: 2022-05-10 13:08 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-10 13:08:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Filip Januš 2021-03-05 10:34:56 UTC
Description of problem:
In the documentation there is: By default runstatedir is a subdirectory of ${localstatedir}, but it doesn't behave in such way. The expectation was that after setting --localstatedir=/dirA will it change also @runstatedir@ to /dirA/run. But @runstatedir@ changes always to /run.


Version-Release number of selected component (if applicable):
autoconf-2.69-35

How reproducible:
Reproducer with description available here[2]

Steps to Reproduce:
    1. run autoreconf --verbose --install --force
    2. mkdir /tmp/run/
    3. touch /tmp/run/file1
    4. ./configure --localstatedir=/tmp
    5. ./test.sh
Actual results:
list /run

Expected results:
list /tmp/run

Additional info:


[1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/autoconf.txt
[2] https://fjanus.fedorapeople.org/autoconf/

Comment 1 Ondrej Dubaj 2021-03-05 13:17:54 UTC
Upstream issue:

https://lists.gnu.org/archive/html/bug-autoconf/2021-03/msg00001.html

Comment 2 Ondrej Dubaj 2021-03-08 12:19:48 UTC
From my perspective and according to documentation, I would prefer adding the below patch to autoconf

diff --git a/config.site b/config.site
index 5bea225..87750f7 100644
--- a/config.site
+++ b/config.site
@@ -18,6 +18,7 @@ then
     test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
     test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
     test "$localstatedir" = '${prefix}/var' && localstatedir=/var
+    test "$runstatedir" = '${localstatedir}/run' && runstatedir=/run
 
     ARCH=`uname -m`
     for i in x86_64 ppc64 s390x aarch64; do


It does not solve our problem, but in my opinion, it should be there.

Comment 3 Ondrej Dubaj 2021-03-08 14:03:28 UTC
Proposed fix for this issue:

https://src.fedoraproject.org/rpms/autoconf/pull-request/7

We should wait, what upstream says about this.

Comment 5 Frédéric Bérat 2022-04-12 18:36:11 UTC
I looked a bit at this issue, and I'm afraid I believe the current version works as expected.

More specifically, autoconf doesn't expand these kind of variable on purpose, as stated in the following snippet:


# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)

More specifically, the following phrase:

# These are left unexpanded so users can "make install exec_prefix=/foo"

must be interpreted:

# These are left unexpanded so users can "make install exec_prefix=/foo", assuming their makefile support these variables

This applies to a few variables, which includes runstatedir and localstatedir.

Therefore, the user should be careful while using them.

In the provided example, the shell script ends up with the following value:

ls "${localstatedir}/run"

Since "${localstatedir}" isn't set in the context of the shell script, that ends up being interpreted as:

ls "/run"

Autoconf is generally combined with automake, which will collect the (unexpanded) values of all these variables. Expansion will therefore be done while interpreting the makefile, which will result in the correct behavior.
A typical Makefile.in file, will include the following lines:

localstatedir = @localstatedir@
...
runstatedir = @runstatedir@

Anything provided in configure commandline will therefore be properly interpreted later on.


Note You need to log in before you can comment on or make changes to this bug.