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

dpkg-deb: Remove trailing ‘/’ and ‘/.’ from the directory name on -b

When using “dpkg-deb -b” and specifiyng only the directory name to be
used as the base name for the package name, remove any trailing
characters that would make dpkg-deb create the destination file inside
the directory.

Closes: #218018, #373602
Guillem Jover лет назад: 17
Родитель
Сommit
de24e8d710
2 измененных файлов с 6 добавлено и 1 удалено
  1. 2 0
      debian/changelog
  2. 4 1
      dpkg-deb/build.c

+ 2 - 0
debian/changelog

@@ -17,6 +17,8 @@ dpkg (1.15.4) UNRELEASED; urgency=low
     the database on next dump. This obsoletes the --forget-old-unavail option,
     thus making it now a no-op. Closes: #33394, #429262
   * Document “hold” under package selection states instead of flags in dpkg(1).
+  * Remove trailing ‘/’ and ‘/.’ from the directory name to be used as the
+    package name on “dpkg-deb -b”. Closes: #218018, #373602
 
   [ Raphael Hertzog ]
   * Replace install-info by a wrapper around GNU's install-info. The wrapper

+ 4 - 1
dpkg-deb/build.c

@@ -47,6 +47,7 @@
 #include <dpkg.h>
 #include <dpkg-db.h>
 #include "dpkg-deb.h"
+#include "dpkg-priv.h"
 
 #ifndef S_ISLNK
 # define S_ISLNK(mode) ((mode&0xF000) == S_IFLNK)
@@ -222,7 +223,9 @@ void do_build(const char *const *argv) {
     }
   } else {
     m= m_malloc(strlen(directory) + sizeof(DEBEXT));
-    strcpy(m,directory); strcat(m,DEBEXT);
+    strcpy(m, directory);
+    path_rtrim_slash_slashdot(m);
+    strcat(m, DEBEXT);
     debar= m;
   }