+
Skip to content

appending to a file via shell redirecting (echo foo >> bar) replaces content from start of document, doesn't append #11799

@cloph

Description

@cloph

Windows Version

Microsoft Windows [Version 10.0.22635.3930]

WSL Version

2.3.11.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

6.6.36.3-microsoft-standard-WSL2

Distro Version

N/A (Almalinux, Mageia, doesn't make a difference)

Other Software

git-bash or cmd (i.e. run commands via wsl.exe from another shell/env)

Repro Steps

re-filing of #4400 that was closed due to inactivity, but the problem remains:
This is with git-bash, but just replace cat with type for trying with cmd

$ wsl.exe echo foo >> output
$ cat output
foo
$ wsl.exe echo barbazlonger >> output
$ cat output
barbazlonger
$ wsl.exe echo foo >> output
$ cat output
foo
azlonger

Expected Behavior

expected output is a file with following content:

foo
barbazlonger
foo

Actual Behavior

instead of appending, the redirection starts to replace from the start of the file, breaking all expectations.

Diagnostic Logs

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载