Procházet zdrojové kódy

* dpkg-divert: Fix check for writable filesystem, closes: #48646

Ben Collins před 27 roky
rodič
revize
ad8957a34d
3 změnil soubory, kde provedl 16 přidání a 10 odebrání
  1. 4 0
      ChangeLog
  2. 6 2
      debian/changelog
  3. 6 8
      scripts/dpkg-divert.pl

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+Fri Oct 29 10:37:16 EDT 1999 Ben Collins <bcollins.debian.org>
+
+  * dpkg-divert: Fix check for writable filesystem, closes: #48646
+
 Thu Oct 28 22:14:49 CEST 1999 Wichert Akkerman <wakkerma@debian.org>
 
   * Add Polish translation from Piotr Roszatycki <dexter@fnet.pl

+ 6 - 2
debian/changelog

@@ -27,8 +27,6 @@ dpkg (1.4.1.19) unstable; urgency=low
     Filename, and MSDOS-Filename used to get lost when installing a
     package.
   * Added armv4l to archtable
-  * Implemented a nice fix for multiple conflicts and replaces. Also added
-    --assert-multi-conrep.
   * Added 'D' to the list of choices for conffile handling, closes: #48137
   * Converted internals.sgml to debiandoc format. Also added a dpkg-doc
     package that contains the generated output from this file (.ps, .html
@@ -40,6 +38,12 @@ dpkg (1.4.1.19) unstable; urgency=low
     really being parsed, it now works as advertised.
   * dpkg-gencontrol: add "Source" to the fields placed in the control file
   * dpkg-parsechangelog: fixed loop for parsepath (#48526)
+  * main/{processarc.c,depcon.c}: added new structure for conflictors,
+    which contains a struct for conflicts. This is used to create an array
+    of conflicting packages, which are going to be replaced. Allows for
+    multiple conflicts and replaces. All conflictor handlers were
+    converted to loops to handle each one (processarc.c).
+  * dpkg-divert: Fix check for writable filesystem, closes: #48646
 
  -- Wichert Akkerman <wakkerma@debian.org>  UNRELEASED
 

+ 6 - 8
scripts/dpkg-divert.pl

@@ -176,23 +176,21 @@ sub infol {
 sub checkrename {
     return unless $dorename;
     ($rsrc,$rdest) = @_;
-    my %exist;
     (@ssrc= lstat($rsrc)) || $! == &ENOENT ||
         &quit("cannot stat old name \`$rsrc': $!");
-    $exist{$rsrc} = 1 unless $! != &ENOENT;
     (@sdest= lstat($rdest)) || $! == &ENOENT ||
         &quit("cannot stat new name \`$rdest': $!");
-    $exist{$rdest} = 1 unless $! != &ENOENT;
     # Unfortunately we have to check for write access in both
     # places, just having +w is not enough, since people do
     # mount things RO, and we need to fail before we start
-    # mucking around with things
+    # mucking around with things. So we open a file with the
+    # same name as the diversions but with an extension that
+    # (hopefully) wont overwrite anything. If it succeeds, we
+    # assume a writable filesystem.
     foreach $file ($rsrc,$rdest) {
-	open (TMP, ">> $file") || &quit("error checking \`$file': $!");
+	open (TMP, ">> ${file}.dpkg-devert.tmp") || &quit("error checking \`$file': $!");
 	close TMP;
-	if ($exist{$file} == 1) {
-	    unlink ("$file");
-	}
+	unlink ("${file}.dpkg-devert.tmp");
     }
     if (@ssrc && @sdest &&
         !($ssrc[0] == $sdest[0] && $ssrc[1] == $sdest[1])) {