[horde] Horde Groupware Webmail Edition 4.0.5, PostgreSQL 9.0.6, horde_prefs bytea value not correct

Jan Schneider jan at horde.org
Thu Jan 12 13:40:22 UTC 2012


Zitat von Alex Meier <alex at ksz.ch>:

> Am 12.01.2012 12:57, schrieb Jan Schneider:
>>
>> Zitat von Alex Meier <alex at ksz.ch>:
>>
>>> Am 11.01.2012 22:01, schrieb Jan Schneider:
>>>>
>>>> Zitat von Alex Meier <alex at ksz.ch>:
>>>>
>>>>> I'm not shure I'm writing to the correct mailing list, but I thought I
>>>>> first ask here before writing to the developer list.
>>>>>
>>>>> With the last update of the horde groupware webmail edition the
>>>>> horde_prefs table somehow got wrong entries.
>>>>> The pref_value field in horde_prefs was altered from text to bytea.
>>>>> All values now look like this:
>>>>>
>>>>> "\x613a313a7b693a303b613a31373a7b733a31363a2264656661756c745f6964656e74697479223b693a303b733a393a2266726f6d5f61646472223b733a32333a22626172626172612e6772756574746572406b737a2e6368223b733a38
>>>>>
>>>>>
>>>>> 3a2266756c6c6e616d65223b733a303a22223b733a323a226964223b733a31383a225374616e646172646964656e746974c3a474223b733a31303a226964656e746974696573223b733a3436323733353a227836313361333133613762363933613330336236313361333733613762373333613331333
>>>>>
>>>>>
>>>>> 633613232363436353636363137353663373435663639363436353665373436393734373932323362363933613330336237333361333933613232363637323666366435663631363436343732323233623733336133323333336132323632363137323632363137323631326536373732373536353734
>>>>>
>>>>>
>>>>> 373436353732343036623733376132653633363832323362373333613338336132323636373536633663366536313664363532323362373333613330336132323232336237333361333233613232363936343232336237333361333133383361323235333734363136653634363137323634363936343
>>>>>
>>>>>
>>>>> 635366537343639373463336134373432323362373333613331333033613232363936343635366537343639373436393635373332323362373333613332333333313331333433373361323237383336333133333631333333313333363133373632333633393333363133333330333336323336333133
>>>>>
>>>>>
>>>>> 333631333333373333363133373632333733333333363133333331333333363333363133323332333633343336333533363336333633313337333533363633333733343335363633363339333633343336333533363635333733343336333933373334333733393332333233333632333633393333363
>>>>>
>>>>>
>>>>> 133333330333336323337333333333631333333393333363133323332333633363337333233363636333636343335363633363331333633343336333433373332333233323333363233373333333336313333333233333333333336313332333233363332333633313337333233363332333633313337
>>>>>
>>>>>
>>>>> 3332333633313332363533363337333733323337333533363335333733343337333433363335333733323334333033363632333733333337363133323635333"
>>>>>
>>>>>
>>>>>
>>>>> This is the beginning of an identity entry in the horde_prefs table.
>>>>> The complete field contains 926'416 signs, mostly the number 3. The
>>>>> field grows every time a user logs in and alters his identity. The
>>>>> values can't be read correctly. Before conversion from text to bytea,
>>>>> the values were much, much smaller (and plain text). I don't know
>>>>> what's going wrong. I found the following messages in the Horde Debug
>>>>> Log:
>>>>>
>>>>> 2011-11-10T17:43:33+01:00 DEBUG: HORDE [mnemo] Horde_Prefs: Storing
>>>>> preference value (display_notepads) [pid 4340 on line 200 of
>>>>> "/usr/share/pear/Horde/Prefs.php"]
>>>>> 2011-11-10T17:43:35+01:00 NOTICE: HORDE [imp] PHP ERROR: Array to
>>>>> string conversion [pid 4340 on line 156 of
>>>>> "/usr/share/pear/Horde/Mail/Rfc822.php"]
>>>>> 2011-11-10T17:43:35+01:00 DEBUG: HORDE 1.
>>>>> IMP_Views_ShowMessage->showMessage()
>>>>> /data/www/html/imp/message-dimp.php:52
>>>>>
>>>>> There are other log entries to, but I can't really figure out which
>>>>> are related to the problem. This is the only logmessage during login
>>>>> which I think could be related to the problem.
>>>>>
>>>>> It's ok for me to completely reset all horde_prefs (actually I've
>>>>> allready done this, but it fills up with the same values). Does anyone
>>>>> has a suggestion whats going wrong?
>>>>>
>>>>> With tcpdump I can see, that horde sends the values allready in this
>>>>> form. So I assume it's not going wrong on the database side.
>>>>> The database is in UTF8, localization is de.CH, the charset setting in
>>>>> Horde is also set to UTF8.
>>>>>
>>>>> Horde Groupware Webmail Version 4.0.5
>>>>> PostgresSQL Version 9.0.6
>>>>> PHP Version 5.3.3
>>>>> Apache Version 2.2.15
>>>>> RHEL Version 2.6.32-220.el6.x86_64
>>>>>
>>>>> I know I don't have much useful information, I would simply be happy
>>>>> about an idea what to look for. I assume I made a pretty bad
>>>>> configuration mistake I just can't see.
>>>>
>>>> See http://bugs.horde.org/ticket/9153 and
>>>> http://bugs.horde.org/ticket/10803 for some background why and how this
>>>> happened. And please make sure that you're not affected by
>>>> http://bugs.horde.org/ticket/10881.
>>>>
>>>> Bottom line: this generally looks fine, as it's encoded binary content.
>>>> Whether the *actual* content is correct, I can't tell though.
>>>>
>>>> Jan.
>>>>
>>>
>>> You write in one of the tickets, that there are unit tests for the
>>> database. Where do I find them?
>>
>> In the test/ directory of your PEAR installation, e.g.
>> /usr/share/php/test/Horde/Db
>>
>>> Where can I find the function in the code to decode the binary
>>> content? So I could write a little test script to see what is actually
>>> stored in the field.
>>
>> The value is automatically decoded by Postgres if read from the
>> database, AFAIU.
>>
>
> Ah, this it was. I can see with tcpdump (db and webmail are not on  
> the same server) that postgres sends the encoded values.
>
> with "select encode(pref_value, 'escape') from horde_prefs;" i see  
> that the data is indeed correct (except the 333333333 part which  
> seems to be just useless). I converted the bytea_output from hex to  
> escape and now it's working:
>
> ALTER DATABASE horde SET bytea_output = 'escape';
>
> The upper line should be used when creating a database in PostgreSQL  
> 9.0 if I'm correct. The standard output for bytea is hex in  
> PostgreSQL 9.0 and should be escape for horde  
> (http://www.postgresql.org/docs/9.0/static/release-9-0.html). I  
> don't know if that's in your update script and it just went wrong on  
> my db.
>
> I'm sorry, should have realised that by myself, but I've never  
> worked with bytea fields before.
>
> After cleaning out horde_prefs completely it now works exactly as it should.
>
> Thanks again, Alex

Please create a ticket with that information.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the horde mailing list