[OpenAFS-devel] library linking vs command output parsing

Thomas Kula kula@tproa.net
Fri, 14 Mar 2008 19:42:48 -0400


On Fri, Mar 14, 2008 at 07:29:53PM -0400, Jason Edgecombe wrote:
> Jason Edgecombe wrote:
> >I'm thinking of writing something similar to AFS commander on Mac OS 
> >X, but for Linux on the Nokia N800 series tables. The two major 
> >language choices for the platform are C and python. I'm thinking that 
> >python will let me get things done more quickly even though I don't 
> >know it vs my novice level of C.
> >
> >My question is this: What are the pros and cons of writing code that 
> >links to the AFS & kerberos libraries to do things like getting 
> >tickets/tokens versus just running klist and capturing the input & 
> >output?
> I forgot to mention that I think this would be a nice little project to 
> help me learn Python.

Running some external program and parsing its output 
always feels a bit off to me. On the other hand, 
when I consider writing a Python module to do kerberos
or AFS stuff, my head starts to hurt, although since
I've successfully managed to make an Python module perhaps
that would change now. 

My problem with calling external programs is making sure
I can handle any random text it will barf back at me, and
some things have output that seems to be a pain to parse.
And while in your application this doesn't sound like it
would be an issue, when dealing with stuff like kerberos
I always have to think "okay, am I going to be passing
something on the command line like a password? If so, 
I now have to run this only on a machine where I trust
anyone who might run ps with the appropriate flags and
see the arguments to this external program." Then again,
when making a module to do this stuff, I still have to 
make sure I handle anything the library might do.

-- 
Thomas L. Kula | kula@tproa.net | http://kula.tproa.net/