Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: Explicitly list 'hooks' as optional #427

Merged
merged 3 commits into from
Jan 6, 2017

Conversation

wking
Copy link
Contributor

@wking wking commented May 6, 2016

And make it omitempty, otherwise:

$ ocitools generate --template <(echo '{}')
$ cat config.json | jq -S .
{
  "hooks": {},
  ...
}

To provide space for the type information and optional, I've shuffled the hook docs to follow our usual:

* **`{property}`** ({type}, {when-needed}) {notes}

format. I've kept the separate event-trigger sections (e.g. ### Prestart) since they go into more detail on the timing, purpose, and exit handling for the different events (and that seemed like too much information to put into the nested lists).

This may be unnecessary if #384 kills hooks, although:

  1. I'm not sure if the run command will keep hooks, and
  2. The current Split create and start #384 tip still has these hook docs.

Entries in the array contain the following properties:
* **`path`** (string, required) with the same semantics as Go's [`Cmd.Path`][go-cmd].
Hook paths are absolute and are executed from the host's filesystem in the [runtime namespace][runtime-namespace].
* **`args`** (array of strings, optional) with the same semantics as Go's [`Cmd.Args`][go-cmd].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't make this go specific, its args and env like every args and env ever

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Fri, May 06, 2016 at 10:36:29AM -0700, Michael Crosby wrote:

  • * path (string, required) with the same semantics as Go's [Cmd.Path][go-cmd].
  •  Hook paths are absolute and are executed from the host's filesystem in the [runtime namespace][runtime-namespace].
    
  • * args (array of strings, optional) with the same semantics as Go's [Cmd.Args][go-cmd].

Don't make this go specific, its args and env like every args and env ever

The Go reference is inherited from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, #255). I'm fine changing it to an
execve(2) reference or some such if you'd rather, but folks might
consider that platform-specific. POSIX also has execve(3p) 1, but
it's in unistd.h, which may be POSIX-specific. Is there a generic C
spec that covers this idea?

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 20, 2016
And make it omitempty, otherwise:

  $ ocitools generate --template <(echo '{}')
  $ cat config.json | jq -S .
  {
    "hooks": {},
    ...
  }

To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:

  * **`{property}`** ({type}, {when-needed}) {notes}

format.  I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).

I've replaced the Go reference from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, opencontainers#255) with POSIX references (following the
new process docs) to address pushback against referencing Go [1,2] in
favor of punting to platforms with POSIX links for POSIX systems [3].

[1]: opencontainers#427 (comment)
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-46
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 20, 2016
And make it omitempty, otherwise:

  $ ocitools generate --template <(echo '{}')
  $ cat config.json | jq -S .
  {
    "hooks": {},
    ...
  }

To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:

  * **`{property}`** ({type}, {when-needed}) {notes}

format.  I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).

I've replaced the Go reference from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, opencontainers#255) with POSIX references (following the
new process docs) to address pushback against referencing Go [1,2] in
favor of punting to platforms with POSIX links for POSIX systems [3].

[1]: opencontainers#427 (comment)
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-46
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 20, 2016
And make it omitempty, otherwise:

  $ ocitools generate --template <(echo '{}')
  $ cat config.json | jq -S .
  {
    "hooks": {},
    ...
  }

To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:

  * **`{property}`** ({type}, {when-needed}) {notes}

format.  I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).

I've replaced the Go reference from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, opencontainers#255) with POSIX references (following the
new process docs) to address pushback against referencing Go [1,2] in
favor of punting to platforms with POSIX links for POSIX systems [3].

[1]: opencontainers#427 (comment)
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-46
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor Author

wking commented May 20, 2016

This got some airtime in Wendesday's meeting, with the consensus being:

  • Don't reference Go (fine with me).
  • Do reference POSIX (also fine with me), but phrase it so the POSIX reference only applies to POSIX systems (I thought this would be ok, but no longer like it).

I've just pushed cb4cfd8a77a35a where I try to stick to the letter of that consensus (also updating the docs for process.args and process.env for consistency). However, now that I see it in action, I'd much rather make remove the “platform-appropriate way” wiggle words and point to POSIX for all platforms.

