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
env-file not handling multiline nor quotes #19565
Comments
Hi @edsantiago. I'm not very certain whether there's truly an issue here. The behavior of pull request #19096 should remain consistent with previous implementations, so I believe this should be expected. |
I think this is great, but I have another idea: perhaps we should define the behavior for "multi-line" just like the newline1 in your example. In my opinion, this shouldn't be supported. Also, the current implementation for multi-line is inspired by dotenv. |
In the initial implementation of PR #19096, I would remove the surrounding quotes. However, this would lead to inconsistency with the previous behavior and potentially cause larger issues. See: #19096 (comment) |
@BlackHole1 I did not mean to suggest that this is your problem. It is not. It's not a regression, nor related to anything you did. This is our problem, and it is longstanding. |
How does Docker handle @edsantiago env-file? |
In fact, it has already been documented. See: c67ef7c |
Regarding this matter, I've investigated previously, and Docker's env-file doesn't support multiple lines. Ref: #19096 (comment) |
I believe a better approach would be to define the behavior for multi-line functionality through RFC before actual implementation. This should be accompanied by a substantial number of comprehensive tests. Without RFCs, it could pose difficulties for future maintenance. Currently, the support for multi-line functionality is achieved using complex regular expressions, which can prove inconvenient for later maintenance (even though it was copied from dotenv). I have an idea in mind, which involves implementing multi-line functionality through the use of an AST, and having it managed separately in another repository. Regarding issue #19096, I remember it wasn't merged into version 4.6. Therefore, I suggest that we consider rolling back both #19096 and #19560. Once a universally acceptable solution has been determined by the community, we can proceed to re-implement it |
There is one regression from 4.6: $ cat >hashenv
foo=abc#def
$ bin/podman run --env-file hashenv quay.io/libpod/testimage:20221018 printenv foo <--- main (bad)
abc
$ /usr/bin/podman run --env-file hashenv quay.io/libpod/testimage:20221018 printenv foo <--- 4.6 (good)
abc#def |
Looks like we're almost bug-for-bug compatible with docker[1]:
To remain docker compatible, we should probably revert both #19096 and #19560, with apologies to @BlackHole1 . I would prefer to break docker compatibility, because env-file currently violates POLA. But this isn't my decision. Regardless of what we do, we must:
[1] moby-engine-20.10.23-1.fc38.x86_64 |
The root cause was #18724. As I said in the issue we should stay backwards compatible. I think the only use case was to allow multi line newlines envvars. The docker and old podman env file logic is dead simple it is In general the question is what do we want? IMO docker compatibility is important, so far the only users asked for multiline env var support in #18724 and I hoped that #19096 would only do that. I think reverting for now is a good choice but then we need to keep in mind that variables with newlines are not supported. |
A friendly reminder that this issue had no activity for 30 days. |
4.7.0-rc1 was released and these patches are in. IMO we should stick top backwards and docker compatibility. The old format was much simpler:
So we had either Given that this has worked fine without users complaining I see no reason to change this much. The request that started this change is #18724 and there support for newlines was asked. Adding new support for handling quotes support the export keyword may make it better compatible with shell env files but the current code is extremely hard to understand, the regex is just insanity. And the risk of breaking compatibility is high. As @edsantiago shows at the very least we have regression regarding the |
Hi, I just saw the env-file change on the changelog for v4.7.0, and I was very surprised by seeing this breaking change in a supposedly minor update. I think this change should be treated as a bug in this version and the whole feature should be reverted in a hotfix v4.7.1. I agree with @Luap99 above in that not only backwards but also docker compatibility is desirable here. Edit: and simplicity, and maintainability. Also, the new regex logic seems too complex to be something maintained in podman instead of a more generic lib. Inventing a new format for this seems a bit much in my opinion. I'm not a user of dotenv but from what I gather it seems to be a de-facto standard for this kind of thing, so if greater flexibility is needed, I'd suggest sticking to the standard and deferring parsing to a lib that already does that, and introducing a new option like |
@jntesteves Does this actively effect you, i.e actually break some of your files? I am fine with reverting it for a possible 4.7.1. |
As a downstream consumer of podman it changes my API in the same way it changes podman's, but I'm too small to be of your concern and my API isn't even stable yet anyway. I'm just the kind of person overly-concerned with API changes. I'm sorry for pinging you with a comment that is little more than an opinion, it was inappropriate. |
This change did break an existing Bitwarden pod deployment I have. I leverage an env file being mounted into the container with the
In 4.6.2 and earlier, that value was retained in full. With 4.7.0, that var would be brought into the container as only:
Which causes a service to crash and not be able to connect to the DB. |
That problem was mentioned above in #19565 (comment) But even if the intended design was good when working properly, right now it is broken with all the bugs mentioned in this issue. |
I am going to open a PR to revert it for 4.7.1, this was clearly not the right choice. |
This reverts commit 7ce654f. see containers#19565
This reverts commit c67ef7c. see containers#19565 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This reverts commit 170a786. This was a breaking change and users are hitting it, see containers#19565 Fixes containers#19565 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This reverts commit 7ce654f. see containers#19565 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This reverts commit c67ef7c. see containers#19565 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This reverts commit 170a786. This was a breaking change and users are hitting it, see containers#19565 Fixes containers#19565 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This reverts commit 7ce654f. see containers#19565 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This reverts commit c67ef7c. see containers#19565 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This reverts commit 170a786. This was a breaking change and users are hitting it, see containers#19565 Fixes containers#19565 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
The format for env-file is not documented anywhere. However, judging from comments in #19096 and from the way bash parses env lines, I believe that:
Whatever PR fixes this, do not under any circumstances allow it to merge until I have written a comprehensive test suite for it.
The text was updated successfully, but these errors were encountered: