From 4115e70d14200e93794d58f0959458b05717c833 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 30 Sep 2024 17:53:39 +0900 Subject: [PATCH] Test/fix symlink test/extract in v1 file format --- file_format_1_example_1 | Bin 341 -> 405 bytes src/archiver.c | 24 +++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/file_format_1_example_1 b/file_format_1_example_1 index 044ca9465cbb0e4a714c868a06a6003f1c728ad7..3b384a86296f886667d14908e3a8a3f1cf54b0bd 100644 GIT binary patch delta 75 zcmcc0G?jURfddl*0|Q@5W^svrNosM4UPei74p4-FD>E-8wF1uN0jo$ZF4hBLkUR%i LHITE>K$Q^y8N(F- delta 10 RcmbQre3fZ}!NvkrMgSFD19t!b diff --git a/src/archiver.c b/src/archiver.c index 429b85d..fbb91a8 100644 --- a/src/archiver.c +++ b/src/archiver.c @@ -2285,11 +2285,17 @@ int simple_archiver_parse_archive_version_1(FILE *in_f, int_fast8_t do_extract, read_buf_full_from_fd(in_f, (char *)buf, 1024, u16 + 1, link_name); if (ret != SDAS_SUCCESS) { return ret; - } else if (working_files_map && - simple_archiver_hash_map_get(working_files_map, link_name, - u16 + 1) == NULL) { + } + + if (!do_extract) { + fprintf(stderr, " Link name: %s\n", link_name); + } + + if (working_files_map && + simple_archiver_hash_map_get(working_files_map, link_name, u16 + 1) == + NULL) { skip_due_to_map = 1; - fprintf(stderr, "Skipping not specified in args...\n"); + fprintf(stderr, " Skipping not specified in args...\n"); } if (fread(buf, 1, 2, in_f) != 2) { @@ -2318,7 +2324,11 @@ int simple_archiver_parse_archive_version_1(FILE *in_f, int_fast8_t do_extract, link_extracted = 1; fprintf(stderr, " %s -> %s\n", link_name, path); #endif + } else { + fprintf(stderr, " Abs path: %s\n", path); } + } else if (!do_extract) { + fprintf(stderr, " No Absolute path.\n"); } if (fread(buf, 1, 2, in_f) != 2) { @@ -2347,10 +2357,14 @@ int simple_archiver_parse_archive_version_1(FILE *in_f, int_fast8_t do_extract, link_extracted = 1; fprintf(stderr, " %s -> %s\n", link_name, path); #endif + } else { + fprintf(stderr, " Rel path: %s\n", path); } + } else if (!do_extract) { + fprintf(stderr, " No Relative path.\n"); } - if (!link_extracted && !skip_due_to_map) { + if (do_extract && !link_extracted && !skip_due_to_map) { fprintf(stderr, "WARNING Symlink \"%s\" was not created!\n", link_name); } }