Skip to content

redirecting v4.0.0 scripts' output to a file adds spurious bytes #11255

Description

@programandala-net

i use fish 4.0.0 on debian 12.9.

after updating fish 3.7.1 to 4.0.0 one of my tools written in fish started giving wrong, strange results.

finally i have isolated the problem and confirmed it does not happen with v3.7.1 (which i temporarily reinstalled for confirmation): when the output of a fish script is redirected to a file, five bytes are added at the start and at the end of the file. both sequences start with an ANSI escape code.

bytes added at the start of the file:

1B 5B 36 20 71

bytes added at the end of the file:

1B 5B 32 20 71

the problem can be reproduced with this "hello.fish":

#!/usr/bin/env fish
# hello.fish
echo hello
./hello.fish # good output to screen
./hello.fish > hello.txt # wrong output to file

first i suspected the problem lies with echo, but the same happens with this "ls.fish":

#!/usr/bin/env fish
# ls.fish
ls
./ls.fish # good output to screen
./ls.fish > ls.txt # wrong output to file

it seems a bug. anyway i've searched the changes of fish 4.0.0, just in case i missed something, but found nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    regressionSomething that used to work, but was broken, especially between releases

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions