-
Notifications
You must be signed in to change notification settings - Fork 3
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
Various fixes #361
Various fixes #361
Conversation
This fixes a bug where a newline after a bar in a pipeline was not parsed correctly if it appeared as a result of alias substitution.
The next token after a blank-ending alias should be subject to alias substitution. However, the shell was not substituting the alias if there was a line continuation before the next token. This was because the LexerCore::is_after_blank_ending_alias function was only looking for the last non-blank character before the current position. This commit changes the function to also check if the character is a line continuation. To enable this, a new LexerCore::mark_line_continuation function is added to mark the characters in a given range as line continuation. The Lexer::line_continuation function now calls this function to mark the characters it has consumed as line continuation.
WalkthroughThe recent updates across various components of the Changes
Poem
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (7)
Additional Context UsedLanguageTool (74)
AST-based Instructions (17)
ShellCheck (11)
Learnings (1)
Additional comments not posted (11)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
The previous implementation of the LexerCore::peek_char method naively used the current index to calculate the start index of the location at the current position. This approach was incorrect because the index could be changed by an alias substitution that changed the length of the source code. This commit fixes the issue by introducing a new method, LexerCore::next_index, that computes the index from the last character of the source code. Fixes #280
All `System::open_tmpfile` implementations should consistently return a file descriptor without the `O_CLOEXEC` flag set. Otherwise, it would break callers that expect the file descriptor to be visible to the user. Previously, the 'command exec retains redirection' test was failing because the file descriptor to the temporary file containing the here- document content was not visible to the command.
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.
Actionable comments posted: 0
Actionable comments outside the diff hunks (4)
yash-cli/tests/scripted_test/command-p.sh (2)
Line range hint
79-79
: Check the syntax in the subshell.There seems to be a syntax error in the explicit subshell. Please review the syntax to ensure it is correct and does not prevent further checks.
Line range hint
85-85
: Correct the syntax error with the!
command.- command -v ! + command -v \!Ensure there is a space after the
!
to avoid syntax errors and to ensure the command is interpreted correctly.yash-cli/tests/scripted_test/alias-p.sh (2)
Line range hint
10-10
: Check the syntax in the explicit subshell.There appears to be a syntax error in the explicit subshell. Please review the syntax to ensure it is correct and does not prevent further checks.
Line range hint
84-84
: Correct the syntax error with the{
and}
characters.- alias b=' cat | c - ; a ' c=' cat ' + alias b=' cat | c - ; a ' c=' cat; 'Ensure that the
{
and}
characters are used correctly in the context of shell scripting to avoid syntax errors and to ensure the command is interpreted correctly.
Addresses issues in #336
Summary by CodeRabbit
Bug Fixes
Refactor
Documentation