all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH container] config: allow empty environment variables
@ 2025-11-17 12:49 Filip Schauer
  2025-11-17 13:59 ` Fabian Grünbichler
  2025-11-17 14:15 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 5+ messages in thread
From: Filip Schauer @ 2025-11-17 12:49 UTC (permalink / raw)
  To: pve-devel

This fixes a problem with the docker.io/httpd OCI image which specifies
an empty environment variable. This violated the pattern of the `env`
property, causing `pct config <vmid>` to fail with:
```
env: value does not match the regex pattern
```

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
 src/PVE/LXC/Config.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index cd3a172..b6fc9a8 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -671,7 +671,7 @@ my $confdesc = {
         description => 'The container runtime environment as NUL-separated list.'
             . ' Replaces any lxc.environment.runtime entries in the config.',
         optional => 1,
-        pattern => qr/(?:\w+=[^\x00-\x1F\x7F]+)(?:\0\w+=[^\x00-\x1F\x7F]+)*/,
+        pattern => qr/(?:\w+=[^\x00-\x1F\x7F]*)(?:\0\w+=[^\x00-\x1F\x7F]*)*/,
     },
     hookscript => {
         optional => 1,
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] [PATCH container] config: allow empty environment variables
  2025-11-17 12:49 [pve-devel] [PATCH container] config: allow empty environment variables Filip Schauer
@ 2025-11-17 13:59 ` Fabian Grünbichler
  2025-11-17 14:05   ` Fabian Grünbichler
  2025-11-17 14:08   ` Filip Schauer
  2025-11-17 14:15 ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 2 replies; 5+ messages in thread
From: Fabian Grünbichler @ 2025-11-17 13:59 UTC (permalink / raw)
  To: Proxmox VE development discussion

On November 17, 2025 1:49 pm, Filip Schauer wrote:
> This fixes a problem with the docker.io/httpd OCI image which specifies
> an empty environment variable. This violated the pattern of the `env`
> property, causing `pct config <vmid>` to fail with:

shouldn't we handle this and drop that environment variable entry
instead?

> ```
> env: value does not match the regex pattern
> ```
> 
> Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
> ---
>  src/PVE/LXC/Config.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
> index cd3a172..b6fc9a8 100644
> --- a/src/PVE/LXC/Config.pm
> +++ b/src/PVE/LXC/Config.pm
> @@ -671,7 +671,7 @@ my $confdesc = {
>          description => 'The container runtime environment as NUL-separated list.'
>              . ' Replaces any lxc.environment.runtime entries in the config.',
>          optional => 1,
> -        pattern => qr/(?:\w+=[^\x00-\x1F\x7F]+)(?:\0\w+=[^\x00-\x1F\x7F]+)*/,
> +        pattern => qr/(?:\w+=[^\x00-\x1F\x7F]*)(?:\0\w+=[^\x00-\x1F\x7F]*)*/,
>      },
>      hookscript => {
>          optional => 1,
> -- 
> 2.47.3
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] [PATCH container] config: allow empty environment variables
  2025-11-17 13:59 ` Fabian Grünbichler
@ 2025-11-17 14:05   ` Fabian Grünbichler
  2025-11-17 14:08   ` Filip Schauer
  1 sibling, 0 replies; 5+ messages in thread
From: Fabian Grünbichler @ 2025-11-17 14:05 UTC (permalink / raw)
  To: Proxmox VE development discussion

On November 17, 2025 2:59 pm, Fabian Grünbichler wrote:
> On November 17, 2025 1:49 pm, Filip Schauer wrote:
>> This fixes a problem with the docker.io/httpd OCI image which specifies
>> an empty environment variable. This violated the pattern of the `env`
>> property, causing `pct config <vmid>` to fail with:
> 
> shouldn't we handle this and drop that environment variable entry
> instead?

hmm, thinking about this some more - I guess an empty string and not
being set are worth disambiguating?

> 
>> ```
>> env: value does not match the regex pattern
>> ```
>> 
>> Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
>> ---
>>  src/PVE/LXC/Config.pm | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
>> index cd3a172..b6fc9a8 100644
>> --- a/src/PVE/LXC/Config.pm
>> +++ b/src/PVE/LXC/Config.pm
>> @@ -671,7 +671,7 @@ my $confdesc = {
>>          description => 'The container runtime environment as NUL-separated list.'
>>              . ' Replaces any lxc.environment.runtime entries in the config.',
>>          optional => 1,
>> -        pattern => qr/(?:\w+=[^\x00-\x1F\x7F]+)(?:\0\w+=[^\x00-\x1F\x7F]+)*/,
>> +        pattern => qr/(?:\w+=[^\x00-\x1F\x7F]*)(?:\0\w+=[^\x00-\x1F\x7F]*)*/,
>>      },
>>      hookscript => {
>>          optional => 1,
>> -- 
>> 2.47.3
>> 
>> 
>> 
>> _______________________________________________
>> pve-devel mailing list
>> pve-devel@lists.proxmox.com
>> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>> 
>> 
>> 
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] [PATCH container] config: allow empty environment variables
  2025-11-17 13:59 ` Fabian Grünbichler
  2025-11-17 14:05   ` Fabian Grünbichler
@ 2025-11-17 14:08   ` Filip Schauer
  1 sibling, 0 replies; 5+ messages in thread
From: Filip Schauer @ 2025-11-17 14:08 UTC (permalink / raw)
  To: pve-devel

On 17/11/2025 14:59, Fabian Grünbichler wrote:
> shouldn't we handle this and drop that environment variable entry
> instead?

An empty environment variable is not the same as a missing one. The
entrypoint in the container might interpret it differently:

```
$ perl -e 'use Data::Dumper; print Dumper($ENV{A});'
$VAR1 = undef;
$ A= perl -e 'use Data::Dumper; print Dumper($ENV{A});'
$VAR1 = '';
```



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied: [PATCH container] config: allow empty environment variables
  2025-11-17 12:49 [pve-devel] [PATCH container] config: allow empty environment variables Filip Schauer
  2025-11-17 13:59 ` Fabian Grünbichler
@ 2025-11-17 14:15 ` Thomas Lamprecht
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2025-11-17 14:15 UTC (permalink / raw)
  To: pve-devel, Filip Schauer

On Mon, 17 Nov 2025 13:49:03 +0100, Filip Schauer wrote:
> This fixes a problem with the docker.io/httpd OCI image which specifies
> an empty environment variable. This violated the pattern of the `env`
> property, causing `pct config <vmid>` to fail with:
> ```
> env: value does not match the regex pattern
> ```
> 
> [...]

I actually wondered about that and had the frontend "allowBlank" check
initially such that the value was only required if the name field was set (as
the variable simply gets deleted otherwise), but I then changed it to both to
be required, as allowing something more is almost always easier to do in the
future compared to restricting it, especially if it involves API exposed schema.

Anyhow, the UI part would need now also adaption to make your change fully work
also there.

Applied, thanks!

[1/1] config: allow empty environment variables
      commit: 9a5f5ce5cfdbc85b2d40a4a20662065d18b85f6c


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-17 14:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-17 12:49 [pve-devel] [PATCH container] config: allow empty environment variables Filip Schauer
2025-11-17 13:59 ` Fabian Grünbichler
2025-11-17 14:05   ` Fabian Grünbichler
2025-11-17 14:08   ` Filip Schauer
2025-11-17 14:15 ` [pve-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal