From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12771 invoked from network); 18 Mar 1999 08:04:53 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Mar 1999 08:04:53 -0000 Received: (qmail 15548 invoked by alias); 18 Mar 1999 08:04:34 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5852 Received: (qmail 15527 invoked from network); 18 Mar 1999 08:04:32 -0000 Date: Thu, 18 Mar 1999 09:04:29 +0100 (MET) Message-Id: <199903180804.JAA28000@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Bart Schaefer's message of Wed, 17 Mar 1999 23:04:04 -0800 (PST) Subject: Re: Should _long_options be considered dangerous? Bart Schaefer wrote: > I wonder if perhaps we shouldn't add some more warning text in > Completion/Base/_long_options (and maybe even in Completion/README) > noting that you shouldn't attempt to use _long_options from _normal > or any other "default" completion function. > > Some (non-GNU) commands might actually do something unpleasant when > run with an unrecognized --help option. I can't think of an example > offhand, which is why the Subject is a question, but ... Yes, I've been wondering if we should do that, too... Bye Sven --- oc/README Mon Mar 15 10:08:53 1999 +++ Completion/README Thu Mar 18 09:01:05 1999 @@ -74,7 +74,10 @@ This handles options beginning with `--', as in many GNU commands. The command must accept the --help option to list the possible options. __long_options can also take arguments to help it decide what to - complete as the value of the option. + complete as the value of the option. Note that this is potentially + dangerous because the command from the line will be called with the + --help option and hence could cause damage if used with a command + that does not support it. _match_pattern _match_test These are used by Base/_path_files (and hence also Base/_files) --- oc/Base/_long_options Tue Mar 16 11:49:55 1999 +++ Completion/Base/_long_options Thu Mar 18 09:03:19 1999 @@ -2,9 +2,12 @@ # This function tries to automatically complete long option names. For # this it invokes the command from the line with the `--help' option -# and then parses the output to find possible option names. For -# options that get an argument after a `=', the function also tries to -# automatically find out what should be complete as the argument. +# and then parses the output to find possible option names, so you +# should be careful to make sure that this function is not called for +# a command that does not support this option. +# +# For options that get an argument after a `=', the function also tries +# to automatically find out what should be complete as the argument. # The possible completions for option-arguments can be described with # the arguments to this function. This is done by giving pairs of # patterns and actions as consecutive arguments. The actions specify -- Sven Wischnowsky wischnow@informatik.hu-berlin.de