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 506772 - glib-CRITICAL assertion in evolution-addressbook-export
glib-CRITICAL assertion in evolution-addressbook-export
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Calendar
2.12.x (obsolete)
Other All
: Normal minor
: ---
Assigned To: evolution-calendar-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2008-01-02 01:24 UTC by Christian Krause
Modified: 2008-01-06 16:53 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
small patch to fix the problem (1.04 KB, patch)
2008-01-02 01:34 UTC, Christian Krause
accepted-commit_now Details | Review
alternative patch addressing comment #3 (2.12 KB, patch)
2008-01-06 15:20 UTC, Christian Krause
committed Details | Review

Description Christian Krause 2008-01-02 01:24:07 UTC
Please describe the problem:
when using evolution-addressbook-export always a glib-CRITICAL assertion is printed out

Steps to reproduce:
1. just call
/usr/libexec/evolution/2.12/evolution-addressbook-export



Actual results:
the following error message is printed out on stderr:

(evolution-addressbook-export:5098): GLib-CRITICAL **: g_strv_length: assertion `str_array != NULL' failed


Expected results:
no error message ;-)

Does this happen every time?
yes

Other information:
the reason is, that in evolution-addressbook-export.c, line 171 the variable "opt_remaining" is used as argument of g_strv_length, which expects an NULL terminated character array and not the NULL-pointer itself

if there is no "remaining" option on the cmd line given then opt_remaining isn't touched and stays with it's initial value of NULL

I'll attach a trivial patch against the trunk to fix the problem.
Comment 1 Christian Krause 2008-01-02 01:34:22 UTC
Created attachment 101962 [details] [review]
small patch to fix the problem

the patch fixes the problem for evolution-addressbook-export as well as for the evolution-backup tool
Comment 2 Srinivasa Ragavan 2008-01-02 05:28:20 UTC
Looks fine. commit to trunk.
Comment 3 Suman Manjunath 2008-01-05 18:07:33 UTC
The first hunk looks good.. 

The second hunk can be improved as follows: 

+ if (opt_remaining)
+     for (i = 0; i < g_strv_length (opt_remaining); i++) {

instead of: 

- for (i = 0; opt_remaining && i < g_strv_length (opt_remaining); i++) {

[Note that opt_remaining is not modified in-place within the loop and hence this suggestion is valid]

That *would* save a few precious CPU cycles. 
Comment 4 Christian Krause 2008-01-06 15:20:37 UTC
Created attachment 102271 [details] [review]
alternative patch addressing comment #3

I've added an alternative patch which addresses the problems of comment #3. Please can anybody submit it to evolution SVN? Thanks!

Best regards,
Christian
Comment 5 Suman Manjunath 2008-01-06 16:53:48 UTC
If you trace the codepath, you'll observe that the backup/restore/check operations in backup.c would be operating on NULL or invalid strings due to uninitialized pointers. Fixed those issues in the committed patch. 

Committed to SVN trunk r34768
(http://svn.gnome.org/viewvc/evolution?view=revision&revision=34768)

Please do attach ChangeLogs alongwith the patches. You can use this [1] script to prepare your own ChangeLogs :)

[1] http://developer.gnome.org/tools/scripts/prepare-ChangeLog.pl