{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/cargo/issues/6240","repository_url":"https://api.github.com/repos/rust-lang/cargo","labels_url":"https://api.github.com/repos/rust-lang/cargo/issues/6240/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/cargo/issues/6240/comments","events_url":"https://api.github.com/repos/rust-lang/cargo/issues/6240/events","html_url":"https://github.com/rust-lang/cargo/issues/6240","id":375371105,"node_id":"MDU6SXNzdWUzNzUzNzExMDU=","number":6240,"title":"\"failed to create temporary file\" when building a dependency from Git","user":{"login":"monorkin","id":1655218,"node_id":"MDQ6VXNlcjE2NTUyMTg=","avatar_url":"https://avatars2.githubusercontent.com/u/1655218?v=4","gravatar_id":"","url":"https://api.github.com/users/monorkin","html_url":"https://github.com/monorkin","followers_url":"https://api.github.com/users/monorkin/followers","following_url":"https://api.github.com/users/monorkin/following{/other_user}","gists_url":"https://api.github.com/users/monorkin/gists{/gist_id}","starred_url":"https://api.github.com/users/monorkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monorkin/subscriptions","organizations_url":"https://api.github.com/users/monorkin/orgs","repos_url":"https://api.github.com/users/monorkin/repos","events_url":"https://api.github.com/users/monorkin/events{/privacy}","received_events_url":"https://api.github.com/users/monorkin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-10-30T08:26:40Z","updated_at":"2018-10-31T19:41:13Z","closed_at":null,"author_association":"NONE","body":"**Problem**\r\nWhen trying to install a dependency from git I get the following error no matter which project I try to build if it has a git dependency.\r\n\r\n```\r\n$ cargo build\r\n    Updating git repository `https://github.com/zacps/winpty`\r\nwarning: spurious network error (2 tries remaining): failed to create temporary file '/pack_git2_es7hEy': Permission denied; class=Os (2)\r\nwarning: spurious network error (1 tries remaining): failed to create temporary file '/pack_git2_rhZ8dQ': Permission denied; class=Os (2)\r\nerror: failed to load source for a dependency on `winpty-sys`\r\n\r\nCaused by:\r\n  Unable to update https://github.com/zacps/winpty?branch=rust#9ccec645\r\n\r\nCaused by:\r\n  failed to fetch into /Users/stanko/.cargo/git/db/winpty-788a6abf0b1935fd\r\n\r\nCaused by:\r\n  failed to create temporary file '/pack_git2_oFAHxn': Permission denied; class=Os (2)\r\n```\r\n\r\n**Steps**\r\n1. Create a new project `cargo new --bin foobar`\r\n2. Move into the project `cd foobar`\r\n3. Add any git dependency to it e.g.  `echo \"diesel = { git = \\\"https://github.com/diesel-rs/diesel\\\" }\" >> Cargo.toml`\r\n4. Run `cargo build`\r\n\r\n**Possible Solution(s)**\r\n\r\nBy trying to run `cargo` as root it seems like `cargo` tries to build git dependencies inside the root directory, which is also indicated by the error as the temporary file is `/pack_git2_oFAHxn`. I'm unsure as to why this is happening.\r\n\r\n**Notes**\r\n\r\nI tried to reinstall Rust but it didn't resolve the issue.\r\nI'm able to clone git repositories and use git.\r\nI do have a `templatedir` set in my gitconfig (this was indicated to be the problem in a similar issue) but removing it from git, or removing it completely, or removing it from gitconfig didn't solve this issue.\r\nI noticed this issue after updating from Rust 1.27 to 1.29, and now on 1.30.\r\n\r\nOutput of `cargo version`: `cargo 1.30.0 (36d96825d 2018-10-24)`\r\nOutput of `rustc --version`: `rustc 1.30.0 (da5f414c2 2018-10-24)`\r\nOutput of `rustup toolchain list`: `stable-x86_64-apple-darwin (default)`\r\nOutput of `git --version`: `git version 2.17.1 (Apple Git-112)`\r\nOS: macOS Version 10.13.6 High Sierra\r\n\r\nContents of `~/.cargo`:\r\n```\r\ntotal 8\r\ndrwxr-xr-x    6 stanko  staff   192B Oct 30 08:57 .\r\ndrwxr-xr-x+ 112 stanko  staff   3.5K Oct 30 09:15 ..\r\ndrwxr-xr-x   12 stanko  staff   384B Oct 30 08:56 bin\r\n-rw-r--r--    1 stanko  staff    37B Oct 30 08:56 env\r\ndrwxr-xr-x    4 stanko  staff   128B Oct 30 08:57 git\r\ndrwxr-xr-x    3 stanko  staff    96B Oct 30 08:57 registry\r\n```\r\n\r\nOutput of `printenv`:\r\n\r\n```\r\nApple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.retracted/Render\r\nBROWSER=/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox\r\nEDITOR=nvim\r\nELIXIR_VERSION=1.6.4\r\nERL_AFLAGS=-kernel shell_history enabled\r\nFZF_DEFAULT_COMMAND=rg --files --no-ignore --hidden --follow --glob \"!.git/*\"\r\nGPG_TTY=/dev/ttys004\r\nHOME=/Users/stanko\r\nHOMEBREW_GITHUB_API_TOKEN=retracted\r\nLANG=en_US.UTF-8\r\nLC_CTYPE=en_US.UTF-8\r\nLESS=-R\r\nLOGNAME=stanko\r\nLSCOLORS=Gxfxcxdxbxegedabagacad\r\nMANPATH=/Users/stanko/.kerl/installs/20.3/lib/erlang/man:/Users/stanko/.kerl/installs/20.3/man:/usr/share/man:/usr/local/share/man:/usr/local/MacGPG2/share/man:/Users/stanko/.kerl/installs/20.3/lib/erlang/man:/Users/stanko/.kerl/installs/20.3/man\r\nMIX_ARCHIVES=/Users/stanko/.kiex/mix/archives/elixir-1.6.4\r\nOLDPWD=/Users/stanko\r\nPAGER=less\r\nPATH=/Users/stanko/.cargo/bin:/Users/stanko/.kiex/elixirs/elixir-1.6.4/bin:/Users/stanko/.kerl/installs/20.3/bin:/Users/stanko/.kiex/elixirs/elixir-1.6.4/bin:/Users/stanko/.kiex/bin:/Users/stanko/.rbenv/shims:/Users/stanko/.rbenv/bin:/Users/stanko/.rbenv/shims:/Users/stanko/.rbenv/bin:/Users/stanko/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Users/stanko/.config/gcloud/google-cloud-sdk/bin:/Users/stanko/.cargo/bin:/Users/stanko/.kiex/elixirs/elixir-1.6.4/bin:/Users/stanko/.kiex/bin:/Users/stanko/.rbenv/shims:/Users/stanko/.rbenv/bin:/Users/stanko/.local/bin:/usr/local/opt/fzf/bin:/Users/stanko/.local/bin\r\nPWD=/Users/stanko/Projects/Rust/public/alacritty\r\nRBENV_ROOT=/Users/stanko/.rbenv\r\nRBENV_SHELL=zsh\r\nREBAR_PLT_DIR=/Users/stanko/.kerl/installs/20.3\r\nSHELL=/usr/local/bin/zsh\r\nSHLVL=2\r\nSSH_AUTH_SOCK=/private/tmp/com.apple.launchd.HD9kfD1YnW/Listeners\r\nTERM=screen-256color\r\nTMPDIR=/var/folders/gk/vy9n6twd4pn613ffydfddw_r0000gn/T/\r\nTMUX=/private/tmp/tmux-501/default,699,0\r\nTMUX_PANE=%2\r\nTMUX_PLUGIN_MANAGER_PATH=/Users/stanko/.tmux/plugins/\r\nUSER=stanko\r\nUSE_EDITOR=nvim\r\nVISUAL=nvim\r\nXPC_FLAGS=0x0\r\nXPC_SERVICE_NAME=0\r\nZSH=/Users/stanko/.oh-my-zsh\r\n_KERL_SAVED_REBAR_PLT_DIR=/Users/stanko/.kerl/installs/20.3\r\n__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0\r\nis_vim=echo \"#{pane_current_command}\" | grep -iqE \"(^|\\/)g?(view|n?vim?)(diff)?$\"\r\n_KERL_PATH_REMOVABLE=/Users/stanko/.kerl/installs/20.3/bin\r\n_KERL_MANPATH_REMOVABLE=/Users/stanko/.kerl/installs/20.3/lib/erlang/man:/Users/stanko/.kerl/installs/20.3/man\r\n_KERL_ACTIVE_DIR=/Users/stanko/.kerl/installs/20.3\r\n_KERL_SAVED_ERL_AFLAGS=\r\n_=/usr/bin/printenv\r\n```"},"comment":{"url":"https://api.github.com/repos/rust-lang/cargo/issues/comments/434821399","html_url":"https://github.com/rust-lang/cargo/issues/6240#issuecomment-434821399","issue_url":"https://api.github.com/repos/rust-lang/cargo/issues/6240","id":434821399,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDgyMTM5OQ==","user":{"login":"monorkin","id":1655218,"node_id":"MDQ6VXNlcjE2NTUyMTg=","avatar_url":"https://avatars2.githubusercontent.com/u/1655218?v=4","gravatar_id":"","url":"https://api.github.com/users/monorkin","html_url":"https://github.com/monorkin","followers_url":"https://api.github.com/users/monorkin/followers","following_url":"https://api.github.com/users/monorkin/following{/other_user}","gists_url":"https://api.github.com/users/monorkin/gists{/gist_id}","starred_url":"https://api.github.com/users/monorkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monorkin/subscriptions","organizations_url":"https://api.github.com/users/monorkin/orgs","repos_url":"https://api.github.com/users/monorkin/repos","events_url":"https://api.github.com/users/monorkin/events{/privacy}","received_events_url":"https://api.github.com/users/monorkin/received_events","type":"User","site_admin":false},"created_at":"2018-10-31T19:41:13Z","updated_at":"2018-10-31T19:41:13Z","author_association":"NONE","body":"It's a mix of my templates directory (which has it's own reposiotry) and the bare git repository.\r\nI just removed the templates dir from my gitconfig, reloaded my shell and now everything worked. I must have forgotten to reload my shell when I initially tested this.\r\n\r\nSeems like this is a duplicate of another issue where this was the problem also.\r\n\r\nThough, this is a regression then. I have used this configuration for well over a year with no issues until now."}}
{"actor":{"display_login":"monorkin"}}