[Bugs] [Bug 1450947] New: Autoconf leaves unexpanded variables in path names of non-shell-script text files

bugzilla at redhat.com bugzilla at redhat.com
Mon May 15 12:44:54 UTC 2017


https://bugzilla.redhat.com/show_bug.cgi?id=1450947

            Bug ID: 1450947
           Summary: Autoconf leaves unexpanded variables in path names of
                    non-shell-script text files
           Product: GlusterFS
           Version: 3.10
         Component: build
          Assignee: bugs at gluster.org
          Reporter: kkeithle at redhat.com
                CC: bugs at gluster.org, csaba at redhat.com,
                    kkeithle at redhat.com
        Depends On: 1444228



+++ This bug was initially created as a clone of Bug #1444228 +++

Description of problem:

The GlusterFS build system makes use of the autoconf functionality of
generating installed versions of certain text files from templates with .in
extensions. In some cases it occurs that autotools managed variables make their
ways into the template expansions. It can be a problem (but not always). For
example, the mount.glusterfs script is produced as the template expansion of
mount.glusterfs.in, which contains:

    prefix="@prefix@";
    exec_prefix=@exec_prefix@;
    cmd_line=$(echo "@sbindir@/glusterfs");

that might expand to (depending on configuration):

    prefix="/usr";
    exec_prefix=${prefix};
    cmd_line=$(echo "${exec_prefix}/sbin/glusterfs");

Here the definitions of exec_prefix and cmd_line include variables but it's not
a problem, as mount.glusterfs is a shell script and according to shell script
syntax, the variables will be substituted with the actual string values upon
running the script.

However, there are other cases, like that of glusterd.vol.in / glusterd.vol, 

    option working-directory @GLUSTERD_WORKDIR@

becaming

    option working-directory ${prefix}/var/lib/glusterd

or that of geo-replication/syncdaemon/conf.py.in /
/usr/libexec/glusterfs/glusterfind/conf.py,

    GLUSTERFS_LIBEXECDIR = '@GLUSTERFS_LIBEXECDIR@'
    GLUSTERD_WORKDIR = "@GLUSTERD_WORKDIR@"

    LOCALSTATEDIR = "@localstatedir@"
    UUID_FILE = "@GLUSTERD_WORKDIR@/glusterd.info"

becoming

    GLUSTERFS_LIBEXECDIR = '${exec_prefix}/libexec/glusterfs'
    GLUSTERD_WORKDIR = "${prefix}/var/lib/glusterd"

    LOCALSTATEDIR = "${prefix}/var"
    UUID_FILE = "${prefix}/var/lib/glusterd/glusterd.info"

where the expanded version of the file functions as config file or python
script, which does not support shell style variables and these values will be
used verbatim.

After some investigation, I identified the following list of *.in files where
variables in the expansion are problematic:

- events/src/eventsapiconf.py.in
- extras/geo-rep/schedule_georep.py.in
- extras/glusterd.vol.in
- extras/snap_scheduler/conf.py.in
- geo-replication/src/peer_georep-sshkey.py.in
- geo-replication/src/peer_mountbroker.in
- geo-replication/src/peer_mountbroker.py.in
- geo-replication/syncdaemon/conf.py.in
- tools/glusterfind/glusterfind.in
- tools/glusterfind/src/tool.conf.in

I've done testing with the following configure invocations:

- ./configure
- ./configure --prefix=/usr
- RHEL's configure invocation
- Ubuntu's configure invocation


How reproducible:

Deterministically.


Steps to Reproduce:

In a GlusterFS source tree with configure script present (ie. either shipped by
vendor or ./autogen.sh has been run) run the attached glusterdotin.sh script.

The script calls configure with various arguments (according to the above
invocation list). For each invocation it shows information about the invocation
(the arguments and summary of results) and a optionally a diff excerpt from the
diffs of the possibly affected *.in files and their expanded versions. The diff
excerpt shall contain those lines which exhibit the issue.


Actual results:

With some configure invocations a diff excerpt is shown.


Expected results:

No diff excerpt should be shown.


Additional info:

Before change https://review.gluster.org/16880 the issue was present, but among
the tested configurations it occurred only with "./configure --prefix=/usr",
whereby the following files were affected:

- events/src/eventsapiconf.py.in
- geo-replication/src/peer_mountbroker.py.in

However, https://review.gluster.org/16880 worsened the situation to a great
extent -- after this change only RHEL's configuration featured flawless
template expansion, and for the other three configurations a higher number of
files (5 to 9) were affected. (Implied: https://review.gluster.org/16880 is not
the final fix for Ubuntu build issues that are reported in the assiciated bug,
Bug 1430841.)

--- Additional comment from Worker Ant on 2017-04-21 02:24:58 EDT ---

REVIEW: https://review.gluster.org/17096 (ensure autoconf template expansions
resolve variables) posted (#1) for review on master by Csaba Henk
(csaba at redhat.com)

--- Additional comment from Worker Ant on 2017-04-21 04:30:31 EDT ---

REVIEW: https://review.gluster.org/17096 (build: ensure autoconf template
expansions resolve variables) posted (#2) for review on master by Csaba Henk
(csaba at redhat.com)

--- Additional comment from Worker Ant on 2017-04-27 11:19:02 EDT ---

COMMIT: https://review.gluster.org/17096 committed in master by Kaleb KEITHLEY
(kkeithle at redhat.com) 
------
commit a94b7df7b9308a590ebcac15536d22a386561f10
Author: Csaba Henk <csaba at redhat.com>
Date:   Fri Apr 21 19:11:24 2017 +0200

    build: ensure autoconf template expansions resolve variables

    Make sure the following autotools managed variables:

    GLUSTERFS_LIBEXECDIR
    GLUSTERD_MISCDIR
    GLUSTERD_VOLFILE
    LOCALSTATEDIR

    get expanded to literal paths when the configure
    script generates the installed versions of certain
    text files from *.in templates.

    This change is partly implemented by restoring some of
    the "eval echo $variable" style forced expansions in
    configure that were removed in
    If5219cadc51ae316f7ba2e2831d739235c77902d.

    BUG: 1444228
    Change-Id: I3b31b1259c5101252bbc37861683894e6eae29e6
    Signed-off-by: Csaba Henk <csaba at redhat.com>
    Reviewed-on: https://review.gluster.org/17096
    Smoke: Gluster Build System <jenkins at build.gluster.org>
    Reviewed-by: Niels de Vos <ndevos at redhat.com>
    NetBSD-regression: NetBSD Build System <jenkins at build.gluster.org>
    CentOS-regression: Gluster Build System <jenkins at build.gluster.org>
    Tested-by: Kaleb KEITHLEY <kkeithle at redhat.com>


Referenced Bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1444228
[Bug 1444228] Autoconf leaves unexpanded variables in path names of
non-shell-script text files
-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list