[PATCH 4/5] Allow (and require) absolute pathnames in mtree files
From: Matthew Garrett <matthew.garrett@google.com>
The mtree format arbitrarily prohibits absolute full pathnames. Remove
the restriction and also remove support for relative paths.
---
lib/mtree/spec.c | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/lib/mtree/spec.c b/lib/mtree/spec.c
index fb2ea78a5..f1d249eac 100644
--- a/lib/mtree/spec.c
+++ b/lib/mtree/spec.c
@@ -118,25 +118,6 @@ mtree_readspec(FILE *fi)
continue;
}
- if (index(p, '/'))
- errx(1, "line %d: slash character in file name",
- lineno);
-
- if (!strcmp(p, "..")) {
- /* Don't go up, if haven't gone down. */
- if (!root)
- goto noparent;
- if (last->type != F_DIR || last->flags & F_DONE) {
- if (last == root)
- goto noparent;
- last = last->parent;
- }
- last->flags |= F_DONE;
- continue;
-
-noparent: errx(1, "line %d: no parent node", lineno);
- }
-
if ((centry = calloc(1, sizeof(NODE) + strlen(p))) == NULL)
errx(1, "calloc");
*centry = ginfo;
@@ -150,9 +131,6 @@ noparent: errx(1, "line %d: no parent node", lineno);
if (!root) {
last = root = centry;
root->parent = root;
- } else if (last->type == F_DIR && !(last->flags & F_DONE)) {
- centry->parent = last;
- last = last->child = centry;
} else {
centry->parent = last->parent;
centry->prev = last;
--
2.17.0.441.gb46fe60e1d-goog
Reply to: