[Libvir] [PATCH] check the file name for --log

Daniel P. Berrange berrange at redhat.com
Tue Jul 31 13:46:42 UTC 2007


On Tue, Jul 31, 2007 at 07:38:18AM -0400, Daniel Veillard wrote:
> On Tue, Jul 31, 2007 at 08:12:56PM +0900, Atsushi SAKAI wrote:
> > Hi,
> > 
> > This patch fixes the trouble if execute virsh with 
> > virsh --log --debug.
> > In this case FILE "--debug" is generated and 
> > --debug is off. 
> 
>   Well it does what the user asked, is that really an error ?
> Trying to guess what the user meant instead of executing what it asked for
> is a good way to break other things. I'm not sure this should be done that
> way.
> 
> > This patch treat as error return 
> > if it uses the hyphen "-" at the head of log file name.
> 
>   If you really want to catch this then I will ask you to also update the
> documentation for that option to explain that using a filename starting with
> - is not accepted.

Trying to catch this is a can of worms. You want to put similar 'validation' 
into every other command line option ? This is special casing --log and 
ignoring the same problem in every other command line option we have. It
is a waste of time & uneccessary complication. Every other UNIX command using
getopt has the same behaviour.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list