Attempting to dig into Windows support (@RobDolinMS, please correct me if I'm getting this wrong), it seems like Visual Studio 2015 does not support POSIX's execv and similar but does support C++ analogs in _execv and similar. Those look like drop-in replacements to me (although the docs are very sparse). And the compatibility notes discuss the leading underscore and say:

Only the default POSIX names are deprecated, not the functions

More generally, the compatibility notes say:

The UCRT also implements a large subset of the POSIX.1 (ISO/IEC 9945-1:1996, the POSIX System Application Program Interface) C library, but is not fully conformant to any specific POSIX standard.

which sounds like enough grounds for POSIX links here. If that sounds plausible, I can try to dig up a linkable version of the 1996 standard (although it's been withdrawn). Or we can keep linking to the 2001/2004 version and assume there haven't been serious changes at the basic level we're referencing (seems plausible based on the history, although I haven't tracked down the relevant System V docs).

@wking
Copy link
Contributor Author

wking commented May 20, 2016

Short form of the previous comment:

I'd like to drop the “platform-appropriate” wiggle and just require POSIX. I think that's ok based on the age of the execv interface and apparent Windows (and cross-platform Go) support. I'm also ok keeping the old Go links, since Go covers the obvious platforms. Can I do either of those, or does everyone else really want the wordy “platform-appropriate” wiggle?

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 20, 2016
And make it omitempty, otherwise:

  $ ocitools generate --template <(echo '{}')
  $ cat config.json | jq -S .
  {
    "hooks": {},
    ...
  }

To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:

  * **`{property}`** ({type}, {when-needed}) {notes}

format.  I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).

I've replaced the Go reference from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, opencontainers#255) with POSIX references (following the
new process docs) to address pushback against referencing Go [1,2] in
favor of punting to platforms with POSIX links [3].  Rob Dolin had
suggested "platform-appropriate" wording [4], but it seems like Visual
Studio 2015 supports execv [5], and providing an explicit
"platform-appropriate" wiggle seems like it's adding useless
complication.

[1]: opencontainers#427 (comment)
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-46
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-52
[4]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54
[5]: https://msdn.microsoft.com/en-us/library/886kc0as.aspx

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor Author

wking commented May 20, 2016

With a77a35ab0f0096 I just went ahead and dropped the “platform-appropriate” wiggle. Details in each commit message with links to Windows' Visual Studio 2015 supporting the POSIX semantics.

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 20, 2016
And make it omitempty, otherwise:

  $ ocitools generate --template <(echo '{}')
  $ cat config.json | jq -S .
  {
    "hooks": {},
    ...
  }

To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:

  * **`{property}`** ({type}, {when-needed}) {notes}

format.  I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).

I've replaced the Go reference from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, opencontainers#255) with POSIX references (following the
new process docs) to address pushback against referencing Go [1,2] in
favor of POSIX links [3].  Rob Dolin had suggested
"platform-appropriate" wording [4], but it seems like Visual Studio
2015 supports execv [5], and providing an explicit
"platform-appropriate" wiggle seems like it's adding useless
complication.

[1]: opencontainers#427 (comment)
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-46
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-52
[4]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54
[5]: https://msdn.microsoft.com/en-us/library/886kc0as.aspx

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jun 18, 2016
I'd added some omitempties in 5c2193f (specs-go/config: Make Linux
and Solaris omitempty, 2016-05-06, opencontainers#431), but it turns out to not have
the intended effect unless the field is also a pointer type.  Before
this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
    "linux": {
      "cgroupsPath": ""
    },
    "solaris": {
      "cappedCPU": {},
      "cappedMemory": {}
    }
  }

And after this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
  }

The remaining useless properties are addressed by other in-flight pull
requests:

