stdio handling is broken

Bryan O'Sullivan bos at serpentine.com
Mon Mar 13 02:59:22 UTC 2017


For complicated historical reasons, Mercurial doesn't handle errors upon
writes to stdout or stderr correctly.

You can test this on a Linux box very easily. Correct behaviour involves
trying to print an error message, followed by an error exit:

$ /bin/echo a > /dev/full
/bin/echo: write error: No space left on device

Meanwhile, Mercurial goes "what, me worry?":

$ hg status >/dev/full
$ echo $?
0

Eek!

I have a patch series that purports to fix this, but /dev/full is a
Linux-specific thing, and I am scratching my head over how to test the fix
portably.

So far, the "best" idea I have is to create a fake file object that raises
an ENOSPC IOError upon flush, but by the time I can use the extension
mechanism to cram this into place, the early dispatch code already has the
stdio handles stuffed away the request object, which extension code can't
get at.

If you have any better ideas, I'm all ... eyes?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170313/8d1c2381/attachment.html>


More information about the Mercurial-devel mailing list