Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Pacman Development (http://www.linux-archive.org/archlinux-pacman-development/)
-   -   Remove leading "./" from filenames in mtree file (http://www.linux-archive.org/archlinux-pacman-development/701894-remove-leading-filenames-mtree-file.html)

Allan McRae 09-09-2012 03:55 AM

Remove leading "./" from filenames in mtree file
 
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@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


All times are GMT. The time now is 06:31 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.