Possible bug in Kas's include handler

9 views
Skip to first unread message

Nicholas Clark

unread,
Aug 26, 2025, 6:58:31 PM (12 days ago) Aug 26
to kas-devel
I'm working on a Kas-based Yocto design, and I ran into an interesting issue. When using Git submodules to pull in an external repo, I found that Kas couldn't parse config files stored in the repo. It can parse the same files if I clone the repo directly instead of as a submodule.

Here's a quick way to reproduce it:

Works:
    $ mkdir tmpdir && cd tmpdir
    $ git clone https://github.com/qualcomm-linux/meta-qcom.git
    $ kas dump meta-qcom/ci/qcs9100-ride-sx.yml

Doesn't work:
    $ mkdir tmpdir && cd tmpdir
    $ git init && git submodule init
    $ kas dump meta-qcom/ci/qcs9100-ride-sx.yml
2025-08-26 15:37:20 - INFO     - kas 4.8.2 started
2025-08-26 15:37:20 - ERROR    - Configuration file not found: (CWD)/tmp/tmpdir/ci/base.yml

From Kas's documentation (https://kas.readthedocs.io/en/latest/userguide/project-configuration.html#including-in-tree-configuration-files), I'd expect that these should both work identically.

But as it turns out, Kas's include handler (defined in includehandler.py) calls Repo.get_root_path(), which returns the root directory of the parent Git project instead of the root directory of the submodule.

I think this might be a bug, because:

1. The documented behavior (which is what we want) doesn't match the implementation
2. The implementation makes it hard to pull in somebody's Kas-based design as a dependency in a larger build.

What do you folks think about this?

- Nick Clark

Stefano Babic

unread,
Aug 27, 2025, 8:09:26 AM (11 days ago) Aug 27
to Nicholas Clark, kas-devel
Hi Nicholas,

On 8/27/25 00:58, Nicholas Clark wrote:
> I'm working on a Kas-based Yocto design, and I ran into an interesting
> issue. When using Git submodules to pull in an external repo, I found
> that Kas couldn't parse config files stored in the repo. It can parse
> the same files if I clone the repo directly instead of as a submodule.
>

Just my two cents: one very good reason (among the other ones) to use
kas is to get rid of submodules that are not intended to be used in OE.

meta layers are not using submodule, a new layer is created when needed.

> Here's a quick way to reproduce it:
>
> Works:
>     $ mkdir tmpdir && cd tmpdir
>     $ git clone https://github.com/qualcomm-linux/meta-qcom.git
>     $ kas dump meta-qcom/ci/qcs9100-ride-sx.yml
>
> Doesn't work:
>     $ mkdir tmpdir && cd tmpdir
>     $ git init && git submodule init
>     $ git submodule add https://github.com/qualcomm-linux/meta-qcom.git
>     $ kas dump meta-qcom/ci/qcs9100-ride-sx.yml
> 2025-08-26 15:37:20 - INFO     - kas 4.8.2 started
> 2025-08-26 15:37:20 - ERROR    - Configuration file not found: (CWD)/
> tmp/tmpdir/ci/base.yml
>
> From Kas's documentation (https://kas.readthedocs.io/en/latest/
> userguide/project-configuration.html#including-in-tree-configuration-
> files), I'd expect that these should both work identically.
>

I do not see that submodules are supported.

> But as it turns out, Kas's include handler (defined in
> includehandler.py) calls Repo.get_root_path(), which returns the root
> directory of the parent Git project instead of the root directory of the
> submodule.
>
> I think this might be a bug, because:
>
> 1. The documented behavior (which is what we want) doesn't match the
> implementation
> 2. The implementation makes it hard to pull in somebody's Kas-based
> design as a dependency in a larger build.
>
> What do you folks think about this?

IMHO it should be added to the documentation that this use case is not
supported.

Best regards,
Stefano

>
> - Nick Clark
>
> --
> You received this message because you are subscribed to the Google
> Groups "kas-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to kas-devel+...@googlegroups.com <mailto:kas-
> devel+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/kas-
> devel/c589b01c-b01d-4a8d-9932-7996d5b4b841n%40googlegroups.com <https://
> groups.google.com/d/msgid/kas-devel/c589b01c-
> b01d-4a8d-9932-7996d5b4b841n%40googlegroups.com?
> utm_medium=email&utm_source=footer>.

--
Nabla Software Engineering GmbH
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: off...@nabladev.com
Geschäftsführer : Stefano Babic

MOESSBAUER, Felix

unread,
Aug 29, 2025, 10:43:50 AM (9 days ago) Aug 29
to sba...@nabladev.com, nichola...@gmail.com, kas-...@googlegroups.com
According to our documentation submodules are supported, but
limitations apply (see below).

>
> > But as it turns out, Kas's include handler (defined in
> > includehandler.py) calls Repo.get_root_path(), which returns the
> > root
> > directory of the parent Git project instead of the root directory
> > of the
> > submodule.
> >
> > I think this might be a bug, because:
> >
> > 1. The documented behavior (which is what we want) doesn't match
> > the
> > implementation

If I got your issue right, the documentation exactly explains this case
in the submodule note:

Citing the docs:
Git submodules are considered to be part of the main repository. Hence,
including config files from a submodule is supported.
The repository root is always the root of the main repository
----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^
(if under VCS) or the directory of the first kas config file otherwise.


> > 2. The implementation makes it hard to pull in somebody's Kas-based
> > design as a dependency in a larger build.

Not really, as you can just add a kas file in your repo that fetches
just the sub-repo and includes files from there.

> >
> > What do you folks think about this?

In general, I do not recommend to mix repository management tools like
repotool, git submodules and kas, as you almost certainly will run into
corner cases.

Also, I personally do not recommend to use git submodules at all -
these are fundamentally broken for years and hard to work with.

>
> IMHO it should be added to the documentation that this use case is
> not
> supported.

Feel free to send a patch to improve the documentation regarding this
:)

Best regards,
Felix

>
> Best regards,
> Stefano
>
> >
> > - Nick Clark
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "kas-devel" group.
> > To unsubscribe from this group and stop receiving emails from it,
> > send
> > an email to kas-devel+...@googlegroups.com <mailto:kas-
> > devel+un...@googlegroups.com>.
> > To view this discussion visit
> > https://groups.google.com/d/msgid/kas-
> > devel/c589b01c-b01d-4a8d-9932-7996d5b4b841n%40googlegroups.com
> > <https://
> > groups.google.com/d/msgid/kas-devel/c589b01c-
> > b01d-4a8d-9932-7996d5b4b841n%40googlegroups.com?
> > utm_medium=email&utm_source=footer>.
>
> --
> Nabla Software Engineering GmbH
> HRB 40522 Augsburg
> Phone: +49 821 45592596
> E-Mail: off...@nabladev.com
> Geschäftsführer : Stefano Babic

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

Reply all
Reply to author
Forward
0 new messages