gnome control center crashed when attempting to open privacy dialogue

Bug #1024057 reported by SirPecanGum on 2012-07-12
70
This bug affects 16 people
Affects Status Importance Assigned to Milestone
Activity Log Manager
Critical
Manish Sinha (मनीष सिन्हा)
activity-log-manager (Ubuntu)
High
Unassigned
Precise
High
Unassigned
Quantal
High
Unassigned

Bug Description

[Impact]
If .config/userdirs.dirs doesn't exist or is incomplete, it's not possible to open the privacy pane of gnome-control-center.

[Test case]
Move .config/userdirs.dirs to a different location, run gnome-control-center, click privacy pane. If it crashes, this bug is still present.

[Regression potential]
The code submitted only modifies the way that special dirs are handled, so the worst that could happen is that special dirs are not handled in a special way.

------------------------------------------------

Original description

When I attempt to open "privacy" in the gnome-control-center (system settings), system settings crashes with the following error message. All other functions within system settings work:

magnus@1204:~$ gnome-control-center

(gnome-control-center:11858): Gtk-CRITICAL **: gtk_box_pack: assertion `gtk_widget_get_parent (child) == NULL' failed
Segmentation fault (core dumped)

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: gnome-control-center 1:3.4.2-0ubuntu0.3
ProcVersionSignature: Ubuntu 3.2.0-26.41-generic 3.2.19
Uname: Linux 3.2.0-26-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.0.1-0ubuntu8
Architecture: amd64
Date: Thu Jul 12 20:49:23 2012
ExecutablePath: /usr/bin/gnome-control-center
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, no user)
 LANGUAGE=en_GB:en
 LANG=en_GB.UTF-8
SourcePackage: gnome-control-center
UpgradeStatus: No upgrade log present (probably fresh install)
usr_lib_gnome-control-center:
 activity-log-manager-control-center 0.9.4-0ubuntu3
 deja-dup 22.0-0ubuntu2
 gnome-bluetooth 3.2.2-0ubuntu5
 indicator-datetime 0.3.94-0ubuntu2

SirPecanGum (sirpecangum) wrote :
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-control-center (Ubuntu):
status: New → Confirmed
John Kuang (xiphosurus) wrote :

This has been happening to me since oneiric. And still happening now in quantal!

Margarita Manterola (marga-9) wrote :

Hi,

I have been able to reproduce and find the cause of this bug. The bug is triggered when the file ".config/user-dirs.dirs" is not present. Simply move that file away and you'll be able to reproduce this. Running xdg-user-dirs-update might or might not fix the problem, some variables might not get set in that case, and if there's one variable missing, the privacy pane fails.

The bug is actually in the activity-log-manager package. The file src/files-widget.vala, lines 264-272, says:

  defined_dirs = new HashMap<string, UserDirectory>(str_hash, str_equal);
  defined_dirs.set(Environment.get_user_special_dir(UserDirectory.DESKTOP), UserDirectory.DESKTOP);
  defined_dirs.set(Environment.get_user_special_dir(UserDirectory.DOCUMENTS), UserDirectory.DOCUMENTS);
  defined_dirs.set(Environment.get_user_special_dir(UserDirectory.DOWNLOAD), UserDirectory.DOWNLOAD);
  defined_dirs.set(Environment.get_user_special_dir(UserDirectory.MUSIC), UserDirectory.MUSIC);
  defined_dirs.set(Environment.get_user_special_dir(UserDirectory.PICTURES), UserDirectory.PICTURES);
  defined_dirs.set(Environment.get_user_special_dir(UserDirectory.PUBLIC_SHARE), UserDirectory.PUBLIC_SHARE);
  defined_dirs.set(Environment.get_user_special_dir(UserDirectory.TEMPLATES), UserDirectory.TEMPLATES);
  defined_dirs.set(Environment.get_user_special_dir(UserDirectory.VIDEOS), UserDirectory.VIDEOS);

which gets translated into calls like this one, for example:

        _tmp42_ = self->priv->defined_dirs;
        _tmp43_ = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
        gee_abstract_map_set ((GeeAbstractMap*) _tmp42_, _tmp43_, GINT_TO_POINTER (G_USER_DIRECTORY_DOWNLOAD));

If the userdir file is not present or the variable not defined in it, the call to g_get_user_special_dir will return null (documented behaviour), which will make gee_abstract_map_set fail.

The code needs to be reworked to take into account that these dirs might not be set.

affects: gnome-control-center (Ubuntu) → activity-log-manager (Ubuntu)
Margarita Manterola (marga-9) wrote :

I'm attaching a userdirs.dirs file. Users affected by this bug can "fix" it by putting this file in their .config folder.

Margarita Manterola (marga-9) wrote :

Hi,

I have been able to fix this problem by modifying the vala code to only add the directories when they were not null. The fix itself was simple, but getting it to work was a different story, due to unrelated bugs (not being able to build twice in a row, not being able to generate c files from vala files with the shipped Makefile.in

I'm attaching the smallest diff that fixes the issue for precise. I don't have a quantal box to test this fix in quantal.

Margarita Manterola (marga-9) wrote :

I added the "Activity Log Manager" project to the bug, because the problem is still present in the upstream version. Please fix it there as well. Thank you.

description: updated
Sebastien Bacher (seb128) wrote :

Thank for the patch Margarita, could you describe why you need to drop config.vapi from the Makefile.in?

You mention "not being able to generate c files from vala files with the shipped Makefile.in" ... are the .c updated during the build or is the build using the generated version shipped with the tarball?

Oh, also as a curiosity, how do you end up with incomplete user-dirs.dirs, I wonder if there is a being on that side as well or if you just have a specific reason to get a non standard configuration for those directories

Changed in activity-log-manager (Ubuntu):
importance: Undecided → High
status: Confirmed → In Progress
Changed in activity-log-manager (Ubuntu Precise):
importance: Undecided → High
status: New → Triaged
Sebastien Bacher (seb128) wrote :

Testing on raring it works fine, I will wait on the config.vapi question to be resolved before SRUing that though

Margarita Manterola (marga-9) wrote :

I installed a virtual quantal box, and prepared a patch for quantal as well. While doing that I realized that the quantal version is different (-4 instead of -3), and it includes a different solution for the config.vapi issue. Is it better to also apply the other changes done in quantal or to just apply this patch for precise?

I'll answer the other questions in my next message.

Margarita Manterola (marga-9) wrote :

The source code is in the .vala files. The .c files are generated from there and almost unreadable. So, when making changes, they should be made in the .vala files and then the affected c files need to be regenerated. To fix this bug I had to patch a .vala file, so the corresponding .c file gets regenerated as well.

The current Makefile.in generates a Makefile that requires the file "config.vapi" to be present, or it fails. This file is not shipped in the .tar.gz, by mistake. I already filed https://bugs.launchpad.net/activity-log-manager/+bug/1083160 about this.

In the quantal version, the solution was to add the config.vapi file. I didn't know this, and I thought it was less invasive to remove this requirement which didn't seem to make any differences in the output (regenerating the original c files produced no changes).

I can fix it the quantal way, by adding the config.vapi file, or fix it in my original way by removing the line from the Makefile. The end result is the same, so I don't care, whatever makes it easier for this to go into precise.

Also, about the userdirs file, there are many reasons why it might be that it's not there, or just partially there:
1) First session was via ssh instead of logging in
2) Removed by the user to avoid seeing a bunch of not wanted directories on the left of the file-window
3) Regenerated by the user by running xdg-user-dirs-update after removing some of the default directories

So, this is no bug on the file not being there. The bug is assuming that it will be. The glib call is documented to return NULL when the user didn't set this directory. Software should take this into account.

Paolo Stivanin (polslinux) wrote :

Confirmed bug!
With this user-dirs.dirs:
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/Scrivania"
XDG_DOWNLOAD_DIR="$HOME/Scaricati"
#XDG_TEMPLATES_DIR="$HOME/Templates"
#XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documenti"
#XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Immagini"
#XDG_VIDEOS_DIR="$HOME/Videos"

it crash but with the user-dirs.dirs provided by Margarita it works!
the problem is: how can i use my personal user-dirs.dirs??

Changed in activity-log-manager (Ubuntu Quantal):
importance: Undecided → High
status: New → Triaged
status: Triaged → In Progress
Sebastien Bacher (seb128) wrote :

Thanks Marga, I've sponsored the quantal and precise debdiffs (rebased on the current SRUs from Evan which are in proposed for those series)

Changed in activity-log-manager (Ubuntu Precise):
status: Triaged → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package activity-log-manager - 0.9.4-0ubuntu6.1

---------------
activity-log-manager (0.9.4-0ubuntu6.1) raring; urgency=low

  * debian/patches/06_add_unity_dash_privacy.patch:
    - drop trailing period from the online result label (lp: #1061930)

  [ Margarita Manterola ]
  * 05_fix_userdirs.patch:
    - Verify that a user directory exists before adding it to the hash map.
      (LP: #1024057)
 -- Sebastien Bacher <email address hidden> Mon, 26 Nov 2012 15:45:31 +0100

Changed in activity-log-manager (Ubuntu):
status: In Progress → Fix Released

Hello SirPecanGum, or anyone else affected,

Accepted activity-log-manager into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/activity-log-manager/0.9.4-0ubuntu4.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in activity-log-manager (Ubuntu Quantal):
status: In Progress → Fix Committed
tags: added: verification-needed
Brian Murray (brian-murray) wrote :

I purposefully did not upload activity-log-manager to precise so that we can first release the update (on Monday) fixing bug 993056.

SirPecanGum (sirpecangum) wrote :

I've enabled proposed as instructed and updated. I now have no "Privacy" option in System Settings > All Settings. Is that the expected result? I use a modified layout of user-dirs.dirs - I see no reason for links to folders I never use - could that be a problem? I've logged out but not restarted yet. http://www.flickr.com/photos/14028464@N04/8233619229/

Margarita Manterola (marga-9) wrote :

Hi SirPecanGum,

The privacy pane should not go away, or at least that's not the expected effect of my patch. Since the SRU contains other patches, it might be that they are making the privacy pane go away, but I don't know why.

Margarita Manterola (marga-9) wrote :

Hi,

I checked this. The icon is still there, but you need to install activity-log-manager-control-center. It's possible that it got removed when you upgraded, or something similar happened. Please try installing activity-log-manager-control-center from quantal-proposed. I have tested it and it works fine.

Brian Murray (brian-murray) wrote :

Hello SirPecanGum, or anyone else affected,

Accepted activity-log-manager into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/activity-log-manager/0.9.4-0ubuntu3.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in activity-log-manager (Ubuntu Precise):
status: In Progress → Fix Committed
Miklos Juhasz (mjuhasz) wrote :

With the package in proposed I don't get the crash anymore when the .config/userdirs.dirs doesn't exist. Tested on 12.04 (Precise).

tags: added: verification-done
removed: verification-needed

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package activity-log-manager - 0.9.4-0ubuntu3.2

---------------
activity-log-manager (0.9.4-0ubuntu3.2) precise-proposed; urgency=low

  * 05_fix_userdirs.patch:
    - Verify that a user directory exists before adding it to the hash map.
      (LP: #1024057)
 -- Margarita Manterola <email address hidden> Mon, 26 Nov 2012 13:21:37 +0100

Changed in activity-log-manager (Ubuntu Precise):
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package activity-log-manager - 0.9.4-0ubuntu4.2

---------------
activity-log-manager (0.9.4-0ubuntu4.2) quantal-proposed; urgency=low

  * 07_fix_userdirs.patch:
    - Verify that a user directory exists before adding it to the hash map.
      (LP: #1024057)
 -- Margarita Manterola <email address hidden> Mon, 26 Nov 2012 17:05:56 +0100

Changed in activity-log-manager (Ubuntu Quantal):
status: Fix Committed → Fix Released
José Ramón Peney (chachomil) wrote :

hola

Changed in activity-log-manager:
assignee: nobody → Manish Sinha (मनीष सिन्हा) (manishsinha)
importance: Undecided → Critical
milestone: none → 0.9.5
status: New → Confirmed
Changed in activity-log-manager:
status: Confirmed → Fix Committed
Changed in activity-log-manager:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers