mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-22 08:58:47 +00:00
bump_revision.pl: minor usability improvements
- use env -S to split the shebang line (RhToad@#bsdports) - launder -p PORTSDIR argument and chdir to it so it doesn't matter which cwd bump_revision.pl is executed from - if INDEX not found, hint the user that also his -p option might be off, because the -i INDEX option defaults to a file relative to -p PORTSDIR.
This commit is contained in:
parent
1006178cca
commit
f94f54f0cd
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=532057
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env perl -wT
|
||||
#!/usr/bin/env -S perl -wT
|
||||
|
||||
# $FreeBSD$
|
||||
|
||||
@ -7,15 +7,13 @@
|
||||
# set of ports, for instance, when in the latter set one of the ports bumped the
|
||||
# .so library version.
|
||||
#
|
||||
# It is best executed with the working directory set to the base of a
|
||||
# ports tree, such as /usr/ports.
|
||||
#
|
||||
# The shebang line above includes -T (taint) to be more distrustful
|
||||
# about the environment, for security reasons, and is considered
|
||||
# good Perl practice.
|
||||
#
|
||||
# You can use either the -l (shaLlow, avoid grandparent dependencies,
|
||||
# slower) or -g option (include grandparent dependencies) option.
|
||||
# You can use either the
|
||||
# -l (shaLlow, avoid grandparent dependencies, slower) or
|
||||
# -g option (include grandparent dependencies) option.
|
||||
#
|
||||
# MAINTAINER= mandree@FreeBSD.org
|
||||
#
|
||||
@ -126,7 +124,8 @@ my ($portsdir, $INDEX);
|
||||
$INDEX = $opt_i if ($opt_i);
|
||||
if (!-f $INDEX) { $INDEX = "$portsdir/INDEX"; }
|
||||
|
||||
die "$INDEX doesn't seem to exist. Please check the value supplied with -i, or use -i /path/to/INDEX." unless(-f $INDEX);
|
||||
die "$INDEX doesn't seem to exist. Please check the value supplied with -i,\n" .
|
||||
"or use -i /path/to/INDEX, or check your -p PORTSDIR." unless(-f $INDEX);
|
||||
}
|
||||
usage() unless(@ARGV);
|
||||
|
||||
@ -139,6 +138,16 @@ if (-d "$TMPDIR/.svn" and not $opt_n and not $opt_c) {
|
||||
die "$TMPDIR/.svn exists, cowardly refusing to proceed.\n";
|
||||
}
|
||||
|
||||
|
||||
# must launder $portsdir (from command line => tainted) first
|
||||
if ($portsdir =~ /^([-\@\w.\/]+)$/) {
|
||||
$portsdir = $1; }
|
||||
else {
|
||||
die "Portsdir \"$portsdir\" contains unsafe characters. Aborting";
|
||||
}
|
||||
|
||||
chdir "$portsdir" or die "cannot cd to $portsdir: $!\nAborting";
|
||||
|
||||
#
|
||||
# Read the index, save some interesting keys
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user