{"action":"created","issue":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/6530","repository_url":"https://api.github.com/repos/bazelbuild/bazel","labels_url":"https://api.github.com/repos/bazelbuild/bazel/issues/6530/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/bazel/issues/6530/comments","events_url":"https://api.github.com/repos/bazelbuild/bazel/issues/6530/events","html_url":"https://github.com/bazelbuild/bazel/issues/6530","id":374480022,"node_id":"MDU6SXNzdWUzNzQ0ODAwMjI=","number":6530,"title":"ctx.actions.declare_directory() - all contents marked with executable permissions","user":{"login":"jmcmullan","id":29979188,"node_id":"MDQ6VXNlcjI5OTc5MTg4","avatar_url":"https://avatars2.githubusercontent.com/u/29979188?v=4","gravatar_id":"","url":"https://api.github.com/users/jmcmullan","html_url":"https://github.com/jmcmullan","followers_url":"https://api.github.com/users/jmcmullan/followers","following_url":"https://api.github.com/users/jmcmullan/following{/other_user}","gists_url":"https://api.github.com/users/jmcmullan/gists{/gist_id}","starred_url":"https://api.github.com/users/jmcmullan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmcmullan/subscriptions","organizations_url":"https://api.github.com/users/jmcmullan/orgs","repos_url":"https://api.github.com/users/jmcmullan/repos","events_url":"https://api.github.com/users/jmcmullan/events{/privacy}","received_events_url":"https://api.github.com/users/jmcmullan/received_events","type":"User","site_admin":false},"labels":[{"id":1020661294,"node_id":"MDU6TGFiZWwxMDIwNjYxMjk0","url":"https://api.github.com/repos/bazelbuild/bazel/labels/team-Execution","name":"team-Execution","color":"f1f442","default":false},{"id":106503261,"node_id":"MDU6TGFiZWwxMDY1MDMyNjE=","url":"https://api.github.com/repos/bazelbuild/bazel/labels/type:%20feature%20request","name":"type: feature request","color":"0052cc","default":false},{"id":1020665933,"node_id":"MDU6TGFiZWwxMDIwNjY1OTMz","url":"https://api.github.com/repos/bazelbuild/bazel/labels/untriaged","name":"untriaged","color":"c34ddd","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-10-26T17:36:07Z","updated_at":"2018-11-05T21:15:58Z","closed_at":null,"author_association":"NONE","body":"### Description of the problem / feature request:\r\n\r\nWhen using `ctx.actions.declare_directory()`, any directory contents resulting from a `ctx.actions.run(.., output = [ directory ], ...)` end up with executable permissions set, regardless of the permissions set by the action.\r\n\r\n### Feature requests: what underlying problem are you trying to solve with this feature?\r\n\r\nI'd like the output directory to have the permissions as set by the action.\r\n\r\n### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.\r\n\r\nBUILD\r\n```\r\nload(\"//:create_directory.bzl\", \"create_directory\")\r\n\r\n\r\ncreate_directory(\r\n    name = \"output\",\r\n    srcs = [ \"subdir/a\", \"subdir/b\", \"c\"]\r\n)\r\n```\r\n\r\ncreate_directory.bzl\r\n```\r\ndef _impl_create_directory(ctx):\r\n    output = ctx.actions.declare_directory(ctx.label.name)\r\n\r\n    script = ctx.actions.declare_file(ctx.label.name + \".sh\")\r\n\r\n    cmds = [\"mkdir -p {dirname}; cp -L {src} {dest}\".format(dirname = output.path + \"/\" + f.dirname, src = f.path, dest = output.path + \"/\" + f.short_path) for f in ctx.files.srcs]\r\n    print(\"\\n\".join(cmds))\r\n    ctx.actions.write(output = script, content = \"\\n\".join([\"#!/bin/sh\"] + cmds) + \"\\n\", is_executable = True)\r\n\r\n    ctx.actions.run(\r\n            executable = script,\r\n            inputs = [ script ] + ctx.files.srcs,\r\n            outputs = [ output ]\r\n    )\r\n\r\n    return [\r\n        DefaultInfo(\r\n            files = depset([ output ]),\r\n        )\r\n    ]\r\n\r\ncreate_directory = rule(\r\n    _impl_create_directory,\r\n    attrs = {\r\n        \"srcs\": attr.label_list(allow_files = True),\r\n    },\r\n)\r\n```\r\n\r\n### What operating system are you running Bazel on?\r\n\r\nLinux (Ubuntu 18.04).\r\n\r\n### What's the output of `bazel info release`?\r\n\r\n`release 0.18.0`\r\n\r\n###  Have you found anything relevant by searching the web?\r\n\r\nNothing.\r\n\r\n### Any other information, logs, or outputs that you want to share?\r\n\r\n[bazel-dirbug.tar.gz](https://github.com/bazelbuild/bazel/files/2520209/bazel-dirbug.tar.gz)\r\n"},"comment":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/comments/436037762","html_url":"https://github.com/bazelbuild/bazel/issues/6530#issuecomment-436037762","issue_url":"https://api.github.com/repos/bazelbuild/bazel/issues/6530","id":436037762,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjAzNzc2Mg==","user":{"login":"benjaminp","id":219470,"node_id":"MDQ6VXNlcjIxOTQ3MA==","avatar_url":"https://avatars1.githubusercontent.com/u/219470?v=4","gravatar_id":"","url":"https://api.github.com/users/benjaminp","html_url":"https://github.com/benjaminp","followers_url":"https://api.github.com/users/benjaminp/followers","following_url":"https://api.github.com/users/benjaminp/following{/other_user}","gists_url":"https://api.github.com/users/benjaminp/gists{/gist_id}","starred_url":"https://api.github.com/users/benjaminp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjaminp/subscriptions","organizations_url":"https://api.github.com/users/benjaminp/orgs","repos_url":"https://api.github.com/users/benjaminp/repos","events_url":"https://api.github.com/users/benjaminp/events{/privacy}","received_events_url":"https://api.github.com/users/benjaminp/received_events","type":"User","site_admin":false},"created_at":"2018-11-05T21:15:58Z","updated_at":"2018-11-05T21:15:58Z","author_association":"CONTRIBUTOR","body":"Note `declare_directory` isn't a solution to large symlink farms; when `--incompatible_symlinked_sandbox_expands_tree_artifacts_in_runfiles_tree` becomes the default, runfiles will have a symlink for every directory artifact entry. At any rate, Bazel eating all your inodes is different issue from all output artifacts being executable."}}
{"actor":{"display_login":"benjaminp"}}