[Nagiosplug-help] Re: Questions using negate?

Karl DeBisschop kdebisschop at mail.debisschop.net
Tue Mar 18 08:12:12 CET 2003


Voon, Ton writes: 

> Managed to have a play at cfpopen and here are the results: 
> 
> A) RIGHT
> $ ./negate /usr/bin/grep Network /etc/services
> # Network services, Internet style
> nntp            119/tcp         usenet          # Network News Transfer
> ntp             123/tcp                         # Network Time Protocol
> ntp             123/udp                         # Network Time Protocol 
> 
> B) WRONG (the " are lost)
> $ ./negate /usr/bin/grep "Network Time" /etc/services
> grep: can't open Time
> /etc/services:# Network services, Internet style
> /etc/services:nntp            119/tcp         usenet            # Network
> News Transfer
> /etc/services:ntp               123/tcp                         # Network
> Time Protocol
> /etc/services:ntp               123/udp                         # Network
> Time Protocol 
> 
> C) WRONG (same as above)
> $ ./negate /usr/bin/grep 'Network Time' /etc/services
> grep: can't open Time
> /etc/services:# Network services, Internet style
> /etc/services:nntp            119/tcp         usenet            # Network
> News Transfer
> /etc/services:ntp               123/tcp                         # Network
> Time Protocol
> /etc/services:ntp               123/udp                         # Network
> Time Protocol 
> 
> D) RIGHT
> $ ./negate '/usr/bin/grep "Network Time" /etc/services'
> ntp             123/tcp                         # Network Time Protocol
> ntp             123/udp                         # Network Time Protocol 
> 
> E) RIGHT
> $ ./negate "/usr/bin/grep 'Network Time' /etc/services"
> ntp             123/tcp                         # Network Time Protocol
> ntp             123/udp                         # Network Time Protocol 
> 
> The only benefit is case D. Is it worth a switch over? Maybe the only change
> is to provide better instructions on using case E and a better error message
> if double quotes exist.  
> 
> Any comments?

I would prefer to continue disallowing double quotes. It is explicit in the 
code that we do not support/allow environment variables to be expanded by 
spopen, and that it is intentionally done for security reasons. 

If we allow double quotes, then we will start getting the emails that "my 
shell variable did not expand". 

But the error trapping and reporting could certainly be better than it is. 

That my $0.02 

 --
Karl 





More information about the Help mailing list