summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install/version
diff options
context:
space:
mode:
authorbmah <bmah@FreeBSD.org>2001-02-09 20:07:06 +0000
committerbmah <bmah@FreeBSD.org>2001-02-09 20:07:06 +0000
commitfcdd10fefc48869cc1fbebf3946aa47c0bde6293 (patch)
tree482264b2c0bfa22499ed9b87183f6f8a18547f61 /usr.sbin/pkg_install/version
parentc90a74625467e4820dd5d3ae10a6be8a81173e53 (diff)
downloadFreeBSD-src-fcdd10fefc48869cc1fbebf3946aa47c0bde6293.zip
FreeBSD-src-fcdd10fefc48869cc1fbebf3946aa47c0bde6293.tar.gz
Prevent the commands output of pkg_version.pl from being executed without the
user actually editing the output. Too many people were rampantly abusing this feature via "pkg_version -c | sh" without really being cognizant of the dangers involved (ports upgrade kits) or the fact that it just plain wasn't designed for it (dependencies). We'll try to keep people from shooting themselves in the foot. Will be MFC-ed to RELENG_4 and RELENG_3 after cooling-off period.
Diffstat (limited to 'usr.sbin/pkg_install/version')
-rwxr-xr-xusr.sbin/pkg_install/version/pkg_version.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/usr.sbin/pkg_install/version/pkg_version.pl b/usr.sbin/pkg_install/version/pkg_version.pl
index 633e107..3a57510 100755
--- a/usr.sbin/pkg_install/version/pkg_version.pl
+++ b/usr.sbin/pkg_install/version/pkg_version.pl
@@ -325,6 +325,20 @@ while (<INDEX>) {
close INDEX;
#
+# If we're doing commands output, cripple the output so that users
+# can't just pipe the output to sh(1) and expect this to work.
+#
+if ($ShowCommandsFlag) {
+ print<<EOF
+echo "The commands output of pkg_version cannot be executed without editing."
+echo "You MUST save this output to a file and then edit it, taking into"
+echo "account package dependencies and the fact that some packages cannot"
+echo "or should not be upgraded."
+exit 1
+EOF
+}
+
+#
# Produce reports
#
# Prior versions of pkg_version used commas (",") as delimiters
OpenPOWER on IntegriCloud