From 4bb856fc93050b73f63c5c2c0c7abd4f6e0fbc90 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 29 Sep 2020 18:16:11 +0200 Subject: Fix: rdsquashfs: describe: don't escape the prefixed file input path If rdsquashfs describes a filesystem, is configured to use a prefix-path and a file contains a space, the resulting input path has the prefix printed as is and the rest of the string in quotation marks. gensquashfs simply takes the entire rest of the line as is as its input path and no longer finds the file. Fix this by omitting the escapes and quotation marks for the input path. Signed-off-by: David Oberhollenzer --- bin/rdsquashfs/describe.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/rdsquashfs/describe.c b/bin/rdsquashfs/describe.c index 924bedc..8f45243 100644 --- a/bin/rdsquashfs/describe.c +++ b/bin/rdsquashfs/describe.c @@ -6,7 +6,7 @@ */ #include "rdsquashfs.h" -static int print_name(const sqfs_tree_node_t *n) +static int print_name(const sqfs_tree_node_t *n, bool dont_escape) { char *start, *ptr, *name = sqfs_tree_node_get_path(n); @@ -21,7 +21,8 @@ static int print_name(const sqfs_tree_node_t *n) return -1; } - if (strchr(name, ' ') == NULL && strchr(name, '"') == NULL) { + if (dont_escape || (strchr(name, ' ') == NULL && + strchr(name, '"') == NULL)) { fputs(name, stdout); } else { fputc('"', stdout); @@ -59,7 +60,7 @@ static int print_simple(const char *type, const sqfs_tree_node_t *n, const char *extra) { printf("%s ", type); - if (print_name(n)) + if (print_name(n, false)) return -1; print_perm(n); if (extra != NULL) @@ -91,11 +92,11 @@ int describe_tree(const sqfs_tree_node_t *root, const char *unpack_root) return print_simple("file", root, NULL); fputs("file ", stdout); - if (print_name(root)) + if (print_name(root, false)) return -1; print_perm(root); printf(" %s/", unpack_root); - if (print_name(root)) + if (print_name(root, true)) return -1; fputc('\n', stdout); break; -- cgit v1.2.3