diff options
author | Kunht Kun <kunhtkun@gmail.com> | 2022-03-09 01:26:07 -0500 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2022-03-09 19:34:11 +0800 |
commit | ba8ec32435313b4749a3733071b3184ca6bd8e14 (patch) | |
tree | 9a70f5b6ba76688270f270ba3b9702d71677a1fa /test | |
parent | 474d2b8d091ba865c17c554a4ecdfb0d05325d3f (diff) | |
download | fork-ledger-ba8ec32435313b4749a3733071b3184ca6bd8e14.tar.gz fork-ledger-ba8ec32435313b4749a3733071b3184ca6bd8e14.tar.bz2 fork-ledger-ba8ec32435313b4749a3733071b3184ca6bd8e14.zip |
Ensure absolute path for include
Ensure the path of file to include in `instance_t::include_directive`
is always an absolute path.
Previously when the journal file is given through stdin, we prepend a
"./" to the filename to include. However, in Boost >= 1.77,
`path::normalize` strips the leading "./" [1]. Our `resolve_path`
function calls `normalize` and thus now it returns "file" for "./file"
instead of the previous "./file".
This change causes a failing test regress/BF3C1F82-2 [2], and also
breaks the `include` directive for stdin input:
$ touch file-to-include
$ echo "include file-to-include" | ledger -f - reg
gives
While parsing file "", line 1:
Error: File to include was not found: "file-to-include"
Therefore, we change to prepend the `context.current_directory` to
make the filename absolute in this case as well. The test
regress/BF3C1F82-2 is also updated to match the new output.
Fixes #2075.
[1] https://github.com/boostorg/filesystem/commit/16bd89b7c0398d0dc5904148a865ef3fc3ece7ec
[2] https://github.com/ledger/ledger/issues/2075
Diffstat (limited to 'test')
-rw-r--r-- | test/regress/BF3C1F82-2.test | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/regress/BF3C1F82-2.test b/test/regress/BF3C1F82-2.test index 598af506..49a10e80 100644 --- a/test/regress/BF3C1F82-2.test +++ b/test/regress/BF3C1F82-2.test @@ -4,11 +4,11 @@ include non-existent-ledger-file-BF3C1F82 test -f - reg -> 1 __ERROR__ While parsing file "", line 2: -Error: File to include was not found: "non-existent-ledger-file-BF3C1F82" +Error: File to include was not found: "$sourcepath/non-existent-ledger-file-BF3C1F82" end test test -f /dev/stdin reg -> 1 __ERROR__ While parsing file "", line 2: -Error: File to include was not found: "non-existent-ledger-file-BF3C1F82" +Error: File to include was not found: "$sourcepath/non-existent-ledger-file-BF3C1F82" end test |