From 4350c68f9adf5887730584ec491ccbdf48136d21 Mon Sep 17 00:00:00 2001 From: freesource Date: Tue, 23 Oct 2001 05:44:39 +0000 Subject: [PATCH] Added checks to make sure $tmp is writable and executable when automatic db building is done. --- swim | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/swim b/swim index d70dc7b..da285a7 100755 --- a/swim +++ b/swim @@ -805,6 +805,28 @@ sub command { my $dpkg_status = "$parent$library/status"; my $my_status = "$main::home$parent$library/status"; if (!-f $my_status) { + if ( + (!-x $tmp && !-w $tmp) || + + !-x $tmp || + + !-w $tmp + + ) { + print STDERR "swim: $tmp is not "; + print STDERR "writable" if !-w $tmp; + print STDERR "/" if !-w $tmp; + print STDERR "executable" if !-x $tmp; + print STDERR " by your effective uid/gid\n"; + + print STDERR "swim: set \$tmp to a directory "; + print STDERR "writable" if !-w $tmp; + print STDERR "/" if !-w $tmp; + print STDERR "executable" if !-x $tmp; + print STDERR " by your effective uid/gid " . + "in $ENV{HOME}/.swimrc\n"; + return "tmp not-writable"; + } $commands{"check"} = 1; require SWIM::DB; SWIM::DB->import(qw(db)); @@ -829,6 +851,29 @@ sub command { if ( (stat($dpkg_status))[9] != (stat($my_status))[9] ) { my $diff = `diff $dpkg_status $my_status`; if ( $diff ) { + if ( + (!-x $tmp && !-w $tmp) || + + !-x $tmp || + + !-w $tmp + + ) { + print STDERR "swim: $tmp is not "; + print STDERR "writable" if !-w $tmp; + print STDERR "/" if !-w $tmp; + print STDERR "executable" if !-x $tmp; + print STDERR " by your effective uid/gid\n"; + + print STDERR "swim: set \$tmp to a directory "; + print STDERR "writable" if !-w $tmp; + print STDERR "/" if !-w $tmp; + print STDERR "executable" if !-x $tmp; + print STDERR " by your effective uid/gid " . + "in $ENV{HOME}/.swimrc\n"; + return "tmp not-writable"; + } + $commands{"check"} = 1; require SWIM::DB; SWIM::DB->import(qw(db));