Skip to content

Commit 694bff4

Browse files
committed
config: Adjust process.args to cite POSIX's execvp
This punts the awkward-to-enforce "MUST be available at the given path inside of the rootfs" to the kernel, which will do a much better job of enforcing that constraint than runtime code or a static validator. It also punts on the PATH reference to POSIX, which already covers the PATH lookup for 'file' arguments. The extension is necessary because POSIX allows argv to be empty. In the DESCRIPTION: The argument arg0 should point to a filename that is associated with the process being started by one of the exec functions. And in RATIONALE: Early proposals required that the value of argc passed to main() be "one or greater". This was driven by the same requirement in drafts of the ISO C standard. In fact, historical implementations have passed a value of zero when no arguments are supplied to the caller of the exec functions. This requirement was removed from the ISO C standard and subsequently removed from this volume of IEEE Std 1003.1-2001 as well. The wording, in particular the use of the word should, requires a Strictly Conforming POSIX Application to pass at least one argument to the exec function, thus guaranteeing that argc be one or greater when invoked by such an application. In fact, this is good practice, since many existing applications reference argv[0] without first checking the value of argc. But with an empty 'args' we will have no process to call (since process lacks an explicit 'file' analog). I chose the 2001 POSIX spec for consistency with the existing reference (which landed in 7ac41c6, config.md: reformat into a standard style, 2015-06-30, which did not motivate it's use of an older standard). The "platform-appropriate way" wording comes from Rob Dolin [1], and gives space for non-POSIX systems to define their own args semantics (although that seems like it would be a terrible idea ;). [1]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54 Signed-off-by: W. Trevor King <[email protected]>
1 parent 4801054 commit 694bff4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

config.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ See links for details about [mountvol](http://ss64.com/nt/mountvol.html) and [Se
9191
* **`env`** (array of strings, optional) contains a list of variables that will be set in the process's environment prior to execution.
9292
Elements in the array are specified in a platform-appropriate way.
9393
On POSIX platforms the strings MUST have the form *name=value*, where *name* MUST NOT contain the character `=`, as outlined in [IEEE Std 1003.1-2001][ieee-1003.1-2001-xbd-c8.1].
94-
* **`args`** (array of strings, required) executable to launch and any flags as an array. The executable is the first element and MUST be available at the given path inside of the rootfs. If the executable path is not an absolute path then the search $PATH is interpreted to find the executable.
94+
* **`args`** (array of strings, required) contains a list of arguments passed to the executable.
95+
The semantics of the array are specified in a platform-appropriate way.
96+
On POSIX platforms the semantics are similar to [IEEE Std 1003.1-2001 `execvp`'s *argv*][ieee-1003.1-2001-xsh-exec].
97+
This specification extends the IEEE standard in that at least one entry is REQUIRED, and that entry is used with the same semantics as `execvp`'s *file*.
9598

9699
For Linux-based systems the process structure supports the following process specific fields:
97100

@@ -665,5 +668,6 @@ Here is a full example `config.json` for reference.
665668
```
666669

667670
[ieee-1003.1-2001-xbd-c8.1]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html#tag_08_01
671+
[ieee-1003.1-2001-xsh-exec]: http://pubs.opengroup.org/onlinepubs/009695399/functions/exec.html#tag_03_130
668672
[runtime-namespace]: glossary.md#runtime-namespace
669673
[uts-namespace]: http://man7.org/linux/man-pages/man7/namespaces.7.html

0 commit comments

Comments
 (0)