develooper Front page | perl.perl5.porters | Postings from April 2003

Re: [PATCH 5.8.1 @19053] Getopt::Std

Thread Previous | Thread Next
From:
Johan Vromans
Date:
April 6, 2003 01:47
Subject:
Re: [PATCH 5.8.1 @19053] Getopt::Std
Message ID:
16015.63423.2333.343723@phoenix.squirrel.nl
Ilya Zakharevich <ilya@Math.Berkeley.EDU> writes:

> Tough luck.  IIUC, security considerations imply that the most we can
> do with unprepared program is to put message on STDERR, and continue.

s/STDERR/SDOUT/;
s/continue/die/;

I know several scripts that probe a program with --version first to
verify that a minimal version is installed, or to adjust command line
arguments depending on the returned version information. For example,
the vmware-config.pl script verifies the version of the C compiler.
These scripts would malfunction when the version information is not
written to STDOUT, and also if the program continues processing after
writing the version message.

    #!/bin/sh

    # Desired kernel.
    kernel=$1.

    # Get major version of lilo program.
    ver=`/sbin/lilo --version|sed -ne 's/^.*\([0-9][0-9]*\)\..*/\1/p'`

    # Check version.
    if expr $ver '>=' 18
    then
	# As of version 18, lilo can select a new kernel.
	/sbin/lilo -R $kernel
	/sbin/reboot
    else
	echo "cannot reboot $kernel automatically" 2>1
	exit
    fi

-- Johan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About