update-desktop-database segfault

Bug #59392 reported by Vladimir M. Kerka
4
Affects Status Importance Assigned to Milestone
desktop-file-utils
Fix Released
Unknown
desktop-file-utils (Ubuntu)
Invalid
Medium
Unassigned
Nominated for Hardy by Paul Dufresne

Bug Description

Binary package hint: kdebase-data

I get update-desktop-database segfault when I try to upgrade packages. The error is:
Setting up hplip (0.9.11-2ubuntu7) ...
Creating/updating hplip user account...

(update-desktop-database:29176): GLib-CRITICAL **: g_key_file_get_string_list: assertion `group_name != NULL' failed
/var/lib/dpkg/info/hplip.postinst: line 86: 29176 Segmentation fault update-desktop-database -q
dpkg: error processing hplip (--configure):
 subprocess post-installation script returned error exit status 139
Setting up kdelibs-data (3.5.4-0ubuntu10) ...

(update-desktop-database:29192): GLib-CRITICAL **: g_key_file_get_string_list: assertion `group_name != NULL' failed
/var/lib/dpkg/info/kdelibs-data.postinst: line 16: 29192 Segmentation fault update-desktop-database -q
dpkg: error processing kdelibs-data (--configure):
 subprocess post-installation script returned error exit status 139

What am I expected to do?

Revision history for this message
Paul Dufresne (paulduf) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering is this still an issue for you? Can you try with latest Ubuntu release? Thanks in advance.

Changed in kdebase:
assignee: nobody → dufresnep
status: New → Incomplete
Revision history for this message
Bill Wilken (bill-wilken) wrote :

I'm experiencing the same problem when attempting to uninstall yelp and openoffice. The problem occurs whether I use aptitude, the synaptic package manager, or "apt" commands from a terminal session. I'm running Gnome desktop version 2.20.1 with the latest incarnation of "Gutsy" in 16-bit mode. Will be happy to provide dumps, etc. if useful.

Revision history for this message
Paul Dufresne (paulduf) wrote :

Hi Bill!
Do you have g_key_file_get_string_list: assertion `group_name != NULL' failed too?
If not, I would probably consider it a different bug, that should be reported in a new bug report.
In that case, you may want to explore in GUI /var/crash, and 'double-'click the crash file to be guided in reporting bug.

Well, while trying to learn what is update-desktop-database, I extracted code I believe to be the culprit (seems the same in Gutsy and Hardy):
static void
process_desktop_file (const char *desktop_file,
                      const char *name,
                      GError **error)
{
  GError *load_error;
  GKeyFile *keyfile;
  char **mime_types;
  int i;

  keyfile = g_key_file_new ();

  load_error = NULL;
  g_key_file_load_from_file (keyfile, desktop_file,
                             G_KEY_FILE_NONE, &load_error);

  if (load_error != NULL)
    {
      g_propagate_error (error, load_error);
      return;
    }

  mime_types = g_key_file_get_string_list (keyfile,
                                           g_key_file_get_start_group (keyfile),
                                           "MimeType", NULL, &load_error);

  g_key_file_free (keyfile);

As I have no clue at all what that code does, I'll need a bit of time to undestand it. ;-)

That said, when I do:
sudo apt-get remove yelp
on my Hardy system, I get no error at all.

Revision history for this message
Paul Dufresne (paulduf) wrote :

Bill, could you in a terminal issue:
update-desktop-database -v 2>~/update-desktop-database.out
and then attach the resulting update-desktop-database.out file in your home directory to this report?

Revision history for this message
Paul Dufresne (paulduf) wrote :

Oh Bill, could you also do:
 ls -l /usr/share/applications/*.desktop > ~/ls.out
and attach the resulting ls.out to this report? Please!

I suspect a file among that to not be to root:root, but as I have no idea what I am doing, well, ...

Revision history for this message
Paul Dufresne (paulduf) wrote :

Hum, it is very likely that one of your .desktop files have lost it's first line:
[Desktop Entry]
causing g_key_file_get_start_group (keyfile) to return NULL.

The previously posted code suppose there is always a first group (that is a [section] in the .desktop file) which is plain wrong.
The could should be something similar to:
  if (start_group=g_key_file_get_start_group (keyfile) != NULL)
    mime_types = g_key_file_get_string_list (keyfile,
                                           start_group,
                                           "MimeType", NULL, &load_error);
  else /* Warning! your file ... have no [Desktop Entry] at the begginning */

or something similar (I never programmed GLib code, so I'll let developer write some good code).

So Bill, it is not necessary to post info, but it would not be bad if you do.

I'll mark this as affecting Hardy too, and confirm the bug now.

Changed in desktop-file-utils:
status: Incomplete → Confirmed
Revision history for this message
Bill Wilken (bill-wilken) wrote : Re: [Bug 59392] Re: update-desktop-database segfault

Paul,

Oh yea, get the "group_name" error you describe below. For whatever
reason, the apps that are associated with this problem are OpenOffice,
Java runtime, and Yelp. Any installation which touches these apps
provokes the error and leads to a "139" exit. None of these apps can be
removed or reconfigured.

Bill

On Wed, 2008-01-02 at 22:13 +0000, Paul Dufresne wrote:
> Hi Bill!
> Do you have g_key_file_get_string_list: assertion `group_name != NULL' failed too?
> If not, I would probably consider it a different bug, that should be reported in a new bug report.
> In that case, you may want to explore in GUI /var/crash, and 'double-'click the crash file to be guided in reporting bug.
>
> Well, while trying to learn what is update-desktop-database, I extracted code I believe to be the culprit (seems the same in Gutsy and Hardy):
> static void
> process_desktop_file (const char *desktop_file,
> const char *name,
> GError **error)
> {
> GError *load_error;
> GKeyFile *keyfile;
> char **mime_types;
> int i;
>
> keyfile = g_key_file_new ();
>
> load_error = NULL;
> g_key_file_load_from_file (keyfile, desktop_file,
> G_KEY_FILE_NONE, &load_error);
>
> if (load_error != NULL)
> {
> g_propagate_error (error, load_error);
> return;
> }
>
> mime_types = g_key_file_get_string_list (keyfile,
> g_key_file_get_start_group (keyfile),
> "MimeType", NULL, &load_error);
>
> g_key_file_free (keyfile);
>
> As I have no clue at all what that code does, I'll need a bit of time to
> undestand it. ;-)
>
> That said, when I do:
> sudo apt-get remove yelp
> on my Hardy system, I get no error at all.
>

