Browse Source

Added checks to make sure $tmp is writable and executable when automatic

db building is done.
master
freesource 23 years ago
parent
commit
4350c68f9a
  1. 45
      swim

45
swim

@ -805,6 +805,28 @@ sub command {
my $dpkg_status = "$parent$library/status"; my $dpkg_status = "$parent$library/status";
my $my_status = "$main::home$parent$library/status"; my $my_status = "$main::home$parent$library/status";
if (!-f $my_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; $commands{"check"} = 1;
require SWIM::DB; require SWIM::DB;
SWIM::DB->import(qw(db)); SWIM::DB->import(qw(db));
@ -829,6 +851,29 @@ sub command {
if ( (stat($dpkg_status))[9] != (stat($my_status))[9] ) { if ( (stat($dpkg_status))[9] != (stat($my_status))[9] ) {
my $diff = `diff $dpkg_status $my_status`; my $diff = `diff $dpkg_status $my_status`;
if ( $diff ) { 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; $commands{"check"} = 1;
require SWIM::DB; require SWIM::DB;
SWIM::DB->import(qw(db)); SWIM::DB->import(qw(db));

Loading…
Cancel
Save