addresses from balsa-ab are not encoded properly

View: New views
12 Messages — Rating Filter:   Alert me  

addresses from balsa-ab are not encoded properly

by Ildar Mulyukov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

        Hi!
Adding an address from the balsa address book leads to non-encoded To:  
header. For example, see this message's To:.

Best,
--
Ildar  Mulyukov,  free SW designer/programmer/packager
=========================================
email: ildar@...
Jabber: ildar@...
ICQ: 4334029
ALT Linux Sisyphus http://www.sisyphus.ru
=========================================

_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: addresses from balsa-ab are not encoded properly

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ildar!

On 08/12/2009 12:43:22 AM Wed, Ildar Mulyukov wrote:

======quoted message from Ildar Mulyukov <ildar@...>, subject  
"addresses from balsa-ab are not encoded properly"======
> Hi!
> Adding an address from the balsa address book leads to non-encoded To:  
> header. For example, see this message's To:.

I see it--but I can't reproduce it!  I added that address to a gnome-card  
address book (where it's stored in UTF-8) and an ldif book (where it's  
stored in base-64-encoded ASCII), and drafted a message to it.  Regardless  
of which book I used, and whether I added the address using  
entry-completion or clicking the book icon, it was correctly encoded in  
the draft-box:

To: =?UTF-8?b?0JHQsNC70YzRgdCwLdC70LjRgdGC?= <balsa-list@...>

Should that not have exhibited the problem?  Am I doing something  
different from you?  Perhaps it's somehow locale-related?

Regards,

Peter
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: addresses from balsa-ab are not encoded properly

by Ildar Mulyukov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

        Hi, Peter!
You do everything right. I can't figure out why the bug didn't appear  
on your site.
What I do:
1. New message
2. type b in To: field
3. choose Бальса-лист <balsa-list@...> from the drop-down
4. Save the message
5. Open the message Drafts
6. View Source.
I see
> To:  
> \320\221\320\260\320\273\321\214\321\201\320\260-\320\273\320\270\321\201\321\202  
> <balsa-list@...>

The entry is from the Balsa VCard addr.book. I don't think it's  
locale-related, as I could reproduce it in LANG=C.
Regards, Ildar
P.S. recent time balsa complains in the run-time:
> (balsa:9399): Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display:  
> assertion `atom != GDK_NONE' failed
> Cannot open: unable to open database file
Do you have a good explanation for this?



On 12.08.2009 20:15:02, Peter Bloomfield wrote:

> Hi Ildar!
>
> On 08/12/2009 12:43:22 AM Wed, Ildar Mulyukov wrote:
>
> ======quoted message from Ildar Mulyukov <ildar@...>, subject  
> "addresses from balsa-ab are not encoded properly"======
>> Hi!
>> Adding an address from the balsa address book leads to non-encoded  
>> To: header. For example, see this message's To:.
>
> I see it--but I can't reproduce it!  I added that address to a  
> gnome-card address book (where it's stored in UTF-8) and an ldif book  
> (where it's stored in base-64-encoded ASCII), and drafted a message  
> to it.  Regardless of which book I used, and whether I added the  
> address using entry-completion or clicking the book icon, it was  
> correctly encoded in the draft-box:
>
> To: =?UTF-8?b?0JHQsNC70YzRgdCwLdC70LjRgdGC?= <balsa-list@...>
>
> Should that not have exhibited the problem?  Am I doing something  
> different from you?  Perhaps it's somehow locale-related?
>
> Regards,
>
> Peter
> _______________________________________________
> balsa-list mailing list
> balsa-list@...
> http://mail.gnome.org/mailman/listinfo/balsa-list


--
Ildar  Mulyukov,  engineer

=============================
email: ildar@...
Atatau Innovations
Office 27, etazh 4
169/1 Raimbek
Almaty, Kazakhstan
tel.: +7(727)2379281 ext.2203
fax.: +7(727)2379282
=============================
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: addresses from balsa-ab are not encoded properly

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ildar:

On 08/13/2009 12:03:11 AM Thu, Ildar Mulyukov wrote:

> Hi, Peter!
> You do everything right. I can't figure out why the bug didn't appear on  
> your site.
> What I do:
> 1. New message
> 2. type b in To: field
> 3. choose Бальса-лист <balsa-list@...> from the drop-down
> 4. Save the message
> 5. Open the message Drafts
> 6. View Source.
> I see
>> To:  
>> \320\221\320\260\320\273\321\214\321\201\320\260-\320\273\320\270\321\201\321\202  
>> <balsa-list@...>
>
> The entry is from the Balsa VCard addr.book. I don't think it's  
> locale-related, as I could reproduce it in LANG=C.
If you paste the address directly into the address field, does the same  
thing happen?  Looking over the code, I don't see any place where an  
address grabbed from an address book is handled any differently from one  
that's typed or pasted in, as far as encoding is concerned.

> P.S. recent time balsa complains in the run-time:
>> (balsa:9399): Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display:  
>> assertion `atom != GDK_NONE' failed
>> Cannot open: unable to open database file
> Do you have a good explanation for this?

