kumquat-buildroot/fs
Yann E. MORIN 08d65d81d8 fs/oci: entrypoint and command are space-separated lists
The prompt and variable name for the OCI "entrypoint arguments" are
somewhat incorrect. Indeed, they are in fact used to set the image
"command". Yet, using "command" would be confusing too, because the
interplay between entrypoint and command is tricky [0].

TL-DR; when both entrrypoint and command are set, command acts as
arguments passed to the entrypoint.

Additionally, we currently can only pass a single item as either
entrypoint or command. This precludes passing actual arguments to the
entrypoint, or passing multiple arguments as command.

For example:
    BR2_TARGET_ROOTFS_OCI_ENTRYPOINT="/bin/tini -g -p SIGTERM --"
    BR2_TARGET_ROOTFS_OCI_ENTRYPOINT_ARGS="/usr/bin/env sh"

generates an images with (only relevant fields are included below):

    {
        "config": {
            "Entrypoint": [ "/bin/tini -g -p SIGTERM --" ],
            "Cmd": [ "/usr/bin/env sh" ]
        }
    }

This is obviously incorrect, and not what one would expect:

    {
        "config": {
            "Entrypoint": [ "/bin/tini", "-g", "-p", "SIGTERM", "--" ],
            "Cmd": [ "/usr/bin/env", "sh" ]
        }
    }

However, some people do want to be able to pass an actual shell
scriptlet as a command, such as:

    {
        "config": {
            "Entrypoint": [ "/bin/sh", "-c" ],
            "Cmd": [ "my shell logic goes here" ]
        }
    }

Handling both is obviously conflicting: we can't both split-on-spaces
and not-split-on-spaces at the same time...

So, we fix that in two ways:

  - make the current _OCI_ENTRYPOINT_ARGS a legacy option, and introduce
    the new _OCI_CMD option with different semantics (see below) and an
    appropriate prompt;

  - we interpret both _OCI_ENTRYPOINT and _OCI_CMD as shell strings,
    which we subject to the usual shell quoting [1] and token
    recognition [2];

Since _OCI_ENTRYPOINT_ARGS used to be interpreted as a single string, we
can't easily change its meaning to be a space-separated list, as that
would break existing setups, which is the reason we make it legacy and
introduce a new option.

Ideally, we would like to default the new option _OCI_CMD to be the
quoted value of the previous _OCI_ENTRYPOINT_ARGS, but this is not
possible in Kconfig. Still, users that had a _OCI_ENTRYPOINT_ARGS set
will now get an early build error, and can still detect they need to do
something about it.

As for _OCI_ENTRYPOINT, it does not make much sense to support both cases.
Indeed, without splitting on spaces, we'd end up with an entrypoint that
would have a single item:

    {
        "config": {
            "entrypoint: [ "some string with some spaces" ]
        }
    }

which in this case would try to execute the program which name is
actually "some string with some spaces", so we do not expect that
existing entrypoints are set with any space in them, and so the new
behaviour, unlike for _OCI_ENTRYPOINT_ARGS vs. _OCI_CMD, is compatible
with existing configurations, and so we do not need to make it a legacy
option and introduce a new one.

[0] https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact
[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02
[2] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Sergio Prado <sergio.prado@e-labworks.com>
Cc: Matthew Weber <matthew.weber@collins.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2022-05-15 22:03:26 +02:00
..
axfs
btrfs fs: don't use := when not needed 2019-10-27 10:35:06 +01:00
cloop
cpio fs/cpio: add zstd as compression option 2021-01-16 22:45:34 +01:00
cramfs
erofs fs/erofs: add big pcluster support 2021-07-19 22:34:21 +02:00
ext2 fs/ext2: fir (again) namespace for variables 2021-10-13 18:01:34 +02:00
f2fs fs: don't use := when not needed 2019-10-27 10:35:06 +01:00
initramfs fs/initramfs: fix show-info 2020-03-18 22:44:19 +01:00
iso9660 fs/iso9660: add support for hybrid image using Grub2 on BIOS and EFI 2021-09-29 22:58:57 +02:00
jffs2 fs/jffs2: copy xattrs 2020-10-08 21:48:03 +02:00
oci fs/oci: entrypoint and command are space-separated lists 2022-05-15 22:03:26 +02:00
romfs
squashfs fs: squashfs: Add config option to pass nopad parameter to mksquashfs 2020-06-17 23:01:23 +02:00
tar fs: don't use := when not needed 2019-10-27 10:35:06 +01:00
ubi fs/ubi: expose BINARIES_DIR to ubinize.cfg 2020-06-06 13:43:43 +02:00
ubifs
yaffs2
common.mk fs/common.mk: use find instead of shell glob patterns 2022-03-12 17:45:21 +01:00
Config.in fs: new OCI filesystem type 2021-09-11 14:52:41 +02:00