Przeglądaj źródła

libdpkg: Consider a hardlink tar entry as a regular file for mode values

The hardlink gets converted into a regular file on extract, so use the
same mode as a regular file would have instead of 0.
Guillem Jover 12 lat temu
rodzic
commit
4c406e07d2
2 zmienionych plików z 3 dodań i 1 usunięć
  1. 2 0
      debian/changelog
  2. 1 1
      lib/dpkg/tarfn.c

+ 2 - 0
debian/changelog

@@ -118,6 +118,8 @@ dpkg (1.17.14) UNRELEASED; urgency=low
     Times have changed, and it's common to have at least these many files.
     Times have changed, and it's common to have at least these many files.
     This reduces the amount of collisions.
     This reduces the amount of collisions.
   * Document optional dpkg -C argument in --help output. Closes: #763000
   * Document optional dpkg -C argument in --help output. Closes: #763000
+  * Consider a hardlink tar entry as a regular file for mode values, i.e.
+    assign to it S_IFREG instead of 0.
 
 
   [ Raphaël Hertzog ]
   [ Raphaël Hertzog ]
   * Explain better in deb-triggers(5) why interest/activate-noawait should be
   * Explain better in deb-triggers(5) why interest/activate-noawait should be

+ 1 - 1
lib/dpkg/tarfn.c

@@ -101,6 +101,7 @@ get_unix_mode(struct tar_header *h)
 	switch (type) {
 	switch (type) {
 	case TAR_FILETYPE_FILE0:
 	case TAR_FILETYPE_FILE0:
 	case TAR_FILETYPE_FILE:
 	case TAR_FILETYPE_FILE:
+	case TAR_FILETYPE_HARDLINK:
 		mode = S_IFREG;
 		mode = S_IFREG;
 		break;
 		break;
 	case TAR_FILETYPE_SYMLINK:
 	case TAR_FILETYPE_SYMLINK:
@@ -118,7 +119,6 @@ get_unix_mode(struct tar_header *h)
 	case TAR_FILETYPE_FIFO:
 	case TAR_FILETYPE_FIFO:
 		mode = S_IFIFO;
 		mode = S_IFIFO;
 		break;
 		break;
-	case TAR_FILETYPE_HARDLINK:
 	default:
 	default:
 		mode = 0;
 		mode = 0;
 		break;
 		break;