diff --git a/fsdump/CHANGELOG b/fsdump/CHANGELOG
index 7f8f49167..2a70bfb97 100644
--- a/fsdump/CHANGELOG
+++ b/fsdump/CHANGELOG
@@ -34,3 +34,4 @@ Fixed remote tar backups via FTP on OSX.
Files and directories to exclude can be specified for TAR format backups on Linux.
---- Changes since 1.410 ----
Added checkboxes to control if failure of the pre and post-backup commands cause the whole job to be regarded as a failure.
+Prevent non-level-0 backups and updating of the /etc/dumpdates file for backups of directories that are not filesystem mount points, as this isn't supported by the dump command.
diff --git a/fsdump/fsdump-lib.pl b/fsdump/fsdump-lib.pl
index 97aec0f7c..1f7d8c206 100644
--- a/fsdump/fsdump-lib.pl
+++ b/fsdump/fsdump-lib.pl
@@ -68,8 +68,8 @@ unlink("$module_config_directory/$_[0]->{'id'}.dump");
sub directory_filesystem
{
local $fs;
-foreach $m (sort { length($a->[0]) <=> length($b->[0]) }
- &foreign_call("mount", "list_mounted")) {
+foreach my $m (sort { length($a->[0]) <=> length($b->[0]) }
+ &mount::list_mounted()) {
local $l = length($m->[0]);
if ($m->[0] eq $_[0] || $m->[0] eq "/" ||
(length($_[0]) >= $l && substr($_[0], 0, $l+1) eq $m->[0]."/")) {
@@ -79,6 +79,17 @@ foreach $m (sort { length($a->[0]) <=> length($b->[0]) }
return wantarray ? @$fs : $fs->[2];
}
+# is_mount_point(dir)
+# Returns 1 if some directory is a filesystem mount point
+sub is_mount_point
+{
+local ($dir) = @_;
+foreach my $m (&mount::list_mounted()) {
+ return 1 if ($m->[0] eq $dir);
+ }
+return 0;
+}
+
# same_filesystem(fs1, fs2)
# Returns 1 if type filesystem types are the same
sub same_filesystem
diff --git a/fsdump/help/level.html b/fsdump/help/level.html
index ba9c65f2a..156f4f402 100644
--- a/fsdump/help/level.html
+++ b/fsdump/help/level.html
@@ -5,5 +5,8 @@ is chosen, every file under the directory to backup will be saved. Otherwise,
only files that are new or modified since the last dump of a lower level will
be written.
+When backing up a directory that is not a filesystem mount point, the only
+level that can be selected in 0.
+
diff --git a/fsdump/help/update.html b/fsdump/help/update.html
index dcddabf51..4ab73e3f6 100644
--- a/fsdump/help/update.html
+++ b/fsdump/help/update.html
@@ -1,7 +1,6 @@
Update /etc/dumpdates file?
-When this option is enabled, the date, time, source and destination of the backup
-will be recorded in human-readable form in /etc/dumpdates.
+This option can only be enabled when backing up an entire filesystem. When enabled, the source filesystem device name, level, date and time of the backup will be recorded in human-readable form in /etc/dumpdates. There may be only one entry per filesystem at each level. This option is useful when using the dump -W command-line option to display the most recent dump date and level of each filesystem.
diff --git a/fsdump/irix-lib.pl b/fsdump/irix-lib.pl
index 3c68583e6..85a8d96ca 100644
--- a/fsdump/irix-lib.pl
+++ b/fsdump/irix-lib.pl
@@ -166,11 +166,7 @@ else {
if ($_[0]->{'fs'} eq 'xfs') {
# Parse xfs options
- local $mp;
- foreach $m (&foreign_call("mount", "list_mounted")) {
- $mp++ if ($m->[0] eq $in{'dir'});
- }
- $mp || &error($text{'dump_emp'});
+ &is_mount_point($in{'dir'}) || &error($text{'dump_emp'});
$in{'label'} =~ /^\S*$/ && length($in{'label'}) < 256 ||
&error($text{'dump_elabel2'});
$_[0]->{'label'} = $in{'label'};
diff --git a/fsdump/lang/en b/fsdump/lang/en
index c81e6b150..b63e47b60 100644
--- a/fsdump/lang/en
+++ b/fsdump/lang/en
@@ -33,7 +33,7 @@ dump_dest=Backup to
dump_file=File or tape device
dump_host=Host $1 as user $2 in file or device $3
dump_level=Dump level
-dump_level_0=(Full backup)
+dump_level_0=0 (Full backup)
dump_label=Backup label
dump_multi=Split across multiple files?
dump_update=Update /etc/dumpdates file?
@@ -102,6 +102,8 @@ dump_ermt=Missing or invalid path to rmt program
dump_reverify=Attempt test restore after backup to verify?
dump_remount=Remount with noatime option during backup?
dump_eftpupdate=Adding files to an existing archive is not possible when using FTP.
+dump_eleveldir=Only level 0 backups are allowed for directories that are not filesystem mount points
+dump_eupdatedir=The /etc/dumpdates file can only be updated for directories that are filesystem mount points
edit_err=Failed to create backup
edit_edir=Missing backup directory
diff --git a/fsdump/linux-lib.pl b/fsdump/linux-lib.pl
index 601e12370..c7b43e968 100644
--- a/fsdump/linux-lib.pl
+++ b/fsdump/linux-lib.pl
@@ -259,11 +259,7 @@ if ($_[0]->{'fs'} eq 'tar') {
}
elsif ($_[0]->{'fs'} eq 'xfs') {
# Parse xfs options
- local $mp;
- foreach $m (&foreign_call("mount", "list_mounted")) {
- $mp++ if ($m->[0] eq $in{'dir'});
- }
- $mp || &error($text{'dump_emp'});
+ &is_mount_point($in{'dir'}) || &error($text{'dump_emp'});
$in{'label'} =~ /^\S*$/ && length($in{'label'}) < 256 ||
&error($text{'dump_elabel2'});
$_[0]->{'label'} = $in{'label'};
@@ -289,11 +285,17 @@ elsif ($_[0]->{'fs'} eq 'xfs') {
}
}
else {
- # Parse ext2/3 options
+ # Parse ext2/3 dump options
$_[0]->{'rsh'} = &rsh_command_parse("rsh_def", "rsh");
$_[0]->{'pass'} = $in{'pass'};
+ if ($in{'update'}) {
+ &is_mount_point($in{'dir'}) || &error($text{'dump_eupdatedir'});
+ }
$_[0]->{'update'} = $in{'update'};
$_[0]->{'multi'} = $in{'multi'};
+ if ($in{'level'} > 0) {
+ &is_mount_point($in{'dir'}) || &error($text{'dump_eleveldir'});
+ }
$_[0]->{'level'} = $in{'level'};
$in{'label'} =~ /^\S*$/ && length($in{'label'}) < 16 ||
&error($text{'dump_elabel'});