Revision history for this message
Bill Wilken (bill-wilken) wrote :
Download full text (15.1 KiB)

Paul,

I've attached the ls.out file. You'll note some links between
OpenOffice as originally installed by Ubuntu and an aborted effort this
afternoon to download and install the latest OpenOffice code from
OpenOffice.org Just haven't had time to clean things up.

Bill

On Wed, 2008-01-02 at 22:34 +0000, Paul Dufresne wrote:
> Oh Bill, could you also do:
> ls -l /usr/share/applications/*.desktop > ~/ls.out
> and attach the resulting ls.out to this report? Please!
>
> I suspect a file among that to not be to root:root, but as I have no
> idea what I am doing, well, ...
>

-rw-r--r-- 1 root root 8839 2007-10-24 10:07 /usr/share/applications/accessibility-keyboard.desktop
-rw-r--r-- 1 root root 1220 2007-09-21 06:19 /usr/share/applications/AdobeReader.desktop
-rw-r--r-- 1 root root 2399 2007-05-14 05:38 /usr/share/applications/alacarte.desktop
-rw-r--r-- 1 root root 392 2007-10-06 08:31 /usr/share/applications/apport-gtk-mime.desktop
-rw-r--r-- 1 root root 11995 2007-10-24 10:07 /usr/share/applications/at-properties.desktop
-rw-r--r-- 1 root root 695 2007-06-25 10:09 /usr/share/applications/audacity.desktop
-rwxr-xr-x 1 root root 320 2007-07-27 17:03 /usr/share/applications/automatix2.desktop
-rw-r--r-- 1 root root 8296 2007-09-18 12:16 /usr/share/applications/baobab.desktop
-rw-r--r-- 1 root root 489 2007-09-28 07:00 /usr/share/applications/bluetooth-analyzer.desktop
-rw-r--r-- 1 root root 1555 2007-09-28 07:00 /usr/share/applications/bluetooth-properties.desktop
-rw-r--r-- 1 root root 9149 2007-04-27 10:56 /usr/share/applications/bug-buddy.desktop
-rw-r--r-- 1 root root 9172 2007-09-19 08:48 /usr/share/applications/cddb-slave.desktop
-rw-r--r-- 1 root root 8332 2007-10-24 10:07 /usr/share/applications/default-applications.desktop
-rw-r--r-- 1 root root 1445 2007-10-12 20:21 /usr/share/applications/displayconfig-gtk.desktop
-rw-r--r-- 1 root root 7028 2007-10-24 10:07 /usr/share/applications/display-properties.desktop
-rw-r--r-- 1 root root 2405 2007-05-18 06:55 /usr/share/applications/djvulibre-djview3.desktop
-rw-r--r-- 1 root root 9751 2007-09-30 07:46 /usr/share/applications/ekiga.desktop
-rw-r--r-- 1 root root 5979 2007-10-19 15:08 /usr/share/applications/eog.desktop
-rw-r--r-- 1 root root 10112 2007-10-22 12:04 /usr/share/applications/evince.desktop
-rw-r--r-- 1 root root 3987 2007-10-23 14:59 /usr/share/applications/evolution-2.2.desktop
-rw-r--r-- 1 root root 8349 2007-10-23 14:58 /usr/share/applications/evolution.desktop
-rw-r--r-- 1 root root 1547 2007-10-23 14:59 /usr/share/applications/evolution-mail.desktop
-rw-r--r-- 1 root root 11754 2007-10-19 15:37 /usr/share/applications/file-roller.desktop
-rw-r--r-- 1 root root 508 2007-10-09 06:45 /usr/share/applications/firefox-3.0.desktop
-rw-r--r-- 1 root root 2509 2007-12-04 05:21 /usr/share/applications/firefox.desktop
-rw-r--r-- 1 root root 5322 2007-10-19 15:31 /usr/share/applications/gcalctool.desktop
-rw-r--r-- 1 root root 10100 2007-09-18 06:37 /usr/share/applications/gconf-editor.desktop
-rw-r--r-- 1 root root 2272 2007-10-06 08:43 /usr/share/applications/gdebi.desktop
-rw-r--r-- 1 root root 7141 2007-10-22 11:54 /usr/share/applications/gedit....

Revision history for this message
Bill Wilken (bill-wilken) wrote :

Paul,

No can do. Running this command produces a segmentation fault ...
exactly the same problem that I encounter when attempting to remove Yelp
or OpenOffice.

Bill

On Wed, 2008-01-02 at 22:27 +0000, Paul Dufresne wrote:
> Bill, could you in a terminal issue:
> update-desktop-database -v 2>~/update-desktop-database.out
> and then attach the resulting update-desktop-database.out file in your home directory to this report?
>
>
> ** Bug watch added: Debian Bug tracker #396439
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=396439
>
> ** Also affects: desktop-file-utils via
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=396439
> Importance: Unknown
> Status: Unknown
>

Revision history for this message
Paul Dufresne (paulduf) wrote :

I was hoping that the update-desktop-database.out file would be created even if I was expecting it to segfault.
Maybe you can just sudo update-desktop-database -v
That should give something like:
Search path is now: [/usr/local/share/applications, /usr/share/applications]
File '/usr/share/applications/gnome-settings-mouse.desktop' lacks MimeType key
File '/usr/share/applications/freecell.desktop' lacks MimeType key
File '/usr/share/applications/gnotravex.desktop' lacks MimeType key
File '/usr/share/applications/sound-juicer.desktop' lacks MimeType key
File '/usr/share/applications/gnome-power-preferences.desktop' lacks MimeType key

up to some file, then segfault.
It would be cool if you could *attach* (go to the web site link, and to the bottom you will find 'Include an attachment' box) the last file listed just before the segfault.

Paul Dufresne (paulduf)
Changed in desktop-file-utils:
status: Confirmed → Incomplete
Revision history for this message
Paul Dufresne (paulduf) wrote :

Bill, it is possible that what I suggested you to do don't work.
At least Debian poster seems to say it does not work that way for him to find corrupted .desktop files.

I am speaking to developers here.
I WAS WRONG.
I have deliberately broken my /usr/share/applications/screensavers/flipscreen3d.desktop file by removing the
[desktop] line.
Then:
paul@Arcturus:~$ sudo update-desktop-database
Could not parse file '/usr/share/applications/screensavers/flipscreen3d.desktop': Key file does not start with a group
File '/usr/share/applications/totem.desktop' contains invalid MIME type '-e' that is missing a slash
paul@Arcturus:~$

So Hardy SEEMS (I am slowly becoming more prudent) to not be affected.

I tried to compare Gutsy and Hardy and they seems the same to me.
After:
  mime_types = g_key_file_get_string_list (keyfile,
                                           g_key_file_get_start_group (keyfile),
                                           "MimeType", NULL, &load_error);
Code does:
  g_key_file_free (keyfile);

  if (load_error != NULL)
    {
      g_propagate_error (error, load_error);
      return;
    }

I have a new ... *hypothesis*
I now believe that this code is right.
But that there was an assert in the Glib for the g_key_file_get_start_group in Gutsy that have been removed in Hardy.
So that now g_propagate_error do work (and was not going up to there in Gutsy because of the hypothetical assert).

Revision history for this message
Paul Dufresne (paulduf) wrote :

Hi again Bill!
You could try:
grep -r -L "\[Desktop Entry\]" /usr/share/applications/*|grep .desktop
This is supposed to show .desktop files that don't contain "[Desktop Entry]" which would in my
opinion be the cause of your bug.

If you find zero, it probably means I made some bad assumption.
If you find one or two, then they are likely to be the cause of your problem. Please attach it (or them).
If you find a lot, then, again I must have make an other bad assumption.

Changed in desktop-file-utils:
status: Unknown → New
Revision history for this message
Bill Wilken (bill-wilken) wrote :
Download full text (16.6 KiB)

Here is the output you requested:

wilkenw@Linux:~$ sudo update-desktop-database -v
Search path is now: [/usr/local/share/applications, /usr/share/applications, /usr/share/gdm/applications]
File '/usr/share/applications/screensavers/antinspect.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/antspotlight.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/atunnel.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/biof.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/blinkbox.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/braid.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/bubble3d.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/busyspheres.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/circuit.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/colorfire.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/cosmos-slideshow.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/cubestorm.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/cyclone.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/deco.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/distort.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/endgame.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/engine.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/euphoria.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/fiberlamp.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/fieldlines.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/flipflop.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/flipscreen3d.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/flocks.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/flurry.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/flux.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/flyingtoasters.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/footlogo-floaters.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/fuzzyflakes.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/galaxy.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/gears.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/gflux.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/glblur.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/gleidescope.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/glknots.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/glmatrix.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/glslideshow.desktop' lacks MimeType key
File '/usr/share/applications/screensavers/glsnake.desktop' lacks MimeType key
File '/usr/share/applications/screensa...

Revision history for this message
Bill Wilken (bill-wilken) wrote :

Paul,

Very interesting .... I found one file without a "[Desktop Entry]" --
one for my NVIDA graphics card that I had to add using "restricted
drivers" for a GeForce FX5500 (which, no matter what I try, does not
work as well under Ubuntu as under Windows -- perhaps because Ubuntu
lacks drivers for my Samsung SyncMaster 170T)

Bill

On Thu, 2008-01-03 at 05:36 +0000, Paul Dufresne wrote:
> Hi again Bill!
> You could try:
> grep -r -L "\[Desktop Entry\]" /usr/share/applications/*|grep .desktop
> This is supposed to show .desktop files that don't contain "[Desktop Entry]" which would in my
> opinion be the cause of your bug.
>
> If you find zero, it probably means I made some bad assumption.
> If you find one or two, then they are likely to be the cause of your problem. Please attach it (or them).
> If you find a lot, then, again I must have make an other bad assumption.
>

Revision history for this message
Bill Wilken (bill-wilken) wrote : Re: [Bug 59392] Re: update-desktop-database segfault -- SOLUTION!!!!

Paul,

After I sent my last message, I removed two completely empty
placeholders for my NVDIA card from /usr/share/applications (plus
discarded a small number of "dead" entries for applications which no
longer exist on my system) and as they say in Gay Paris, "Voila!", no
more segmentation faults when attempting to add/update/remove
applications.

Thanks for your help. I should have thought to inspect the contents of
my desktop directory entries. Nonetheless, I suspect it would be
helpful if a good coder would include some "if-then" logic that tests
for incomplete/damaged desktop entries rather than allowing Ubuntu to
generate a segmentation fault.

Bill

On Thu, 2008-01-03 at 05:36 +0000, Paul Dufresne wrote:
> Hi again Bill!
> You could try:
> grep -r -L "\[Desktop Entry\]" /usr/share/applications/*|grep .desktop
> This is supposed to show .desktop files that don't contain "[Desktop Entry]" which would in my
> opinion be the cause of your bug.
>
> If you find zero, it probably means I made some bad assumption.
> If you find one or two, then they are likely to be the cause of your problem. Please attach it (or them).
> If you find a lot, then, again I must have make an other bad assumption.
>

Paul Dufresne (paulduf)
Changed in desktop-file-utils:
status: Incomplete → Confirmed
Revision history for this message
Paul Dufresne (paulduf) wrote :

I am happy to see that things work for you now.
Like I said in a previous comment, when I remove "[Desktop Entry] in a .desktop file on Hardy, it does not segfaults, so the problem should be gone in Hardy.

About your Nvidia card, it is unlikely to be because of your monitor, as monitor don't need driver (as far as I know), X knows how to 'speak' with monitor, and query size, resolutions supported, etc. (It read a 128 bytes structure called EDID transmitted from the monitor). That said, I have seen bugs where Samsung monitors's EDID were giving bad size, giving huge fonts.

You could try to ask help on:
https://answers.launchpad.net/ubuntu/+questions?field.search_text=FX+5500&field.sort=RELEVANCY&field.sort-empty-marker=1&field.actions.search=Search&field.language=fr&field.language=en&field.language-empty-marker=1&field.status=OPEN&field.status=NEEDSINFO&field.status=ANSWERED&field.status=SOLVED&field.status-empty-marker=1
and use blue 'ask a question' in upper right.

Or maybe this forum thread can help you:
http://ubuntuforums.org/showthread.php?t=637365

But your Nvidia card does not concern this bug, so, we should stop discussing it here.

Revision history for this message
Paul Dufresne (paulduf) wrote :

To developers:
I have tried to create an empty .desktop file on Hardy: no segfault, just a nice error message:
paul@Arcturus:~$ update-desktop-database
Could not parse file '/usr/share/applications/screensavers/flipscreen3d.desktop': Key file does not start with a group
File '/usr/share/applications/totem.desktop' contains invalid MIME type '-e' that is missing a slash
Could not parse file '/usr/share/applications/boom.desktop': File is empty
No directories in update-desktop-database search path could be processed and updated.
paul@Arcturus:~$

I really should look at that totem.desktop file.

Paul Dufresne (paulduf)
Changed in desktop-file-utils:
assignee: dufresnep → nobody
Revision history for this message
Sebastien Bacher (seb128) wrote :

Does anybody has an example triggering a crash on hardy?

Changed in desktop-file-utils:
importance: Undecided → Medium
status: Confirmed → Incomplete
Changed in desktop-file-utils:
status: New → Fix Released
Revision history for this message
Sebastien Bacher (seb128) wrote :

closing since there is no reply and nobody seems to have the issue using the new versions, feel free to reopen if you still get the bug though

Changed in desktop-file-utils:
status: Incomplete → Invalid
Revision history for this message
Ozzyprv (ozzyprv) wrote :

How can I get the fix? I think I am getting the same error message.

Revision history for this message
Bill Wilken (bill-wilken) wrote : Re: [Bug 59392] Re: update-desktop-database segfault

Take a look at the script fix suggested on the Ubuntu site. It worked
for me.

BIll

On Mon, 2008-03-03 at 03:52 +0000, Ozzyprv wrote:
> How can I get the fix? I think I am getting the same error message.
>

Revision history for this message
Ozzyprv (ozzyprv) wrote :

Thank you Bill, problem solved.
I got the same empty place holder, for my nvidia card. The empty file was NVIDIA-Settings.desktop. I removed the file and the problem is gone.
I remember creating that placeholder when I installed the nvidia driver to get it to work on my laptop (HP) which is still running Feisty.

Oz.

Revision history for this message
Sebastien Bacher (seb128) wrote :

did anybody get the issue? could you attach an example to the bug?

Revision history for this message
Ozzyprv (ozzyprv) wrote :

Error I was getting:
*********************
Synaptic error
E: pidgin: subprocess post-removal script returned error exit status 139
*********************
Error from console

me@My:~$ sudo apt-get install minicom
Reading package lists... Done
Building dependency tree
Reading state information... Done
Recommended packages:
  lrzsz
The following packages will be REMOVED:
  pidgin
The following NEW packages will be installed:
  minicom
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
11 not fully installed or removed.
Need to get 0B/179kB of archives.
After unpacking, 624kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 109145 files and directories currently installed.)
Removing pidgin ...

(update-desktop-database:6538): GLib-CRITICAL **: g_key_file_get_string_list: assertion `group_name != NULL' failed
Segmentation fault (core dumped)
dpkg: error processing pidgin (--remove):
 subprocess post-removal script returned error exit status 139
Errors were encountered while processing:
 pidgin
E: Sub-process /usr/bin/dpkg returned an error code (1)
*************************

I removed NVIDIA-Settings.desktop and the problem was solved. That .desktop files was empty, did not have the [Desktop Entry\] at all.

O.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.