[Bugs] [Bug 1489610] New: glusterfind saves var data under $prefix instead of localstatedir

bugzilla at redhat.com bugzilla at redhat.com
Thu Sep 7 22:03:59 UTC 2017


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

            Bug ID: 1489610
           Summary: glusterfind saves var data under $prefix instead of
                    localstatedir
           Product: GlusterFS
           Version: 3.12
         Component: glusterfind
          Assignee: bugs at gluster.org
          Reporter: nh2-redhatbugzilla at deditus.de
        QA Contact: bugs at gluster.org
                CC: avishwan at redhat.com, bugs at gluster.org,
                    khiremat at redhat.com



Description of problem:

On Linux setups where the install prefix (./configure --prefix=...) is mounted
read-only, such as NixOS, one gets the following glusterfind failure:

  $ glusterfind query myvol outfile --full
  Fail to create dir
/nix/store/w6204cvmxi7qkzvx11ivgq5hgrm2f2wm-glusterfs-3.10.2/var/lib/misc/glusterfsd/glusterfind/default/myvol/20170907-215100-679121-mTMVz3:
[Errno 30] Read-only file system:
'/nix/store/w6204cvmxi7qkzvx11ivgq5hgrm2f2wm-glusterfs-3.10.2/var/lib/misc'

This is because glusterfind tries to put variable data into $PREFIX, instead of
into /var (or whatever the --localstatedir given to ./configure is), where all
modifiable data should land.

In detail, it happens this way:

configure.ac has:

    GLUSTERFSD_MISCDIR="$(eval echo $prefix)/var/lib/misc/glusterfsd"

Then, tools/glusterfind/src/tool.conf.in has:

   [vars]
    session_dir=@GLUSTERD_WORKDIR@/glusterfind/
    working_dir=@GLUSTERFSD_MISCDIR@/glusterfind/
    log_dir=/var/log/glusterfs/glusterfind/

relevant here is `working_dir=@GLUSTERFSD_MISCDIR@/`. (Note `log_dir=/var/...`
is probably also wrong and should use `@LOCALSTATEDIR@`, but that's not
relevant for this issue).

That expands to (NixOS in my example):

    # cat
/nix/store/w6204cvmxi7qkzvx11ivgq5hgrm2f2wm-glusterfs-3.10.2/libexec/glusterfs/glusterfind/tool.conf 
    [vars]
    session_dir=/var/lib/glusterd/glusterfind/
   
working_dir=/nix/store/w6204cvmxi7qkzvx11ivgq5hgrm2f2wm-glusterfs-3.10.2/var/lib/misc/glusterfsd/glusterfind/
    log_dir=/var/log/glusterfs/glusterfind/

Finally, tools/glusterfind/src/main.py has:

    node_outfile = os.path.join(conf.get_opt("working_dir"),
                                args.session, args.volume,
                                tmpfilename,
                                "tmp_output_%s" % num)
    ...
    # remote file will be copied into this directory
    mkdirp(os.path.dirname(node_outfile),
           exit_on_err=True, logger=logger)

And that's where `mkdirp` is run on a directory in $PREFIX, namely fully
expanded through the layer:

    mkdirp($(eval echo
$prefix)/var/lib/misc/glusterfsd/glusterfind/args.session/args.volume)

I think it is wrong that this is done in $prefix; it should be done in
$localstatedir, as all other components of glusterfs do it.


Version-Release number of selected component: glusterfs 3.10 and 3.12

How reproducible: Always


Steps to Reproduce:
1. Install glusterfs with ./configure --prefix=/path/to/prefix
--localstatedir=/path/to/var
2. Mount /path/to/prefix readonly
3. Set up glusterfs volume "myvol"
4. Run `glusterfind query myvol outfile --full`

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list