-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escape sequences cannot be used inside quoted strings #8605
Comments
compose v2 but getting |
Yeah - the conversion from string -> list isn't surprising, just the stripping out of Output of running under both versions: v1:
v2:
(FWIW There's also a subtle difference here in v2 which is that if the last log line doesn't end in |
It actually works with double backslash. Looks like the backslash is escaped too. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I can confirm this is still the case as of v2.3.3 |
This issue has been automatically marked as not stale anymore due to the recent activity. |
seems that all my bash scripts that were passed in the command to bash containers broke because of this |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it had not recent activity during the stale period. |
This issue has been automatically marked as not stale anymore due to the recent activity. |
this bug is caused by |
Oh, nice find! Ironically, I just added a use of that function today (but in e2e code so not likely to be affected) It'd be nice to publish a Go utility lib (or augment one of our existing ones) that handled a lot of the POSIX-isms our tools rely one on of these days |
I recently also stumbled upon that issue and it is currently present in many test setups for TYPO3 and it's extensions. The lines
are executed not as one, but two lines and therefore the XDEBUG_MODE variable is not used by the phpunit command afterwards. I'm using Debian 12 and docker-compose v2.17.0, another user i chatted with who also had problems with that used Ubuntu 23.04 and docker-compose v2.17.2. Is this something that can and should be fixed in docker-compose or should we rewrite our docker-compose.yml files? |
@mmunz command should better not be used with such a long shell script. This will make maintenance painful and subject to bugs like this one. Better move this into a script file you mount as a volume (on copy in a Dockerfile) and pass environment to the container so value get resolved during execution. This also make it easier to run this exact same script standalone outside a Docker container for testing purpose |
@ndeloof while i tend to agree, it is imho still a problem that docker-compose v1 and v2 parse these scripts differently. |
this is for sure an issue, but we don't have any simple solution here. The root issue here is that |
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 version
Output of
docker version
Output of
docker-compose config
w/ v2 (v2.0.0-rc.2):
w/ v1 (1.29.2, build 5becea4):
Steps to reproduce the issue
\t
or\n
) inside of a quoted string incommand
Observed result
compose-go
) strips out the\
charactersExpected result
\
characters as-isStacktrace / full error message
n/a
Additional information
n/a
The text was updated successfully, but these errors were encountered: