https://bugs.documentfoundation.org/show_bug.cgi?id=90418

            Bug ID: 90418
           Summary: Wrong number of bytes when reading file opened in
                    libreoffice calc on cifs
           Product: LibreOffice
           Version: 4.2.7.2 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: jds.bugzi...@gmail.com

Created attachment 114566
  --> https://bugs.documentfoundation.org/attachment.cgi?id=114566&action=edit
Short source code to reproduce error

When reading a CSV file from cifs mounted path which is already open with full
read/write permission in libreoffice, fread (in C) returns an incorrect file
size for the CSV file when reading 2**17 or more bytes at a time. If the file
is opened in read-only mode, the correct file size is returned. Share is
mounted through fstab, and the error still occurs mounting with pamount or
mount.

The problem does appear to be with libreoffice and not cifs/gvfs as fread
returns the correct file size when any another application has the file open in
either read-only or read-write mode, e.g. a text editor. Likewise, when reading
less than 2**17 bytes at a time, the correct file size is also returned whether
or not the file is opened in read-only mode.

Many libraries are built using fread, and so returning the wrong file size will
likely cause segfaults. This bug first manifested for me using python/pandas.

Short sample code attached to reproduce problem. In order to test, place CSV
file on a cifs or gvfs share, open with libreoffice, then run the script,
pointing it to the same file. It will report the file size as 131072 bytes,
whereas it is actually 131 bytes. If you recompile the test code with a chunk
size < 2**17, it works fine, or if you run it with libreoffice opening the file
in read-only mode.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to