[cairo] BUG: Cairo reports CAIRO_STATUS_SUCCESS even if writing to disk failed (SVG and PS backend)

Uli Schlachter psychon at znc.in
Fri Jul 23 12:01:00 UTC 2021


Am 23.07.21 um 08:55 schrieb Knut Petersen:
> Hi erverybody!
> 
> I'm testing a cairo backend I wrote for the GNU Lilypond music engraver.
> 
> I generate several output formats in parallel and test for errors using
> this C++ code:
> 
>       for (auto &cr : Cairo_output.contexts) // loop over a set of crs
>         {
>           auto status = cairo_status (cr);
>           if (status != CAIRO_STATUS_SUCCESS)
>             error (_f ("Cairo status %s", cairo_status_to_string
> (status))); // display an error msg and abort
>         }
> 
> If writing to an output file fails because there is no more free disk
> space and the cr is connected to a pdf surface this works fine:
> 
>    Fitting music on 1 or 2 pages...
>    Drawing systems...
>    Generating test.cairo.pdf ...
>    fatal error: Cairo status reports 'error while writing to output stream'
> 
> Unfortunately this code fails for the cairo postscript backend and the
> cairo svg backend - cairo_status reports CAIRO_STATUS_SUCCESS even if
> writing to disk failed because there is no free disk space.

"Fail" here means "does not report an error, even though it should", right?

Are you calling something like
cairo_surface_finish(cairo_get_target(cr)) before the above? I think
that most of these file-output-backends only actually write the output
when the surface is finished. Before that, no errors could occur yet.

If this is not it, then I don't know. Sorry.

Cheers,
Uli
-- 
<alanc> I think someone had a Xprint version of glxgears at one point,
    but benchmarking how many GL pages you can print per second
    was deemed too silly to merge


More information about the cairo mailing list