Просмотр исходного кода

update-alternatives: add new sanity check

Add one more sanity check verifying that <link> and <path> are different
(cf #509667 for a sample).
Raphael Hertzog лет назад: 17
Родитель
Сommit
eae5c880d2
2 измененных файлов с 8 добавлено и 0 удалено
  1. 6 0
      ChangeLog
  2. 2 0
      scripts/update-alternatives.pl

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2009-02-27  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/update-alternatives.pl: Add one more sanity check
+	verifying that <link> and <path> are different (cf #509667 for a
+	sample).
+
 2009-02-27  Raphael Hertzog  <hertzog@debian.org>
 
 	* scripts/update-alternatives.pl: Improve output messages

+ 2 - 0
scripts/update-alternatives.pl

@@ -60,6 +60,7 @@ while (@ARGV) {
         my $name = shift @ARGV;
         my $path = shift @ARGV;
         my $priority = shift @ARGV;
+        badusage(_g("<link> and <path> can't be the same")) if $link eq $path;
         $priority =~ m/^[-+]?\d+/ || badusage(_g("priority must be an integer"));
         $alternative = Alternative->new($name);
         $inst_alt = Alternative->new($name);
@@ -84,6 +85,7 @@ while (@ARGV) {
         my $slink = shift @ARGV;
         my $sname = shift @ARGV;
         my $spath = shift @ARGV;
+        badusage(_g("<link> and <path> can't be the same")) if $slink eq $spath;
         badusage(_g("name %s is both primary and slave"), $inst_alt->name())
             if $sname eq $inst_alt->name();
         if ($inst_alt->has_slave($sname)) {