[pacman-dev] [PATCH] Remove leading "./" from filenames in mtree file

Allan McRae allan at archlinux.org
Sat Sep 8 23:55:18 EDT 2012


A properly formatted mtree file may stick a leading "./" in front
of file names in the root directory.  Strip this if present.

Signed-off-by: Allan McRae <allan at archlinux.org>
---

Sending for completeness.  The full mtree patchset can be seen at
https://patchwork.archlinux.org/user/bundle/8/?state=*

The whole patchset requires libarchives mtree generation to be fixed
using this patch:
https://github.com/allanbrokeit/libarchive/commit/32675a90


 src/pacman/check.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/pacman/check.c b/src/pacman/check.c
index d325a99..2ccf51d 100644
--- a/src/pacman/check.c
+++ b/src/pacman/check.c
@@ -242,6 +242,11 @@ int check_pkg_full(alpm_pkg_t *pkg)
 		mode_t type;
 		size_t file_errors = 0;
 
+		/* strip leading "./" from path entries */
+		if(path[0] == '.' && path[1] == '/') {
+			path += 2;
+		}
+
 		if(strcmp(path, ".INSTALL") == 0) {
 			char filename[PATH_MAX];
 			snprintf(filename, PATH_MAX, "%slocal/%s-%s/install",
-- 
1.7.12



More information about the pacman-dev mailing list