Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1694706 - libxdg-basedir fails when $HOME is undefined (bad for init/systemd)
Summary: libxdg-basedir fails when $HOME is undefined (bad for init/systemd)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: libxdg-basedir
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Gwyn Ciesla
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-01 12:30 UTC by Anders Blomdell
Modified: 2019-04-10 07:36 UTC (History)
1 user (show)

Fixed In Version: libxdg-basedir-1.2.0-19.fc30 libxdg-basedir-1.2.0-19.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-06 20:19:00 UTC


Attachments (Terms of Use)
Handle when $HOME is undefined (deleted)
2019-04-01 12:30 UTC, Anders Blomdell
no flags Details | Diff
Handle when $HOME is undefined (deleted)
2019-04-01 16:01 UTC, Anders Blomdell
no flags Details | Diff

Description Anders Blomdell 2019-04-01 12:30:47 UTC
Created attachment 1550551 [details]
Handle when $HOME is undefined

Description of problem:

Programs based on libxdg-basedir don't find system-wide configurations
when running from init/systemd context, since it does not handle the
case when $HOME is unset.

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

libxdg-basedir-1.2.0-17.fc2

How reproducible:

always

Steps to Reproduce:
1. Compile the program in 'Additional info' 
2. Run it with 'env -i foo'

Actual results:

Segmentation fault (core dumped)

Expected results:

/etc/xdg

Additional info:

/* compile with 'gcc -g -o foo foo.c -lxdg-basedir' */
#include <basedir.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
        const char * const *config_paths = xdgSearchableConfigDirectories(NULL);
        const char * const *path;

        for (path = config_paths ; *path ; path++) {
          printf("%s\n", *path);
        }
        free((const char **)config_paths);

        return 0;
}

Comment 1 Fedora Update System 2019-04-01 15:07:23 UTC
libxdg-basedir-1.2.0-18.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-65c9852d51

Comment 2 Fedora Update System 2019-04-01 15:07:29 UTC
libxdg-basedir-1.2.0-18.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-30c590c4a0

Comment 3 Anders Blomdell 2019-04-01 16:01:13 UTC
Created attachment 1550635 [details]
Handle when $HOME is undefined

Somehow managed to destroy first chunk in diff...

Comment 4 Fedora Update System 2019-04-01 16:20:21 UTC
libxdg-basedir-1.2.0-19.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-cee683419f

Comment 5 Fedora Update System 2019-04-01 16:20:37 UTC
libxdg-basedir-1.2.0-19.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-55a2c60e71

Comment 6 Anders Blomdell 2019-04-01 17:34:21 UTC
Perhaps a more aggressive check strategy should be used?

%check
make check USE_VALGRIND=1
env -i make check USE_VALGRIND=1
# Check that we get NULL for all things rooted in ENV{HOME} when running
# with HOME unset
env -i ./tests/testdump | grep null > grep.NULL
env -i ./tests/testdump | grep HOME | grep -v DIRS > grep.HOME
diff -u grep.NULL grep.HOME

Comment 7 Gwyn Ciesla 2019-04-01 18:46:09 UTC
I'll add that to rawhide.

Comment 8 Fedora Update System 2019-04-02 02:07:25 UTC
libxdg-basedir-1.2.0-19.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-55a2c60e71

Comment 9 Fedora Update System 2019-04-02 02:30:52 UTC
libxdg-basedir-1.2.0-19.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-cee683419f

Comment 10 Fedora Update System 2019-04-06 20:19:00 UTC
libxdg-basedir-1.2.0-19.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2019-04-10 07:36:31 UTC
libxdg-basedir-1.2.0-19.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.


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