* 5ca74df (config: Make 'process.args' optional, 2016-06-04, opencontainers#489)
* ad33f9c (config: Explicitly list 'hooks' as optional, 2016-05-06,
  opencontainers#427)

So I've left them alone here.

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jun 18, 2016
I'd added some omitempties in 5c2193f (specs-go/config: Make Linux
and Solaris omitempty, 2016-05-06, opencontainers#431), but it turns out to not have
the intended effect unless the field is also a pointer type (even
after I shifted the 'omitempty' from the platform tag to the json tag

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
    "linux": {
      "cgroupsPath": ""
    },
    "solaris": {
      "cappedCPU": {},
      "cappedMemory": {}
    }
  }

And after this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
  }

The remaining useless properties are addressed by other in-flight pull
requests:

* 5ca74df (config: Make 'process.args' optional, 2016-06-04, opencontainers#489)
* ad33f9c (config: Explicitly list 'hooks' as optional, 2016-05-06,
  opencontainers#427)

So I've left them alone here.

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jun 18, 2016
I'd added some omitempties in 5c2193f (specs-go/config: Make Linux
and Solaris omitempty, 2016-05-06, opencontainers#431), but it turns out to not have
the intended effect unless the field is also a pointer type (even
after I shifted the 'omitempty' from the platform tag to the json
tag).  Before this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
    "linux": {
      "cgroupsPath": ""
    },
    "solaris": {
      "cappedCPU": {},
      "cappedMemory": {}
    }
  }

And after this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
  }

The remaining useless properties are addressed by other in-flight pull
requests:

* 5ca74df (config: Make 'process.args' optional, 2016-06-04, opencontainers#489)
* ad33f9c (config: Explicitly list 'hooks' as optional, 2016-05-06,
  opencontainers#427)

So I've left them alone here.

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/ocitools-v2 that referenced this pull request Aug 3, 2016
Using jq to format the output so we don't have to worry about
ocitools' default tab indents or lack of trailing newlines, neither of
which play nicely with <<-EOF here documents.

The tests are known failures, because runtime-spec v1.0.0-rc1 lacks
good omitempty handling.

  $ ocitools generate --template <(echo '{}')
  …
    "hooks": {},
    "linux": {},
    "solaris": {
      "cappedCPU": {},
      "cappedMemory": {}
    }
  }

These issues are addressed by the in-flight [1,2], although their late
landings in runtime-spec mean we'll never be able to address them in
the v1.0.0.rc1 branch of ocitools.

[1]: opencontainers/runtime-spec#427
     Subject: config: Explicitly list 'hooks' as optional
[2]: opencontainers#112
     Subject: generate: Adjust to Spec.Linux being a pointer

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Aug 3, 2016
The new wording isn't particularly close to either of the old
wordings, but it reads more clearly to me.  I've also added our usual:

  (<type>, <required|optional>)

to the Markdown so folks can see that this is an optional object
(although see [1] for a more complete version).

[1]: opencontainers#427
     Subject: config: Explicitly list 'hooks' as optional

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor Author

wking commented Aug 17, 2016

Now that we've closed #483 and are aiming for a certifiable/testable hook specification, I think we want to land this PR or something like it.

Mashimiao pushed a commit to Mashimiao/specs that referenced this pull request Aug 19, 2016
I'd added some omitempties in 5c2193f (specs-go/config: Make Linux
and Solaris omitempty, 2016-05-06, opencontainers#431), but it turns out to not have
the intended effect unless the field is also a pointer type (even
after I shifted the 'omitempty' from the platform tag to the json
tag).  Before this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
    "linux": {
      "cgroupsPath": ""
    },
    "solaris": {
      "cappedCPU": {},
      "cappedMemory": {}
    }
  }

And after this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
  }

The remaining useless properties are addressed by other in-flight pull
requests:

* 5ca74df (config: Make 'process.args' optional, 2016-06-04, opencontainers#489)
* ad33f9c (config: Explicitly list 'hooks' as optional, 2016-05-06,
  opencontainers#427)

So I've left them alone here.

Signed-off-by: W. Trevor King <wking@tremily.us>
Mashimiao pushed a commit to Mashimiao/specs that referenced this pull request Aug 19, 2016
The new wording isn't particularly close to either of the old
wordings, but it reads more clearly to me.  I've also added our usual:

  (<type>, <required|optional>)

to the Markdown so folks can see that this is an optional object
(although see [1] for a more complete version).

[1]: opencontainers#427
     Subject: config: Explicitly list 'hooks' as optional

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Aug 26, 2016
And make it omitempty, otherwise:

  $ ocitools generate --template <(echo '{}')
  $ cat config.json | jq -S .
  {
    "hooks": {},
    ...
  }

To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:

  * **`{property}`** ({type}, {when-needed}) {notes}

format.  I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).

I've replaced the Go reference from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, opencontainers#255) with POSIX references (following the
new process docs) to address pushback against referencing Go [1,2] in
favor of POSIX links [3].  Rob Dolin had suggested
"platform-appropriate" wording [4], but it seems like Visual Studio
2015 supports execv [5], and providing an explicit
"platform-appropriate" wiggle seems like it's adding useless
complication.

