-
Notifications
You must be signed in to change notification settings - Fork 400
Improved Shell Detection #1658
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
Improved Shell Detection #1658
Conversation
This replaces the /etc/passwd check with the output of the SHELL environment variable.
This is a fix for the FilterValidArch function
WalkthroughThe pull request introduces modifications to two files: In In 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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
🧹 Nitpick comments (1)
cmd/wsh/cmd/wshcmd-shell-unix.go (1)
39-39
: Ensure consistent newline usage.Currently, the code returns
strings.TrimSpace(shell)
without appending a newline, whereas the fallback above ("/bin/bash\n"
) includes one. If consistent output formatting is desired, consider appending a newline here as well.- return strings.TrimSpace(shell) + return strings.TrimSpace(shell) + "\n"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cmd/wsh/cmd/wshcmd-shell-unix.go
(1 hunks)pkg/util/utilfn/utilfn.go
(1 hunks)
🔇 Additional comments (3)
cmd/wsh/cmd/wshcmd-shell-unix.go (1)
35-36
: Use of environment variable improves simplicity and portability.
This approach of reading the SHELL
environment variable is more straightforward than parsing /etc/passwd
. However, consider the edge case where SHELL
is incorrectly set by the user. Currently, the code silently defaults to "/bin/bash\n"
, which might differ from the true login shell, but it seems acceptable given the PR's objectives.
If you’d like, I can provide a quick verification script to locate and audit any references to /etc/passwd
or environment variable usage across the codebase.
pkg/util/utilfn/utilfn.go (2)
977-977
: Unifying "amd64" to "x64" is correct and enhances consistency.
This standardization helps avoid confusion caused by multiple architecture labels for the same underlying platform. Good job!
979-979
: Same logic applies to "x86_64".
Also aligns with common synonyms for x64. If other aliases arise (e.g., "em64t"), a separate PR can extend this further if needed.
Use the SHELL environment variable instead of the /etc/passwd file for determining the shell on Linux.
Use the SHELL environment variable instead of the /etc/passwd file for determining the shell on Linux.