Description of the issue
Docker Compose v2 (compose-go) is stripping out escape characters when inside of a quoted string in a command (might happen in other circumstances).
If it's not in a quoted string, they are left as-is. For example, command: printf 'Hello\tworld\n' works while command: sh -c "printf 'Hello\tworld\n'" does not.
Context information (for bug reports)
Output of docker(-)compose version
Docker Compose version v2.0.0-rc.2
Output of docker version
Client:
Cloud integration: 1.0.17
Version: 20.10.8
API version: 1.41
Go version: go1.16.6
Git commit: 3967b7d
Built: Fri Jul 30 19:55:20 2021
OS/Arch: darwin/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.8
API version: 1.41 (minimum version 1.12)
Go version: go1.16.6
Git commit: 75249d8
Built: Fri Jul 30 19:52:10 2021
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.4.9
GitCommit: e25210fe30a0a703442421b0f60afac609f950a3
runc:
Version: 1.0.1
GitCommit: v1.0.1-0-g4144b63
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Output of docker-compose config
w/ v2 (v2.0.0-rc.2):
services:
hello-world:
command:
- sh
- -c
- printf 'Hellotworldn'
image: busybox
networks:
default: null
networks:
default:
name: escape-repro_default
w/ v1 (1.29.2, build 5becea4):
services:
hello-world:
command: sh -c "printf 'Hello\tworld\n'"
image: busybox
version: '3.9'
Steps to reproduce the issue
- Use an escape sequence (e.g.
\t or \n) inside of a quoted string in command
Observed result
- Docker Compose v2 (
compose-go) strips out the \ characters
Expected result
- Docker Compose leaves the
\ characters as-is
Stacktrace / full error message
n/a
Additional information
n/a
Description of the issue
Docker Compose v2 (
compose-go) is stripping out escape characters when inside of a quoted string in a command (might happen in other circumstances).If it's not in a quoted string, they are left as-is. For example,
command: printf 'Hello\tworld\n'works whilecommand: sh -c "printf 'Hello\tworld\n'"does not.Context information (for bug reports)
docker compose ...docker-compose ...Output of
docker(-)compose versionOutput of
docker versionOutput of
docker-compose configw/ v2 (v2.0.0-rc.2):
w/ v1 (1.29.2, build 5becea4):
Steps to reproduce the issue
\tor\n) inside of a quoted string incommandObserved result
compose-go) strips out the\charactersExpected result
\characters as-isStacktrace / full error message
n/a
Additional information
n/a