[Poppler-bugs] [Bug 14126] pdftotext not checking success of fseek(), so gives misleading errors if input not seekable

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Mar 20 14:31:58 PDT 2008


http://bugs.freedesktop.org/show_bug.cgi?id=14126





--- Comment #3 from Ed Avis <eda at waniasset.com>  2008-03-20 14:31:58 PST ---
>but all the Stream functions
>return void, changing them to bool is not acceptable since that would mean
>checking for errors in hundreds of places where that's not checked currently.

I feel that you just have to knuckle down and put in all the error checks,
tedious though it may be... of course, this is the reason why exceptions were
added to the language.  However, your compromise may be enough:

>So the solution i liked most was something like return NULL in
>FoFiBase::readFile and GfxFont::readExtFontFile along with an error() call when
>we can not seek, and for all the others i think one should try to do a
>setPos(1), getPos in PDFDoc::setup and if getPos returns != 1 we just assume
>the stream is not seekable and return a false in GBool.

This would take care of the /dev/stdin case.

It wouldn't work correctly when fseek() really does fail part way through, as
might happen on network filesystems.  But you might ignore such cases - most
Unix software is so buggy anyway with checking the success of file I/O that
everyone mounts NFS as 'hard' mounts and failing operations just hang rather
than reporting error codes.

>Could you try coding such a patch?

Certainly.  Do you require copyright assignment?


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Poppler-bugs mailing list