On Remote SSH Linux, the agent Write tool (or file sync layer) can persist CRLF in *.sh

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

On Remote SSH Linux, the agent Write tool (or file sync layer) can persist CRLF in *.sh; breaks shebang/cron; sed/dos2unix fixes it. Repro: Write a bash script on Linux remote → file script.sh shows “with CRLF line terminators”. Include build/OS, Remote SSH, and that LF-only shell writes work outside Write.

Steps to Reproduce

Agent produced .sh file that contained CRLF, and write tool did not clean it before writing to the Linux host.

Expected Behavior

Write should ensure the correct line endings are used on each target host.

Operating System

MacOS
Linux

Version Information

Version: 3.21.16 (Universal)
VS Code Extension API: 1.128.0
Commit: 8ae78e8eee1e63479c7e0504b664bc0a80c68000
Date: 2026-09-19T06:43:22.276Z
Layout: IDE
Build Type: Stable
Release Track: Default
Electron: 42.10.0
Chromium: 148.0.7778.280
Node.js: 24.18.1
V8: 14.8.178.38-electron.0
xterm.js: 6.1.0-beta.291
OS: Darwin arm64 24.6.0

For AI issues: which model did you use?

don’t remember

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey @jawaidbazyar2, thanks for the report!

I’ve flagged this to the team. When the agent creates a new file, it picks line endings by sampling files that already exist in the workspace. If a few of those files use CRLF, a new script can end up with CRLF even on a Linux host. It doesn’t currently follow files.eol, .editorconfig, or .gitattributes.

Could you check whether that’s what is happening on your remote? In a terminal on the Linux host, from the workspace root, run:

  1. grep -rlI $'\r' --exclude-dir=.git --exclude-dir=node_modules . | head -20
  2. Reply with whether it lists any files (and roughly what kind, e.g. .bat, .csv, docs copied from Windows).

In the meantime, a project rule along the lines of “after creating or editing any .sh file, run sed -i 's/\r$//' <file>” works around it, as does converting the CRLF files in the workspace to LF if they don’t need to stay CRLF.

hello!

I performed that listing, and nothing is coming up except files that might have had CRLF in them having been uploaded years ago.

I check your workaround. thanks!