{"action":"closed","issue":{"url":"https://api.github.com/repos/android-ndk/ndk/issues/240","repository_url":"https://api.github.com/repos/android-ndk/ndk","labels_url":"https://api.github.com/repos/android-ndk/ndk/issues/240/labels{/name}","comments_url":"https://api.github.com/repos/android-ndk/ndk/issues/240/comments","events_url":"https://api.github.com/repos/android-ndk/ndk/issues/240/events","html_url":"https://github.com/android-ndk/ndk/issues/240","id":190725000,"number":240,"title":"ndk-gdb failing to copy gdbserver to app dir","user":{"login":"gpoulios","id":14057280,"avatar_url":"https://avatars.githubusercontent.com/u/14057280?v=3","gravatar_id":"","url":"https://api.github.com/users/gpoulios","html_url":"https://github.com/gpoulios","followers_url":"https://api.github.com/users/gpoulios/followers","following_url":"https://api.github.com/users/gpoulios/following{/other_user}","gists_url":"https://api.github.com/users/gpoulios/gists{/gist_id}","starred_url":"https://api.github.com/users/gpoulios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gpoulios/subscriptions","organizations_url":"https://api.github.com/users/gpoulios/orgs","repos_url":"https://api.github.com/users/gpoulios/repos","events_url":"https://api.github.com/users/gpoulios/events{/privacy}","received_events_url":"https://api.github.com/users/gpoulios/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-21T14:02:14Z","updated_at":"2016-11-21T14:11:12Z","closed_at":"2016-11-21T14:11:12Z","body":"ndk-gdb.py fails to copy gdbserver to application's data dir with \r\n`ERROR: Failed to copy gdbserver to [...]`\r\non applications with min. SDK version >= 23 due to permission denied (probably due to bad command piping).\r\n  \r\nThe following worked for me (not sure if there is a particular reason for not using 'cp' in the first place):\r\n\r\n```diff\r\ndiff --git a/ndk-gdb.py b/ndk-gdb.py\r\nindex 1ae478d..1b90176 100755\r\n--- a/ndk-gdb.py\r\n+++ b/ndk-gdb.py\r\n@@ -420,8 +420,8 @@ def get_gdbserver_path(args, package_name, app_data_dir, arch):\r\n     if get_api_level(args.props) >= 23:\r\n         destination = \"{}/{}-gdbserver\".format(app_data_dir, arch)\r\n         log(\"Copying gdbserver to {}.\".format(destination))\r\n-        cmd = [\"cat\", remote_path, \"|\", \"run-as\", package_name,\r\n-               \"sh\", \"-c\", \"'cat > {}'\".format(destination)]\r\n+        cmd = [\"run-as\", package_name, \r\n+               \"sh\", \"-c\", \"\\\"cp {0} {1}\\\"\".format(remote_path, destination)]\r\n         (rc, _, _) = args.device.shell_nocheck(cmd)\r\n         if rc != 0:\r\n             error(\"Failed to copy gdbserver to {}.\".format(destination))\r\n```"}}
{"actor":{"display_login":"gpoulios"}}