[1]: opencontainers#427 (comment)
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-46
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-52
[4]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54
[5]: https://msdn.microsoft.com/en-us/library/886kc0as.aspx

Signed-off-by: W. Trevor King <wking@tremily.us>
@vbatts
Copy link
Member

vbatts commented Sep 16, 2016

On 15/09/16 20:37 -0700, W. Trevor King wrote:

Anything I can do to help this along? It had an LGTM and an SGTM two
weeks back before a tiny rebase ;).

Re-reading the patches, one thing I don't like about it is that it
doesn't directly convey the form. Just simply linking out to IEEE is a
punt, and if an implementer only has this document then it's not quite
helpful.

It would be more helpful to convey more of the form, even if quoting
from the IEEE link and including the link for more reference.

@wking
Copy link
Contributor Author

wking commented Sep 16, 2016

On Fri, Sep 16, 2016 at 05:22:52AM -0700, Vincent Batts wrote:

Re-reading the patches, one thing I don't like about it is that it
doesn't directly convey the form. Just simply linking out to IEEE is a
punt, and if an implementer only has this document then it's not quite
helpful.

Punting was the plan ;). When would an implementer have this document
handy but not be able to click on the links to POSIX?

It would be more helpful to convey more of the form, even if quoting
from the IEEE link and including the link for more reference.

We don't quote when we punt MUST, MAY, etc. to RFC 2119, or when we
punt the code of conduct to the TOB, or when we punt UTF-8 to its
spec, or when we punt SemVer to its spec, or when we punt the GOOS
listing to Go's spec, or when we punt mount options to mount(8), ….
So I'm fine not quoting here. It would make our spec wordier and have
the usual not-DRY exposure to deviations.

But those are small downsides, so if for whatever reason you really
want me to inline some POSIX here I can do that. How much would you
like? Do you want me to follow the environment variable definition
1 down into the Portable Character Set 2? Do you want me to keep
going as far as “It is unwise to conflict…” 1? From the exec docs
3, do you want me to quote the whole definition for argv, file, and
path? Should these excerpts go inline in hooks, or be pushed down to
an appendix or some such?

@vbatts
Copy link
Member

vbatts commented Sep 16, 2016 via email

@wking
Copy link
Contributor Author

wking commented Sep 16, 2016

On Fri, Sep 16, 2016 at 12:30:11PM -0700, Vincent Batts wrote:

Quite literally, having the example of "NAME=VALUE" demonstration
with referring the particulars to IEEE.

Don't we already have that name=value example down here 1?

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Sep 21, 2016
And make it omitempty, otherwise:

  $ ocitools generate --template <(echo '{}')
  $ cat config.json | jq -S .
  {
    "hooks": {},
    ...
  }

To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:

  * **`{property}`** ({type}, {when-needed}) {notes}

format.  I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).

I've replaced the Go reference from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, opencontainers#255) with POSIX references (following the
new process docs) to address pushback against referencing Go [1,2] in
favor of POSIX links [3].  Rob Dolin had suggested
"platform-appropriate" wording [4], but it seems like Visual Studio
2015 supports execv [5], and providing an explicit
"platform-appropriate" wiggle seems like it's adding useless
complication.

[1]: opencontainers#427 (comment)
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-46
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-52
[4]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54
[5]: https://msdn.microsoft.com/en-us/library/886kc0as.aspx

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor Author

wking commented Sep 21, 2016

Changed Spec.Hooks to a pointer in abc704a9bd270e to avoid the issue from #569.

@wking
Copy link
Contributor Author

wking commented Oct 15, 2016