Sadly, no!  The Gdk-CRITICAL warning occurs when Balsa (or any other app)  
uses gtk_dialog_run() to present a modal dialog.  
<URL:http://mail.gnome.org/archives/gtk-list/2009-June/msg00017.html>  
suggests that it should be fixed in some gtk update, but I'm still seeing  
it in 2.16.5.

The "Cannot open:" string is in Balsa's GPE (sqlite) address book code, in  
a section handling errors in sqlite3_open().  Do you see that error in a  
predictable way?  If so, could you apply the attached patch?  It doesn't  
fix anything, just adds the database file name to the error message, but  
that might help diagnose it.

Thanks!

Peter

[gpe-patch]

diff --git a/libbalsa/address-book-gpe.c b/libbalsa/address-book-gpe.c
index efbad1a..afc61fe 100644
--- a/libbalsa/address-book-gpe.c
+++ b/libbalsa/address-book-gpe.c
@@ -196,21 +196,21 @@ libbalsa_address_book_gpe_open_db(LibBalsaAddressBookGpe * ab)
 {
 #ifdef HAVE_SQLITE3
     gchar *dir, *name;
-    int r;
 
     dir = g_build_filename(g_get_home_dir(), ".gpe", NULL);
     mkdir(dir, S_IRUSR|S_IWUSR|S_IXUSR);
     name = g_build_filename(dir, "contacts", NULL);
     g_free(dir);
-    r = sqlite3_open(name, &ab->db);
-    g_free(name);
 
-    if (r != SQLITE_OK) {
-        printf("Cannot open: %s\n", sqlite3_errmsg(ab->db));
+    if (sqlite3_open(name, &ab->db) != SQLITE_OK) {
+        printf("Cannot open \"%s\": %s\n", name, sqlite3_errmsg(ab->db));
+        g_free(name);
         sqlite3_close(ab->db);
         ab->db = NULL;
         return 0;
     }
+    g_free(name);
+
     sqlite3_exec(ab->db, schema_str,  NULL, NULL, NULL);
     sqlite3_exec(ab->db, schema2_str, NULL, NULL, NULL);
 #else                           /* HAVE_SQLITE3 */


_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Critical warning [was Re: addresses from balsa-ab are not encoded properly]

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 08/13/2009 06:46:06 AM Thu, Peter Bloomfield wrote:
[ snip ]

>> P.S. recent time balsa complains in the run-time:
>>> (balsa:9399): Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display:  
>>> assertion `atom != GDK_NONE' failed
>>> Cannot open: unable to open database file
>> Do you have a good explanation for this?
>
> Sadly, no!  The Gdk-CRITICAL warning occurs when Balsa (or any other  
> app) uses gtk_dialog_run() to present a modal dialog.  
> <URL:http://mail.gnome.org/archives/gtk-list/2009-June/msg00017.html>  
> suggests that it should be fixed in some gtk update, but I'm still  
> seeing it in 2.16.5.

See <URL:https://bugzilla.redhat.com/show_bug.cgi?id=508915>.  The warning  
was apparently inserted in the code tree for the f11 package--upstream  
shows no sign of it.  I interpret it as a misplaced fix for a minor bug in  
lookup_cached_xatom, which leads to a redundant but harmless entry in a  
pair of hash tables when gdk_x11_atom_to_xatom_for_display is passed  
GDK_NONE.  I posted a patch, if you're interested in a fix!

Best,

Peter
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: addresses from balsa-ab are not encoded properly

by Ildar Mulyukov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 13.08.2009 16:46:06, Peter Bloomfield wrote:
> If you paste the address directly into the address field, does the  
> same thing happen?  Looking over the code, I don't see any place  
> where an address grabbed from an address book is handled any  
> differently from one that's typed or pasted in, as far as encoding is  
> concerned.

Yes, Peter. I see it better now:
   * If I Paste the address into the To: line, the bug is emerged
   * If I type the address manually, the non-latin name is encoded just  
right

So nothing addr.book-specific.
Any ideas? If you need some more info, then let me know.

>> P.S. recent time balsa complains in the run-time:
>>> (balsa:9399): Gdk-CRITICAL **: gdk_x11_atom_to_xatom_for_display:  
>>> assertion `atom != GDK_NONE' failed
>>> Cannot open: unable to open database file
>> Do you have a good explanation for this?
> Sadly, no!  The Gdk-CRITICAL warning occurs when Balsa (or any other  
> app) uses gtk_dialog_run() to present a modal dialog.  
> <URL:http://mail.gnome.org/archives/gtk-list/2009-June/msg00017.html>  
> suggests that it should be fixed in some gtk update, but I'm still  
> seeing it in 2.16.5.

Yeah. I see. Sorry for off-topic.


> The "Cannot open:" string is in Balsa's GPE (sqlite) address book  
> code, in a section handling errors in sqlite3_open().  Do you see  
> that error in a predictable way?  If so, could you apply the attached  
> patch?  It doesn't fix anything, just adds the database file name to  
> the error message, but that might help diagnose it.

Exactly right!

Thanks a lot and best regards!
--
Ildar  Mulyukov,  free SW designer/programmer/packager
=========================================
email: ildar@...
Jabber: ildar@...
ICQ: 4334029
ALT Linux Sisyphus http://www.sisyphus.ru
=========================================
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: addresses from balsa-ab are not encoded properly

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ildar:

On Aug 18, 2009, at  1:48 AM, Ildar Mulyukov wrote:

> On 13.08.2009 16:46:06, Peter Bloomfield wrote:
>> If you paste the address directly into the address field, does the same  
>> thing happen?  Looking over the code, I don't see any place where an  
>> address grabbed from an address book is handled any differently from  
>> one that's typed or pasted in, as far as encoding is concerned.
>
> Yes, Peter. I see it better now:
>   * If I Paste the address into the To: line, the bug is emerged
>   * If I type the address manually, the non-latin name is encoded just  
> right
>
> So nothing addr.book-specific.
> Any ideas? If you need some more info, then let me know.
Hmm...well, pasting and entering from an address-book match both insert a  
block of text, whereas typing is one character at a time.  The address  
widget does some low-level signal handling to catch the escape key, and  
also to strip newlines from blocks of text--just the sort of stuff that  
waits around to jump up and bite you.  So finding some difference between  
block entry and character entry wouldn't be a huge surprise.  But when you  
and I get different results from the same set of actions, I'm still  
mystified!

The attached patch dumps the To: address in hex when the message is  
created in the out-box or draft-box.  Could you try it?  It may offer some  
clue as to what the difference is.

Thanks!

Peter

[send-debug-patch]

diff --git a/libbalsa/send.c b/libbalsa/send.c
index 79d8d0f..7f464ff 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -1901,6 +1901,43 @@ libbalsa_message_create_mime_message(LibBalsaMessage* message, gboolean flow,
 
     recipients = g_mime_message_get_recipients(mime_message,
                                                GMIME_RECIPIENT_TYPE_TO);
+
+{                               /* begin debug */
+    guint i, len;
+    if (message->headers->to_list
+        && (len =
+            internet_address_list_length(message->headers->to_list) > 0)) {
+        for (i = 0; i < len; i++) {
+            InternetAddress *ia =
+                internet_address_list_get_address(message->
+                                                  headers->to_list, i);
+            const gchar *name, *addr;
+            if (INTERNET_ADDRESS_IS_GROUP(ia)) {
+                g_print("%s skipping group %s\n", __func__,
+                        internet_address_get_name(ia));
+                continue;
+            }
+            name = internet_address_get_name(ia);
+            g_print("%s name \"%s\", hex:", __func__, name);
+            while (*name) {
+                g_print(" %c", "0123456789abcdef"[(*name >> 4) & 0x0f]);
+                g_print("%c", "0123456789abcdef"[(*name) & 0x0f]);
+                ++name;
+            }
+            g_print("\n");
+            addr =
+                internet_address_mailbox_get_addr(INTERNET_ADDRESS_MAILBOX(ia));
+            g_print("%s address \"%s\", hex:", __func__, addr);
+            while (*addr) {
+                g_print(" %c", "0123456789abcdef"[(*addr >> 4) & 0x0f]);
+                g_print("%c", "0123456789abcdef"[(*addr) & 0x0f]);
+                ++addr;
+            }
+            g_print("\n");
+        }
+    }
+}                               /* end debug */
+
     internet_address_list_append(recipients, message->headers->to_list);
     
     recipients = g_mime_message_get_recipients(mime_message,


_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: addresses from balsa-ab are not encoded properly

by Ildar Mulyukov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 20.08.2009 00:56:28, Peter Bloomfield wrote:
> ... But when you and I get different results from the same set of  
> actions, I'm still mystified!
>
> The attached patch dumps the To: address in hex when the message is  
> created in the out-box or draft-box.  Could you try it?  It may offer  
> some clue as to what the difference is.

libbalsa_message_create_mime_message name "Бальса-лист", hex: d0 91 d0  
b0 d0 bb d1 8c d1 81 d0 b0 2d d0 bb d0 b8 d1 81 d1 82
libbalsa_message_create_mime_message address "balsa-list@...",  
hex: 62 61 6c 73 61 2d 6c 69 73 74 40 67 6e 6f 6d 65 2e 6f 72 67

As exected.

Regards, Ildar
P.S. BTW, unfortunately your patch segfaults balsa in many cases.
--
Ildar  Mulyukov,  free SW designer/programmer/packager
=========================================
email: ildar@...
Jabber: ildar@...
ICQ: 4334029
ALT Linux Sisyphus http://www.sisyphus.ru
=========================================
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: addresses from balsa-ab are not encoded properly

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ildar:

On 08/20/2009 06:03:20 AM Thu, Ildar Mulyukov wrote:

> On 20.08.2009 00:56:28, Peter Bloomfield wrote:
>> ... But when you and I get different results from the same set of  
>> actions, I'm still mystified!
>>
>> The attached patch dumps the To: address in hex when the message is  
>> created in the out-box or draft-box.  Could you try it?  It may offer  
>> some clue as to what the difference is.
>
> libbalsa_message_create_mime_message name "Бальса-лист", hex: d0 91 d0  
> b0 d0 bb d1 8c d1 81 d0 b0 2d d0 bb d0 b8 d1 81 d1 82
> libbalsa_message_create_mime_message address "balsa-list@...",  
> hex: 62 61 6c 73 61 2d 6c 69 73 74 40 67 6e 6f 6d 65 2e 6f 72 67
>
> As exected.
Was that typed or pasted?  And did it result in an encoded name in the  
draft-box, or not?

> Regards, Ildar
> P.S. BTW, unfortunately your patch segfaults balsa in many cases.

Ouch--yes, it just hit me, too!  More careful patch attached.

Thanks for the testing!

Peter

[send-debug-2-patch]

diff --git a/libbalsa/send.c b/libbalsa/send.c
index 79d8d0f..1c9dba1 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -1901,6 +1901,47 @@ libbalsa_message_create_mime_message(LibBalsaMessage* message, gboolean flow,
 
     recipients = g_mime_message_get_recipients(mime_message,
                                                GMIME_RECIPIENT_TYPE_TO);
+
+{                               /* begin debug */
+    guint i, len;
+    if (message->headers->to_list
+        && (len =
+            internet_address_list_length(message->headers->to_list) > 0)) {
+        for (i = 0; i < len; i++) {
+            InternetAddress *ia =
+                internet_address_list_get_address(message->
+                                                  headers->to_list, i);
+            const gchar *name, *addr;
+            if (INTERNET_ADDRESS_IS_GROUP(ia)) {
+                g_print("%s skipping group %s\n", __func__,
+                        internet_address_get_name(ia));
+                continue;
+            }
+            name = internet_address_get_name(ia);
+            g_print("%s name \"%s\", hex:", __func__, name);
+            if (name) {
+                while (*name) {
+                    g_print(" %c", "0123456789abcdef"[(*name >> 4) & 0x0f]);
+                    g_print("%c", "0123456789abcdef"[(*name) & 0x0f]);
+                    ++name;
+                }
+            }
+            g_print("\n");
+            addr =
+                internet_address_mailbox_get_addr(INTERNET_ADDRESS_MAILBOX(ia));
+            g_print("%s address \"%s\", hex:", __func__, addr);
+            if (addr) {
+                while (*addr) {
+                    g_print(" %c", "0123456789abcdef"[(*addr >> 4) & 0x0f]);
+                    g_print("%c", "0123456789abcdef"[(*addr) & 0x0f]);
+                    ++addr;
+                }
+            }
+            g_print("\n");
+        }
+    }
+}                               /* end debug */
+
     internet_address_list_append(recipients, message->headers->to_list);
     
     recipients = g_mime_message_get_recipients(mime_message,


_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: addresses from balsa-ab are not encoded properly

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 08/20/2009 08:52:32 AM Thu, Peter Bloomfield wrote:

> Hi Ildar:
>
> On 08/20/2009 06:03:20 AM Thu, Ildar Mulyukov wrote:
>> On 20.08.2009 00:56:28, Peter Bloomfield wrote:
>>> ... But when you and I get different results from the same set of  
>>> actions, I'm still mystified!
>>>
>>> The attached patch dumps the To: address in hex when the message is  
>>> created in the out-box or draft-box.  Could you try it?  It may offer  
>>> some clue as to what the difference is.
>>
>> libbalsa_message_create_mime_message name "Бальса-лист", hex: d0 91 d0  
>> b0 d0 bb d1 8c d1 81 d0 b0 2d d0 bb d0 b8 d1 81 d1 82
>> libbalsa_message_create_mime_message address "balsa-list@...",  
>> hex: 62 61 6c 73 61 2d 6c 69 73 74 40 67 6e 6f 6d 65 2e 6f 72 67
>>
>> As exected.
>
> Was that typed or pasted?  And did it result in an encoded name in the  
> draft-box, or not?
>
>> Regards, Ildar
>> P.S. BTW, unfortunately your patch segfaults balsa in many cases.
>
> Ouch--yes, it just hit me, too!  More careful patch attached.

Any more insights?

Peter
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: addresses from balsa-ab are not encoded properly

by Ildar Mulyukov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 20.08.2009 18:52:32, Peter Bloomfield wrote:
> Was that typed or pasted?  And did it result in an encoded name in  
> the draft-box, or not?
>
>> Regards, Ildar
>> P.S. BTW, unfortunately your patch segfaults balsa in many cases.
>
> Ouch--yes, it just hit me, too!  More careful patch attached.
>
> Thanks for the testing!

from AB:
libbalsa_message_create_mime_message name "Бальса-лист", hex: d0 91 d0  
b0 d0 bb d1 8c d1 81 d0 b0 2d d0 bb d0 b8 d1 81 d1 82
libbalsa_message_create_mime_message address "balsa-list@...",  
hex: 62 61 6c 73 61 2d 6c 69 73 74 40 67 6e 6f 6d 65 2e 6f 72 67

Pasted:
libbalsa_message_create_mime_message name "Бальса-лист", hex: d0 91 d0  
b0 d0 bb d1 8c d1 81 d0 b0 2d d0 bb d0 b8 d1 81 d1 82
libbalsa_message_create_mime_message address "balsa-list@...",  
hex: 62 61 6c 73 61 2d 6c 69 73 74 40 67 6e 6f 6d 65 2e 6f 72 67

typed:
libbalsa_message_create_mime_message name "фыва", hex: d1 84 d1 8b d0  
b2 d0 b0
libbalsa_message_create_mime_message address "a@...", hex: 61 40 62 2e  
63

Peter, I have a guess: may it be related to a newer GTK+? I have  
libgtk+2-2.16.5-alt3... Maybe some trigger is not pulled or some  
control changed it's behavior?

Regards,
--
Ildar  Mulyukov,  free SW designer/programmer/packager
=========================================
email: ildar@...
Jabber: ildar@...
ICQ: 4334029
ALT Linux Sisyphus http://www.sisyphus.ru
=========================================
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: addresses from balsa-ab are not encoded properly

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ildar:

On 08/26/2009 04:02:52 AM Wed, Ildar Mulyukov wrote:
[ snip ]
> Peter, I have a guess: may it be related to a newer GTK+? I have  
> libgtk+2-2.16.5-alt3... Maybe some trigger is not pulled or some control  
> changed it's behavior?

I'm on the same version, different packaging: gtk2-2.16.5-1.fc11.i586.  
It's always possible that subtle differences have crept in (a cynic would  
say almost certain!), but...at the end of the process, a not-7-bit-clean  
header string is getting passed to GMime and not getting rfc-2047-encoded,  
and that's just weird!

Peter
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list