NBI-Slurm
view release on metacpan or search on metacpan
bin/rm_package view on Meta::CPAN
my $file_uid = (stat($file))[4];
if ($file_uid != $current_uid) {
push @unauthorized_files, $file;
}
}
}
if (@unauthorized_files > 0) {
say STDERR RED, "ERROR:", RESET, " The following files/directories are not owned by $current_user:";
foreach my $file (@unauthorized_files) {
my $owner = getpwuid((stat($file))[4]) || "unknown";
say STDERR " $file (owner: $owner)";
}
say STDERR RED, "ERROR:", RESET, " For security reasons, you can only delete files owned by your user.";
exit 1;
}
# In default mode (dry run), just exit unless --remove is specified
if (!$remove) {
say STDERR timelog("rm_package"), "Dry run completed. No files were deleted.";
say STDERR YELLOW, "INFO:", RESET, " Use --remove to actually delete these files.";
bin/rm_package view on Meta::CPAN
}
}
}
if ($opt_del_image) {
foreach my $image (@images) {
if (-f $image) {
# Check image ownership
my $image_uid = (stat($image))[4];
if ($image_uid != $current_uid) {
my $owner = getpwuid($image_uid) || "unknown";
say STDERR RED, "ERROR:", RESET, " Cannot delete image $image: owned by $owner, not $current_user";
$success = 0;
next;
}
if (unlink $image) {
say STDERR "Deleted image: $image";
} else {
say STDERR "ERROR: Failed to delete image $image: $!";
$success = 0;
( run in 0.294 second using v1.01-cache-2.11-cpan-8d75d55dd25 )