Anything I can do to help this along?

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Oct 15, 2016
And make it omitempty, otherwise:

  $ ocitools generate --template <(echo '{}')
  $ cat config.json | jq -S .
  {
    "hooks": {},
    ...
  }

To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:

  * **`{property}`** ({type}, {when-needed}) {notes}

format.  I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).

I've replaced the Go reference from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, opencontainers#255) with POSIX references (following the
new process docs) to address pushback against referencing Go [1,2] in
favor of POSIX links [3].  Rob Dolin had suggested
"platform-appropriate" wording [4], but it seems like Visual Studio
2015 supports execv [5], and providing an explicit
"platform-appropriate" wiggle seems like it's adding useless
complication.

[1]: opencontainers#427 (comment)
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-46
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-52
[4]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54
[5]: https://msdn.microsoft.com/en-us/library/886kc0as.aspx

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor Author

wking commented Oct 15, 2016

Rebased onto master resolving a few conflicts (mostly with #574 but also shifting some wording that had landed in #525).

@hqhq
Copy link
Contributor

hqhq commented Dec 30, 2016

LGTM

Approved with PullApprove

@mrunalp mrunalp added this to the 1.0.0 milestone Jan 4, 2017
The uppercase letter / digit / underscore restriction is just for
"variables used by the utilities in the Shell and Utilities volume of
IEEE Std 1003.1-2001".

Copying over some POSIX wording and then linking to POSIX didn't seem
like much gain.  Just point people at POSIX and let them read about
the name=value definition, charset suggestions, etc. there.

Also link specifically to chapter 8 section 1 (instead of just chapter
8).

Rob Dolin had suggested "platform-appropriate" wording [1], but it
seems like Visual Studio 2015 supports an environment-variable array
with the same semantics [2], and providing an explicit
"platform-appropriate" wiggle seems like it's adding useless
complication.

[1]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54
[2]: https://msdn.microsoft.com/en-us/library/431x4c1w.aspx

Signed-off-by: W. Trevor King <wking@tremily.us>
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 most of the semantics to POSIX, which does a better job
than we'll do at specifying this.  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/2004 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).  For 2001 vs. 2004, [1] has:

  Abstract: The 2004 edition incorporates Technical Corrigendum Number
  1 and Technical Corrigendum 2 addressing problems discovered since
  the approval of the 2001 edition. These are mainly due to resolving
  integration issues raised by the merger of the Base documents.

and the text in the linked pages uses "IEEE Std 1003.1-2001" for
internal linking.

Rob Dolin had suggested "platform-appropriate" wording [2], but it
seems like Visual Studio 2015 supports execvp [3], and providing an
explicit "platform-appropriate" wiggle seems like it's adding useless
complication.

[1]: http://pubs.opengroup.org/onlinepubs/009695399/mindex.html
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54
[3]: https://msdn.microsoft.com/en-us/library/3xw6zy53.aspx

Signed-off-by: W. Trevor King <wking@tremily.us>
And make it omitempty, otherwise:

  $ ocitools generate --template <(echo '{}')
  $ cat config.json | jq -S .
  {
    "hooks": {},
    ...
  }

To provide space for the type information and 'optional', I've
shuffled the hook docs to follow our usual:

  * **`{property}`** ({type}, {when-needed}) {notes}

format.  I've kept the separate event-trigger sections (e.g. "###
Prestart") since they go into more detail on the timing, purpose, and
exit handling for the different events (and that seemed like too much
information to put into the nested lists).

I've replaced the Go reference from 48049d2 (Clarify the semantics of
hook elements, 2015-11-25, opencontainers#255) with POSIX references (following the
new process docs) to address pushback against referencing Go [1,2] in
favor of POSIX links [3].  Rob Dolin had suggested
"platform-appropriate" wording [4], but it seems like Visual Studio
2015 supports execv [5], and providing an explicit
"platform-appropriate" wiggle seems like it's adding useless
complication.

[1]: opencontainers#427 (comment)
[2]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-46
[3]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-52
[4]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2016/opencontainers.2016-05-18-17.01.log.html#l-54
[5]: https://msdn.microsoft.com/en-us/library/886kc0as.aspx

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor Author

