[sos-devel] isatty opinions

Jesse Jaggars jjaggars at redhat.com
Wed Sep 5 20:37:50 UTC 2012


So I've been reassigned the following JDR bug: https://issues.jboss.org/browse/JBPAPP-9565

The story behind this situation is long and gory, but to make it short the productization process removed some libraries that jython uses to call native code for what could be argued as fair reasons (could easily be argued the other way too I suppose.)

Anyhow, it seems that without the jffi libraries JDR fails to execute while running on a solaris box due to the inability to find the proper native bits to run. The call in question is os.isatty(). 

We use this call in two spots today:

[jjaggars sos (master $>)]$ ack isatty
sosreport.py
270:        if hasattr(sys, 'ps1') or not sys.stderr.isatty():
310:        if not sys.stdin.isatty():

The first is when we catch an exception in debug mode, if we don't have a tty we don't use pdb to debug. The second is when we setup logging; if we don't have a tty we disable some output stuff.

How critical is it to attempt to detect an underlying tty for these cases? Can we safely trust our defaults and the user (or blame them for their mistakes if they do it wrong) for these seemingly trivial situations? 

Here are some more details to help frame things a bit more. I'm not sure how important it is to fix this issue, might mark as a will_not_fix. I'm also unsure if removing the isatty() calls will be enough to fix this issue altogether, it's possible that there are a whole mess of functions that follow the same failing code path that I don't know about yet and don't have a good way to test for.

Thanks
Jesse




More information about the sos-devel mailing list