{"action":"created","issue":{"url":"https://api.github.com/repos/DataDog/datadog-agent/issues/2079","repository_url":"https://api.github.com/repos/DataDog/datadog-agent","labels_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/2079/labels{/name}","comments_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/2079/comments","events_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/2079/events","html_url":"https://github.com/DataDog/datadog-agent/pull/2079","id":345536875,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NjQ1OTMw","number":2079,"title":"Go's syscall package FreeBSD is missing S_IRWXG and S_IRWXO","user":{"login":"janl","id":11321,"node_id":"MDQ6VXNlcjExMzIx","avatar_url":"https://avatars1.githubusercontent.com/u/11321?v=4","gravatar_id":"","url":"https://api.github.com/users/janl","html_url":"https://github.com/janl","followers_url":"https://api.github.com/users/janl/followers","following_url":"https://api.github.com/users/janl/following{/other_user}","gists_url":"https://api.github.com/users/janl/gists{/gist_id}","starred_url":"https://api.github.com/users/janl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janl/subscriptions","organizations_url":"https://api.github.com/users/janl/orgs","repos_url":"https://api.github.com/users/janl/repos","events_url":"https://api.github.com/users/janl/events{/privacy}","received_events_url":"https://api.github.com/users/janl/received_events","type":"User","site_admin":false},"labels":[{"id":695415843,"node_id":"MDU6TGFiZWw2OTU0MTU4NDM=","url":"https://api.github.com/repos/DataDog/datadog-agent/labels/team/agent-core","name":"team/agent-core","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-29T14:52:57Z","updated_at":"2018-08-15T09:14:08Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/DataDog/datadog-agent/pulls/2079","html_url":"https://github.com/DataDog/datadog-agent/pull/2079","diff_url":"https://github.com/DataDog/datadog-agent/pull/2079.diff","patch_url":"https://github.com/DataDog/datadog-agent/pull/2079.patch"},"body":"This patch adds a _freebsd.go file that builds instead of the regular\r\none *only* on Freebsd (to the best of my cross-platform Go abilities).\r\n\r\nIt imports the C constants S_IRWXG and S_IRWXO and uses them instead\r\nof syscall.S_IRWXG and syscall.S_IRWXO.\r\n\r\nCloses #2078\r\n\r\nThe relevant diff is:\r\n\r\n```diff\r\n--- pkg/secrets/check_right.go\t2018-07-29 16:56:36.000000000 +0200\r\n+++ pkg/secrets/check_right_freebsd.go\t2018-07-29 16:56:36.000000000 +0200\r\n@@ -3,10 +3,17 @@\r\n // This product includes software developed at Datadog (https://www.datadoghq.com/).\r\n // Copyright 2018 Datadog, Inc.\r\n \r\n-// +build !windows,!freebsd\r\n+// +build freebsd\r\n \r\n package secrets\r\n \r\n+// temporary fix until go gets S_IRWXG and S_IRWXO\r\n+\r\n+/*\r\n+#include <sys/stat.h>\r\n+*/\r\n+import \"C\"\r\n+\r\n import (\r\n \t\"fmt\"\r\n \t\"os/user\"\r\n@@ -20,7 +27,7 @@\r\n \t}\r\n \r\n \t// checking that group and others don't have any rights\r\n-\tif stat.Mode&(syscall.S_IRWXG|syscall.S_IRWXO) != 0 {\r\n+\tif stat.Mode&(C.S_IRWXG|C.S_IRWXO) != 0 {\r\n \t\treturn fmt.Errorf(\"invalid executable '%s', 'groups' or 'others' have rights on it\", path)\r\n \t}\r\n ```"},"comment":{"url":"https://api.github.com/repos/DataDog/datadog-agent/issues/comments/413140579","html_url":"https://github.com/DataDog/datadog-agent/pull/2079#issuecomment-413140579","issue_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/2079","id":413140579,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzE0MDU3OQ==","user":{"login":"janl","id":11321,"node_id":"MDQ6VXNlcjExMzIx","avatar_url":"https://avatars1.githubusercontent.com/u/11321?v=4","gravatar_id":"","url":"https://api.github.com/users/janl","html_url":"https://github.com/janl","followers_url":"https://api.github.com/users/janl/followers","following_url":"https://api.github.com/users/janl/following{/other_user}","gists_url":"https://api.github.com/users/janl/gists{/gist_id}","starred_url":"https://api.github.com/users/janl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janl/subscriptions","organizations_url":"https://api.github.com/users/janl/orgs","repos_url":"https://api.github.com/users/janl/repos","events_url":"https://api.github.com/users/janl/events{/privacy}","received_events_url":"https://api.github.com/users/janl/received_events","type":"User","site_admin":false},"created_at":"2018-08-15T09:14:08Z","updated_at":"2018-08-15T09:14:08Z","author_association":"NONE","body":"@olivielpeau thanks for the detailed and thoughtful reply. I didn’t realise `secrets` was something non-essential to be enabled at build time. That’s definitely good enough for me for now.\r\n\r\nThat said, an alternative patch could be a bit more “risky”. These constants are ancient Unix 25+year old constants and likely to have the same bitmask values everywhere. Given that this patch introduces a FreeBSD-only compilation path, you could be open to accept using the raw bitmask values in the two places needed. The FreeBSD-only complication path could be removed once you require a go version that this is fixed in.\r\n\r\nIf you’re interested, I can amend the patch. "}}
{"actor":{"display_login":"janl"}}