{"action":"created","issue":{"url":"https://api.github.com/repos/genodelabs/genode/issues/2171","repository_url":"https://api.github.com/repos/genodelabs/genode","labels_url":"https://api.github.com/repos/genodelabs/genode/issues/2171/labels{/name}","comments_url":"https://api.github.com/repos/genodelabs/genode/issues/2171/comments","events_url":"https://api.github.com/repos/genodelabs/genode/issues/2171/events","html_url":"https://github.com/genodelabs/genode/issues/2171","id":187813031,"number":2171,"title":"Make label prefixing more strict","user":{"login":"nfeske","id":1268399,"avatar_url":"https://avatars.githubusercontent.com/u/1268399?v=3","gravatar_id":"","url":"https://api.github.com/users/nfeske","html_url":"https://github.com/nfeske","followers_url":"https://api.github.com/users/nfeske/followers","following_url":"https://api.github.com/users/nfeske/following{/other_user}","gists_url":"https://api.github.com/users/nfeske/gists{/gist_id}","starred_url":"https://api.github.com/users/nfeske/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfeske/subscriptions","organizations_url":"https://api.github.com/users/nfeske/orgs","repos_url":"https://api.github.com/users/nfeske/repos","events_url":"https://api.github.com/users/nfeske/events{/privacy}","received_events_url":"https://api.github.com/users/nfeske/received_events","type":"User","site_admin":false},"labels":[{"id":203367,"url":"https://api.github.com/repos/genodelabs/genode/labels/cleanup","name":"cleanup","color":"1b7921","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-07T20:04:13Z","updated_at":"2016-11-07T20:42:34Z","closed_at":null,"body":"While working on the async root/parent interfaces (#2120) and the accompanied adaptation of the component-creation procedure, I came across the following idea:\r\n\r\nWe used to pass a lot of arguments to the `Child` constructor such as the child's initial ROM/CPU/PD sessions, and the dataspaces for the ELF binary and the dynamic linker. With the new framework, it would be much more natural to let the child obtain those sessions using its regular session-routing mechanics that is subjected to the `Child_policy` anyway. This would not only make the child constructor much simpler, it would also ease the life of people who want to virtualize the services behind the basic sessions of the child (e.g., the loader, or noux).\r\n\r\nIf the child obtains its environment sessions using the regular session routing, the `Child_policy::resolve_session_request` method is called for these requests as well and we can conveniently route them to a corresponding service, most commonly a parent service. The problem is, however, that this policy method cannot distinguish the environment sessions from label-less sessions created by the child itself. If we want to create a child but don't want to allow the child to open a PD session by itself, the policy method cannot distinguish both cases because the current implementation of the `prefixed_label` function handles the special cases of the prefix of label being empty. In these cases, it sets the label to the non-empty part.\r\n\r\nTo resolve this ambiguity, I propose to always prefix the label with the \" -> \" characters between the prefix and the label even if one of both elements is not there. This way, the child's environment PD session would end up being labeled as \"child_name\" whereas a label-less PD session created by the child would become \"child_name -> \".\r\n\r\nI wonder, is there any good reason not to implement `prefixed_label` function as follows?\r\n\r\n```\r\ntemplate <size_t N1, size_t N2>\r\ninline Session_label prefixed_label(String<N1> const &prefix,\r\n                                    String<N2> const &label)\r\n{\r\n  String<N1 + N2 + 4> const prefixed_label(prefix, \" -> \", label);\r\n  return Session_label(prefixed_label);\r\n}\r\n```\r\n\r\n@ehmry Do you have an opinion about that?"},"comment":{"url":"https://api.github.com/repos/genodelabs/genode/issues/comments/258956385","html_url":"https://github.com/genodelabs/genode/issues/2171#issuecomment-258956385","issue_url":"https://api.github.com/repos/genodelabs/genode/issues/2171","id":258956385,"user":{"login":"nfeske","id":1268399,"avatar_url":"https://avatars.githubusercontent.com/u/1268399?v=3","gravatar_id":"","url":"https://api.github.com/users/nfeske","html_url":"https://github.com/nfeske","followers_url":"https://api.github.com/users/nfeske/followers","following_url":"https://api.github.com/users/nfeske/following{/other_user}","gists_url":"https://api.github.com/users/nfeske/gists{/gist_id}","starred_url":"https://api.github.com/users/nfeske/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfeske/subscriptions","organizations_url":"https://api.github.com/users/nfeske/orgs","repos_url":"https://api.github.com/users/nfeske/repos","events_url":"https://api.github.com/users/nfeske/events{/privacy}","received_events_url":"https://api.github.com/users/nfeske/received_events","type":"User","site_admin":false},"created_at":"2016-11-07T20:42:34Z","updated_at":"2016-11-07T20:42:34Z","body":"While experimenting with this idea, I found two things worth noting.\r\n\r\n* First, the LOG session is normally created as a Log_connection by the child. For this reason, all prefixes displayed by core's LOG service now end with a trailing \" -> \", which is not nice. This problem can be fixed by opening the LOG session from the parent's context as an environment session.\r\n\r\n* Second, label-based routing policies do not match if they referred to a unlabeled session. For example, in the demo.run script, the nitpicker policy contained the line `<policy label=\"status_bar\" domain=\"panel\"/>`. The status bar opens a label-less nitpicker session. Now, the policy would need to look like this `<policy label=\"status_bar -> \".../>`, or alternatively, `<policy label_prefix=\"status_bar\"/>`.\r\n\r\nIn my opinion, both effects are quite ok. At the first sight, the second one looks a bit inconvenient but the \" -> \" separator makes it very obvious from where the session request originates, which I like.\r\n\r\nOf course, the drawback is that the run scripts that use exact label matching must be revisited. But I think this is reasonable."}}
{"actor":{"display_login":"nfeske"}}