wking commented Jan 4, 2017

I've just pushed b281671a78f255 rebasing onto master (no conflicts) to avoid the golint compilation failure. @hqhq, can you re-LGTM?

@hqhq
Copy link
Contributor

hqhq commented Jan 5, 2017

LGTM, thanks.

Approved with PullApprove

@wking wking mentioned this pull request Jan 5, 2017
@mrunalp
Copy link
Contributor

mrunalp commented Jan 6, 2017

LGTM

Approved with PullApprove

@mrunalp mrunalp merged commit 7dce97b into opencontainers:master Jan 6, 2017
@wking wking deleted the optional-hooks branch January 6, 2017 05:44
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 25, 2017
These references had been using IEEE Std 1003.1, 2004 Edition, but:

  $ curl -s http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html | grep -B2 'newer edition'
  <center><font size="2">The Open Group Base Specifications Issue 6<br>
  IEEE Std 1003.1, 2004 Edition<br>
  Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><center><font color="red">A newer edition of this document exists <a href="http://pubs.opengroup.org/onlinepubs/9699919799/" target="_parent">here</a></font></center>

Shifting to 2016 also syncs us with the 'file' reference in
config-linux.md.  The initial reasoning for the 2004 edition is
unclear to me (more on that in 70858bc, config: Adjust process.args
to cite POSIX's execvp, 2016-05-19, opencontainers#427),

The change-log for the exec page [1] doesn't list any relevant
changes, and skimming a diff of the two HTML pages didn't turn up
anything significant.

Diffing the two HTML pages for environment variables also turned up no
significant changes.  Both definition reference the Portable Character
Set for uppercase letters, digits, and underscore, but the U####
values for those have not changed [2,3].

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html#tag_16_111_14
[2]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap06.html#tag_06_01
[3]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html#tag_06_01

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 25, 2017
These references had been using IEEE Std 1003.1, 2004 Edition, but:

  $ curl -s http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html | grep -B2 'newer edition'
  <center><font size="2">The Open Group Base Specifications Issue 6<br>
  IEEE Std 1003.1, 2004 Edition<br>
  Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><center><font color="red">A newer edition of this document exists <a href="http://pubs.opengroup.org/onlinepubs/9699919799/" target="_parent">here</a></font></center>

Shifting to 2016 also syncs us with the 'file' reference in
config-linux.md.  The initial reasoning for the 2004 edition is
unclear to me (more on that in 70858bc, config: Adjust process.args
to cite POSIX's execvp, 2016-05-19, opencontainers#427),

The change-log for the exec page [1] doesn't list any relevant
changes, and skimming a diff of the two HTML pages didn't turn up
anything significant.

Diffing the two HTML pages for environment variables also turned up no
significant changes.  Both definition reference the Portable Character
Set for uppercase letters, digits, and underscore, but the U####
values for those have not changed [2,3].

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html#tag_16_111_14
[2]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap06.html#tag_06_01
[3]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html#tag_06_01

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jun 1, 2017
These references had been using IEEE Std 1003.1, 2004 Edition, but:

  $ curl -s http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html | grep -B2 'newer edition'
  <center><font size="2">The Open Group Base Specifications Issue 6<br>
  IEEE Std 1003.1, 2004 Edition<br>
  Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><center><font color="red">A newer edition of this document exists <a href="http://pubs.opengroup.org/onlinepubs/9699919799/" target="_parent">here</a></font></center>

Shifting to 2016 also syncs us with the 'file' reference in
config-linux.md.  The initial reasoning for the 2004 edition is
unclear to me (more on that in 70858bc, config: Adjust process.args
to cite POSIX's execvp, 2016-05-19, opencontainers#427),

The change-log for the exec page [1] doesn't list any relevant
changes, and skimming a diff of the two HTML pages didn't turn up
anything significant.

Diffing the two HTML pages for environment variables also turned up no
significant changes.  Both definition reference the Portable Character
Set for uppercase letters, digits, and underscore, but the U####
values for those have not changed [2,3].

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html#tag_16_111_14
[2]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap06.html#tag_06_01
[3]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html#tag_06_01

Signed-off-by: W. Trevor King <wking@tremily.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants