From 673d76928524f054df349427d351812665438878 Mon Sep 17 00:00:00 2001 From: Oleksandr Kulkov Date: Tue, 29 Oct 2024 04:19:02 +0100 Subject: [PATCH 1/4] escape {} into '' for non-standard filenames --- archiver/checks/default_preparation_checks.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archiver/checks/default_preparation_checks.ini b/archiver/checks/default_preparation_checks.ini index e9898b5..9c9b58b 100644 --- a/archiver/checks/default_preparation_checks.ini +++ b/archiver/checks/default_preparation_checks.ini @@ -26,7 +26,7 @@ precondition=find --version | grep 'GNU findutils' precondition_failure_msg=Requires GNU find. On mac, you can install it using 'brew install findutils' # for every link, resolve path relative to archive dir, if not within archive dir, print absolute # note, that the second -exec will only be executed if the previous exec was successful -check_cmd=find . -type l ! -xtype l -exec sh -c "realpath --relative-base . {} | grep --quiet '^/' " \; -exec echo {} \; +check_cmd=find . -type l ! -xtype l -exec sh -c "realpath --relative-base . '{}' | grep --quiet '^/' " \; -exec echo {} \; success_conditions=EMPTY_OUTPUT check_failure_msg=Found symlinks pointing outside the directory tree of {WDIR}. Archives may not be complete. From 06a88d0cf85811594ab53115c36c235be9922b34 Mon Sep 17 00:00:00 2001 From: Oleksandr Kulkov Date: Mon, 18 Nov 2024 23:17:27 +0100 Subject: [PATCH 2/4] Update test to cover nonstandard name --- tests/features/test_preparation_checks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/features/test_preparation_checks.py b/tests/features/test_preparation_checks.py index 2c75ffc..4f844d7 100644 --- a/tests/features/test_preparation_checks.py +++ b/tests/features/test_preparation_checks.py @@ -52,7 +52,7 @@ def test_symlinks_within_dir_only(default_checks: Dict[str, CmdBasedCheck], tmpd myfile = Path(tmpdir, 'myfile') myfile.touch() - mylink = Path(tmpdir, 'mylink') + mylink = Path(tmpdir, 'mylink (1)') mylink.symlink_to(myfile.relative_to(mylink.parent)) mylink2 = Path(tmpdir, 'mylink2') @@ -98,4 +98,4 @@ def test_no_duplicates(default_checks: Dict[str, CmdBasedCheck], tmpdir): myfile_link = Path(tmpdir, 'myfile_link') os.link(myfile, myfile_link) - assert not check.run(tmpdir) \ No newline at end of file + assert not check.run(tmpdir) From 23c56d482bff60da00bdc2d4ec35924f17997d14 Mon Sep 17 00:00:00 2001 From: Oleksandr Kulkov Date: Mon, 18 Nov 2024 23:20:34 +0100 Subject: [PATCH 3/4] check test failure --- archiver/checks/default_preparation_checks.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archiver/checks/default_preparation_checks.ini b/archiver/checks/default_preparation_checks.ini index 9c9b58b..e9898b5 100644 --- a/archiver/checks/default_preparation_checks.ini +++ b/archiver/checks/default_preparation_checks.ini @@ -26,7 +26,7 @@ precondition=find --version | grep 'GNU findutils' precondition_failure_msg=Requires GNU find. On mac, you can install it using 'brew install findutils' # for every link, resolve path relative to archive dir, if not within archive dir, print absolute # note, that the second -exec will only be executed if the previous exec was successful -check_cmd=find . -type l ! -xtype l -exec sh -c "realpath --relative-base . '{}' | grep --quiet '^/' " \; -exec echo {} \; +check_cmd=find . -type l ! -xtype l -exec sh -c "realpath --relative-base . {} | grep --quiet '^/' " \; -exec echo {} \; success_conditions=EMPTY_OUTPUT check_failure_msg=Found symlinks pointing outside the directory tree of {WDIR}. Archives may not be complete. From 3617fec0260adda6a5a935023cca4b2846feba26 Mon Sep 17 00:00:00 2001 From: Oleksandr Kulkov Date: Mon, 18 Nov 2024 23:25:40 +0100 Subject: [PATCH 4/4] wrap {} in '' --- archiver/checks/default_preparation_checks.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archiver/checks/default_preparation_checks.ini b/archiver/checks/default_preparation_checks.ini index e9898b5..0899646 100644 --- a/archiver/checks/default_preparation_checks.ini +++ b/archiver/checks/default_preparation_checks.ini @@ -26,7 +26,7 @@ precondition=find --version | grep 'GNU findutils' precondition_failure_msg=Requires GNU find. On mac, you can install it using 'brew install findutils' # for every link, resolve path relative to archive dir, if not within archive dir, print absolute # note, that the second -exec will only be executed if the previous exec was successful -check_cmd=find . -type l ! -xtype l -exec sh -c "realpath --relative-base . {} | grep --quiet '^/' " \; -exec echo {} \; +check_cmd=find . -type l ! -xtype l -exec sh -c "realpath --relative-base . '{}' | grep --quiet '^/' " \; -exec echo '{}' \; success_conditions=EMPTY_OUTPUT check_failure_msg=Found symlinks pointing outside the directory tree of {WDIR}. Archives may not be complete.