Joop wrote:
> Dear all,
>
> A coworker of mine noticed that replies don't contain attachments 
> anymore since upgrading to rt-3.8.1 and after testing in my test 
> instance I can't find where it is coming from. I upgraded from rt-3.6.6 
> to rt-3.8.1 and I'm using Oracle as a backend database. So I'm not 
> bitten by the mysql update gone wrong. Attachments make it into the 
> database fine but it looks like the mimeobject isn't build correctly. 
> Make fixdeps finds everything OK.
> The following sequence is interesting:
> - /etc/init.d/apache2 stop
> - mv /opt/rt3 /opt/rt381
> - mv /opt/rt366 /opt/rt3
> - /etc/init.d/apache2 start
> - login into RT
> - send a reply and attach a config file
> - email arrives correctly WITH attachment.
> ???
> Switch back and email arrives WITHOUT attachment.
> Conclusion from this is that it is in the code of rt-3.8.1 and NOT in 
> the database since that is a constant factor.
> And yes my template Correspondence contains the line RT-Attach-Message: yes
> and contains 2 blank lines after the last (in this case one) header.
>
> Anyone seen this before?
>   
 From the lack of response I would say that no one has noticed yet there 
there is a slight problem with 3.8.1 in combination with Oracle that is.

The fact that the same db works with 3.6.6 gave me some clue that it had 
to be in the code of 3.8.1 and after trying all kind of things I tracked 
it down to Action/Sendmail.pm
I diffed the 3.8.1 version against the 3.6.6 one and one thing that is 
new is LimitNotEmpty which tries to exclude empty attachments but fails 
on Oracle because of a 'logic bug'.
This is what gets build by LimitNotEmpty for Oracle:

SELECT   main.*
    FROM attachments main
   WHERE  (main.content IS NOT NULL AND main.content NOT LIKE '')
     AND (main.transactionid = '313815')
     AND (main.ID != '204666') -- exlude the content itself
ORDER BY main.ID ASC;

The first part of the where is the same for all databases (main.content 
is not null) the second part is added by LimitNotEmpty (main.content not 
like '') which is wrong

The following test demonstrates that logic:

create table t (
id number,
t  clob
);

insert into t values(1,'test');
insert into t values(2,'');
insert into t values(3,null);

select * from t where t is not null;  --> id=1 t=test
select * from t where t not like '%' --> no rows returned
select * from t where t is null; --> returns both row 2 and 3

So inserting an empty string and null into a CLOB column in Oracle are 
equivalent and the second part doesn't work on NULL. Probably not if its 
a BLOB!

My proposal is to recode the LimitNotEmpty function so that for Oracle 
nothing is added.

Regards,

Joop





_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to