Skip to content

ENAMETOOLONG Crash during text input parsing #26979

Description

@betterversion

Description

The CLI crashes when pasting long technical text containing slashes or version numbers (e.g., package@14). It appears the input parser mistakenly identifies long strings of prose as local file paths and passes them to lstat.

Root Cause

Inadequate validation/sanitization of extracted "potential paths" before system calls. If the extracted string exceeds OS PATH_MAX or contains invalid characters (like quotes/newlines), the process exits with an unhandled ENAMETOOLONG error. This is likely due to a greedy regex (e.g., \/[^\s]+) used for path discovery in user input.

Reproduction

Paste a 300+ character paragraph containing a directory-like string (e.g., /my-repo/) followed by a long block of text without spaces.

Example Trigger

The crash was triggered by the following string:
.../my-bootstrap-scripts/14", restart_service....

Expected Behavior

The CLI should fail gracefully if a potential path is invalid or too long, instead of crashing with a stack trace.

Environment

  • OS: darwin (macOS)
  • Version: 0.41.2 (as identified from system paths)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/coreIssues related to User Interface, OS Support, Core Functionalityeffort/small1 day or less: trivial logic, UI adjustments, docskind/bugpriority/p1Important and should be addressed in the near term.status/bot-triaged

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions