Skip to content

[BUG] sdscatrepr not escaping " and \ characters anymore #2035

Description

@Fusl

When executing monitor, special characters such as ", \ and others should be escaped properly. This used to be the case up to version 8.0.3, but with 8.1.0, commands such as echo 'foo"bar' and echo "foo\\" produce an incorrect monitor output of

+1746085153.283830 [0 127.0.0.1:55236] "echo" "foo"bar"
+1746085167.954618 [0 127.0.0.1:55236] "echo" "foo\"

whereas on 8.0.3, the same commands produced a correct monitor output of

+1746085205.816900 [0 127.0.0.1:55272] "echo" "foo\"bar"
+1746085206.927962 [0 127.0.0.1:55272] "echo" "foo\\"

A git bisect shows that this bug was introduced in commit cf1a1e0

The bug introduced in this commit is caused by the isprint(*p) returning a positive result for the " and \ characters such that the switch block inside the else block is never reached for those.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions