[PATCH 1/2] fix(kas-container): append to runtime-args on repeated usage

4 views
Skip to first unread message

Felix Moessbauer

unread,
Jun 29, 2026, 3:02:09 PMJun 29
to kas-...@googlegroups.com, jan.k...@siemens.com, Felix Moessbauer, Joerg Sommer
We need to append to the KAS_EXTRA_RUNTIME_ARGS when parsing
--runtime-args, as otherwise the last one wins.

Fixes: 5435c6cce ("kas-container: Move container engine detection ...")
Reported-by: Joerg Sommer <joerg....@navimatix.de>
Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
kas-container | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kas-container b/kas-container
index 631e40c3e..8f704f17b 100755
--- a/kas-container
+++ b/kas-container
@@ -345,7 +345,7 @@ while [ $# -gt 0 ]; do
;;
--runtime-args | --docker-args)
[ $# -gt 0 ] || usage
- KAS_EXTRA_RUNTIME_ARGS=" $2"
+ KAS_EXTRA_RUNTIME_ARGS="${KAS_EXTRA_RUNTIME_ARGS} $2"
shift 2
;;
--ssh-dir)
--
2.53.0

Felix Moessbauer

unread,
Jun 29, 2026, 3:02:11 PMJun 29
to kas-...@googlegroups.com, jan.k...@siemens.com, Felix Moessbauer
These options consume arg 2, so we have to compare for greater 1.
Using -gt 0 is too lax as it accepts a missing value, while -gt 2 is too
strict as it rejects when the argument is the last one.

Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
We don't provide a fixes tag, as this pattern was copy-pasted from
an ancient version.
kas-container | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kas-container b/kas-container
index 8f704f17b..5adf1e507 100755
--- a/kas-container
+++ b/kas-container
@@ -344,12 +344,12 @@ while [ $# -gt 0 ]; do
shift 1
;;
--runtime-args | --docker-args)
- [ $# -gt 0 ] || usage
+ [ $# -gt 1 ] || usage
KAS_EXTRA_RUNTIME_ARGS="${KAS_EXTRA_RUNTIME_ARGS} $2"
shift 2
;;
--ssh-dir)
- [ $# -gt 2 ] || usage
+ [ $# -gt 1 ] || usage
KAS_SSH_DIR="$2"
shift 2
;;
@@ -361,18 +361,18 @@ while [ $# -gt 0 ]; do
shift 1
;;
--aws-dir)
- [ $# -gt 2 ] || usage
+ [ $# -gt 1 ] || usage
KAS_AWS_DIR="$2"
shift 2
;;
--git-credential-store)
- [ $# -gt 2 ] || usage
+ [ $# -gt 1 ] || usage
KAS_GIT_CREDENTIAL_STORE="$2"
shift 2
;;

--git-credential-socket)
- [ $# -gt 2 ] || usage
+ [ $# -gt 1 ] || usage
KAS_GIT_CREDENTIAL_SOCKET="$2"
shift 2
;;
--
2.53.0

Jörg Sommer

unread,
Jun 30, 2026, 12:55:28 AMJun 30
to Felix Moessbauer, kas-...@googlegroups.com, jan.k...@siemens.com
'Felix Moessbauer' via kas-devel schrieb am Mo 29. Jun, 21:01 (+0200):
> These options consume arg 2, so we have to compare for greater 1.

Why not greater or equal 2? Then the number in the check would match the
used argument number.


Regards, Jörg
--
Navimatix GmbH T: 03641 - 327 99 0
Tatzendpromenade 2 F: 03641 - 526 306
07745 Jena www.navimatix.de

Geschäftsführer: Steffen Späthe, Jan Rommeley
Registergericht: Amtsgericht Jena, HRB 501480

Joerg Sommer

unread,
Jun 30, 2026, 12:58:06 AMJun 30
to Felix Moessbauer, kas-...@googlegroups.com, jan.k...@siemens.com
Felix Moessbauer schrieb am Mo 29. Jun, 21:01 (+0200):
> We need to append to the KAS_EXTRA_RUNTIME_ARGS when parsing
> --runtime-args, as otherwise the last one wins.
>
> Fixes: 5435c6cce ("kas-container: Move container engine detection ...")
> Reported-by: Joerg Sommer <joerg....@navimatix.de>
> Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
> ---
> kas-container | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

I've applied this commit locally, and it works. Thank you.


Best regards, Jörg

MOESSBAUER, Felix

unread,
Jun 30, 2026, 3:12:30 AMJun 30
to Jörg Sommer, kas-...@googlegroups.com, Kiszka, Jan
On Tue, 2026-06-30 at 06:55 +0200, Jörg Sommer wrote:
> 'Felix Moessbauer' via kas-devel schrieb am Mo 29. Jun, 21:01 (+0200):
> > These options consume arg 2, so we have to compare for greater 1.
>
> Why not greater or equal 2? Then the number in the check would match the
> used argument number.

True, but isn't that just a matter of taste? I didn't want to change
the operator (to keep the fix minimal). Jan should decide and just
apply the change if this looks better to him.

Felix


--
Siemens AG
Linux Expert Center
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany

Jörg Sommer

unread,
Jun 30, 2026, 6:25:37 AMJun 30
to MOESSBAUER, Felix, kas-...@googlegroups.com, Kiszka, Jan
MOESSBAUER, Felix schrieb am Di 30. Jun, 07:12 (+0000):
> On Tue, 2026-06-30 at 06:55 +0200, Jörg Sommer wrote:
> > 'Felix Moessbauer' via kas-devel schrieb am Mo 29. Jun, 21:01 (+0200):
> > > These options consume arg 2, so we have to compare for greater 1.
> >
> > Why not greater or equal 2? Then the number in the check would match the
> > used argument number.
>
> True, but isn't that just a matter of taste?

Yes. It's really not a big thing. But while reading the code, I thought it
would be easier to review if the right number is checked, if they are the
same. So you have constantly to think about the number, too. But this might
only be a question of having coffee or not. :)

Jan Kiszka

unread,
Jul 6, 2026, 1:45:46 AM (8 days ago) Jul 6
to Felix Moessbauer, kas-...@googlegroups.com, Joerg Sommer
Thanks, applied.

I guess as this is rather simple to fix locally and not affecting too
many users, I won't do a release only for it.

Jan

--
Siemens AG, Foundational Technologies
Linux Expert Center

Jan Kiszka

unread,
Jul 6, 2026, 1:50:09 AM (8 days ago) Jul 6
to Felix Moessbauer, kas-...@googlegroups.com
On 29.06.26 21:01, Felix Moessbauer wrote:
> These options consume arg 2, so we have to compare for greater 1.
> Using -gt 0 is too lax as it accepts a missing value, while -gt 2 is too
> strict as it rejects when the argument is the last one.

As kas-container needs at least one positional argument, -gt 2 is not
correct and confusing but harmless in practice. I'm clarifying this on
merge.
Thanks, applied.
Reply all
Reply to author
Forward
0 new messages