After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 639832 - /recent-manager/add test doesn't honor $HOME neither $XDG_DATA_HOME
/recent-manager/add test doesn't honor $HOME neither $XDG_DATA_HOME
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: .General
2.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-01-18 10:28 UTC by Pacho Ramos
Modified: 2017-09-12 20:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
set output (5.72 KB, text/plain)
2011-01-18 10:29 UTC, Pacho Ramos
Details

Description Pacho Ramos 2011-01-18 10:28:51 UTC
Let me explain the situation:

Under gentoo (http://bugs.gentoo.org/show_bug.cgi?id=285687) we build gtk+ inside a sandbox to prevent compilation from writing on non-allowed places, this causes /recent-manager/add test to fail:

  /TreeView/scrolling/specific/bug-316689:                             OK
  /TreeView/scrolling/specific/bug-359231:                             OK
PASS: treeview-scrolling
TEST: recentmanager... (pid=4467)
Xlib:  extension "RANDR" missing on display ":101".
  /recent-manager/get-default:                                         OK
  /recent-manager/add:                                                 
Gtk-WARNING **: Attempting to store changes into `/home/pacho/.recently-used.xbel', but failed: Failed to create file '/home/pacho/.recently-used.xbel.5C9SPV': Permission denied
aborting...
FAIL
GTester: last random seed: R02S2a4c75878177a51b30aad5077208ef2b
Terminado
make[4]: *** [test-cwd] Error 143
make[4]: Leaving directory `/home/pacho/gtk+-2.22.1/gtk/tests'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory `/home/pacho/gtk+-2.22.1/gtk/tests'
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory `/home/pacho/gtk+-2.22.1/gtk'
make[1]: *** [check] Error 2
make[1]: Leaving directory `/home/pacho/gtk+-2.22.1/gtk'
make: *** [check-recursive] Error 1

I am running make check manually from upstream sources inside sandbox, it allows to write inside /home/pacho/gtk+-2.22.1 but not /home/pacho/.recently-used.xbel (as it's outside gtk+-2.22.1 subdir), then, I export the following variables:
$ export XDG_DATA_HOME=/home/pacho/gtk+-2.22.1
$ export HOME="/home/pacho/gtk+-2.22.1"

And they look to be properly exported (set output attached)

$ echo $HOME
/home/pacho/gtk+-2.22.1

$ echo $XDG_DATA_HOME 
/home/pacho/gtk+-2.22.1

But test keeps trying to write in /home/pacho/.recently-used.xbel instead of /home/pacho/gtk+-2.22.1/.recently-used.xbel

Do you know where could be the problem? Thanks a lot for your help
Comment 1 Pacho Ramos 2011-01-18 10:29:24 UTC
Created attachment 178611 [details]
set output
Comment 2 Pacho Ramos 2011-02-04 18:14:48 UTC
Probably latest comment from Gilles in downstream report could explain a bit more the problem:
"ok this is actually a lot trickier than what I thought. I changed my root
homedir to /root/temp to make sure my root homedir would not get polluted by
random packages and it is actually filling up quite a bit since I did this
change without ever logging in as root.

Anyway, gtk+ actually uses glib to determine home through g_get_home_dir which
is using multiple validations to get the real home of the user executing the
program. It looks at an env variable but if it is in contradiction with the uid
of the executing user, it falls back to using the home of the executing user.

This is also why sandbox fails to catch this, it has a ${HOME}/.recently-used*
entry but here $HOME is different than the home determined by glib.

I think the only reasonable solution here is indeed to disable the check and we
are going to need to do the same for pygtk."

http://bugs.gentoo.org/show_bug.cgi?id=285687#c13


Thanks a lot for your help
Comment 3 Daniel Boles 2017-09-05 09:42:48 UTC
It sounds to me like this is obsolete, either because you fixed it or possibly because GLib now does something more like what you wanted anyway:

> Before version 2.36 this function would ignore the HOME environment variable,
> taking the value from the passwd database instead. This was changed to increase
> the compatibility of GLib with other programs (and the XDG basedir
> specification) and to increase testability of programs based on GLib (by making
> it easier to run them from test frameworks).

GLib 2.36 was released on Mon, 25 Mar 2013.

If there's still an issue, feel free to open a new bug.
Comment 4 Gilles Dartiguelongue 2017-09-12 20:53:19 UTC
I think we used a Debian patch that modified g_get_home_dir that has been merged since then. Sorry for not getting back to this.