-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure absolute path for include #2092
Conversation
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] boostorg/filesystem@16bd89b [2] #2075
By the way, I briefly checked and there seems to be no breakage due to the Boost change in the two other places that call Thanks! |
@kunhtkun thanks so much for submitting a fix for this issue! That's one of the stoppers for getting a new release out. I'm not famliar with the code but why do we have to prepand a directory at all? Would just
work? I'm sure there's a reason this doesn't work. Just asking. |
Hi @tbm! You are welcome and thanks for taking care of this awesome project! Regarding the prepended path, we actually requires an existent parent path: Lines 758 to 767 in 474d2b8
otherwise
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've run some tests and I think this works as expected.
Kunht, thanks so much for this fix. This issue has been outstanding for far too long.
If you have time to fix other issues, please submit PRs and John and I will review. Ledger needs help.
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]. Ourresolve_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:gives
Therefore, we change to prepend the
context.current_directory
tomake the filename absolute in this case as well. The test
regress/BF3C1F82-2 is also updated to match the new output.
Fixes #2075.
[1] boostorg/filesystem@16bd89b
[2] #2075