Author Topic: Serious problem with attachements being broken !  (Read 6200 times)

Offline dbucher

  • Jr. Member
  • **
  • Posts: 15
Serious problem with attachements being broken !
« on: August 19, 2008, 11:43:30 AM »
Hello,

I have installed Roundcube and everything works perfectly excepts that... it corrupts attachements ! Attachements are sent but the file is invalid when received by anyone...

The only error in the logs doesn't seem to be a big problem :
 [Tue Aug 19 17:14:22 2008] [error] [client 62.147.237.26] PHP Warning:  dl() [function.dl]: Unable to load dynamic library '/usr/lib/php5/extensions/fileinfo.so' - /usr/lib/php5/extensions/fileinfo.so: cannot open shared object file: No such file or directory in /srv/www/htdocs/roundcube/program/include/rcube_shared.inc on line 701, referer: https://www.domain.com/webmail/?_task=mail&_action=compose

What should I do to debug/understand this problem ?

The received file is smaller (8k instead of 64k)

Thanks a lot in advance for your help !
« Last Edit: August 21, 2008, 07:35:05 AM by dbucher »

Offline dbucher

  • Jr. Member
  • **
  • Posts: 15
No help with this bug/problem ?
« Reply #1 on: August 22, 2008, 11:56:24 AM »
Hello everyone,

sorry to insist my my problem, but if someone had a solution it would really be great.

Not being able to send file-attachs is really blocking and I really don't understand where the problem comes from (bug ?)

Thanks a lot in advance for your help !

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,856
Serious problem with attachements being broken !
« Reply #2 on: August 22, 2008, 12:52:29 PM »
RC is attempting to load the fileInfo extension so it can find out what sort of file the attachment is. The extension is optional so if it is not there RC should just carry on with out it. I guess the problem could be that the path to your extensions dir is wrong or there is something wrong with the fileinfo.so or that there is a bug in RC and it is not handleing the extension not being there correctly (but I suspect this would have come up more if that was true).
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline dbucher

  • Jr. Member
  • **
  • Posts: 15
It's a bug in RC
« Reply #3 on: August 22, 2008, 01:15:10 PM »
Hello,

Yes thank you, I think it's optional too...

And I think I've found the problem, it's a bug in RC, it uses php fread() that is limited to 8kb !
But I don't find where in the source to correct it...

Everything seems to be explained on this link... EXCEPT the solution !
* http://trac.roundcube.net/ticket/1484880

Thanks a lot for your help !

Denis

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,856
Serious problem with attachements being broken !
« Reply #4 on: August 22, 2008, 01:49:19 PM »
The solution is there too, changeset linked at the bottom. Try the latest SVN and see if the problem still exists.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline dbucher

  • Jr. Member
  • **
  • Posts: 15
Problem not solved
« Reply #5 on: August 22, 2008, 02:17:39 PM »
Hello !

Yes you're right it's under http://trac.roundcube.net/changeset/1631

On the three files, I corrected two files :

1. trunk/roundcubemail/program/include/rcube_mdb2.php
#DEBUG-REMOVED    $data = '';
#DEBUG-REMOVED    if ($fd = fopen($file_name, 'r'))
#DEBUG-REMOVED      {
#DEBUG-REMOVED      $data = fread($fd, filesize($file_name));
#DEBUG-REMOVED      fclose($fd);
#DEBUG-REMOVED      }
// line added according to :
// selon http://trac.roundcube.net/changeset/1631
$data = file_get_contents($file_name);

2.  program/lib/html2text.inc
    function set_html( $source, $from_file = false )
    {
#DEBUG-REMOVED        $this->html = $source;

        if ( $from_file && file_exists($source) ) {
#DEBUG-REMOVED            $fp = fopen($source, 'r');
#DEBUG-REMOVED            $this->html = fread($fp, filesize($source));
#DEBUG-REMOVED            fclose($fp);
#DEBUG-REMOVED        }
$this->html = file_get_contents($source);
}
else
$this->html = $source;

        $this->_converted = false;
    }

3. I didn't found a file like trunk/roundcubemail/program/include/rcube_template.php in my 0.1.1 version ? But it seems to be program/include/rcmail_template.inc :

      // include a file
      case 'include':
        $path = realpath($this->config['skin_path'].$attrib['file']);
#DEBUG-REMOVED        if (filesize($path))
 if (is_readable($path)) {
#DEBUG-REMOVED        {
          if ($this->config['skin_include_php'])
            $incl = $this->include_php($path);
#DEBUG-REMOVED          else if ($fp = @fopen($path, 'r'))
#DEBUG-REMOVED          {
#DEBUG-REMOVED            $incl = fread($fp, filesize($path));
#DEBUG-REMOVED            fclose($fp);
else {
$incl = file_get_contents($path);
          }
          return $this->parse_xml($incl);
        }
        break;


4. I see that file upload is now functional : temporary file in /tmp has the correct size of 69kb :
# ls -ltr /tmp/  | tail -n 1
-rw------- 1 wwwrun       www   672768 Aug 17 17:21 rcmAttmnt3ubnlu

5. But the sent attached file is still 8kb ??? Help ! ;-)

Thanks a lot for any further help !

Denis
« Last Edit: August 22, 2008, 02:19:44 PM by dbucher »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,856
Serious problem with attachements being broken !
« Reply #6 on: August 23, 2008, 05:22:55 AM »
There have been a lot of changes between the 0.1.1 release and r1631 (0.1.1 was r1259 I think). Really I think the only thing you can do is it download the latest SVN and try it. Sorry I dont know what else to suggest.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline dbucher

  • Jr. Member
  • **
  • Posts: 15
Lost with critical bug
« Reply #7 on: September 01, 2008, 03:23:36 PM »
Yes but I fear that installing an alpha version will have more problems... I have 50 people using roundcube and removing one bug to have many other is quite dangerous...

What do you think ?

Offline dbucher

  • Jr. Member
  • **
  • Posts: 15
Solution found !
« Reply #8 on: September 01, 2008, 03:32:05 PM »
Believe it or not I finally found the solution... IN THIS FORUM !!!

http://www.roundcubeforum.net/showthread.php?t=3006&highlight=8192

Offline Wazooka

  • Jr. Member
  • **
  • Posts: 22
Serious problem with attachements being broken !
« Reply #9 on: September 02, 2008, 09:34:36 AM »
I'm using 0.2 alpha and managed to attach/send a 2.5 meg MP3 without issues. A 6 mb file was giving trouble. But I don't think mailboxes aregenerally happy with huge files anyways. Just visit your fellows more often :)