-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"failed to create temporary file" when building a dependency from Git #6240
Comments
Do you perhaps haver any suspicious global git configuration? This looks like an error coming from libgit2 oddly enough! |
None that I am aware of. I know this is a stupid statement, but the same config worked with cargo just a few weeks back. This is the contents of my
|
Hm ok, good to know though! I haven't been able to reproduce this locally, but would you be willing to test this out locally and help poke around? The best way to debug this is probably going to be building a debug build of Cargo (building Cargo locally), and then using that Cargo binary to build your project. You can then execute Cargo in a debugger and place a breakpoint on where this error is being generated from somewhere around here. Once you see an error happening there I'd be curious about the stack trace leading there as well as some of the surrounding variables for why git2 is deducing it should place a temporary file in the root of the filesystem |
I've set a breakpoint at State of the variables:
Value of
Here is the backtrace:
I'll poke around a bit more to find something conclusive. |
I think I'm missing something. The error originates from That function sets the The input The This is where the trail ends for me. I'm unsure how casting |
Oh this is just a "trick" of how inheritane is done in C sometimes. The I think the |
Magic ✨ Just a question, how does I'll check the |
Ok. That function gets called 3 times. Then twice with I called the two functions manually and got:
So I guess the I checked on my filesystem and |
Hm ok, I wonder if this is a corrupt git repository then perhaps? If you blow away |
I tried that when I reinstalled Rust, as I saw that that was the solution to a similar issue, but it didn't help. I tried it again now by running |
Oh wait so actually another thing that's odd is that the paths libgit2 is probing all have If you look inside of |
It's a mix of my templates directory (which has it's own reposiotry) and the bare git repository. Seems like this is a duplicate of another issue where this was the problem also. Though, this is a regression then. I have used this configuration for well over a year with no issues until now. |
Ah ok interesting! Is it possible to narrow down what in your templates directory affects this? Is it the mere presence of templates? The fact that templates are a git repo? One template in particular? |
Did a few tests now. |
Hm ok interesting! I tried to reproduce that by Do those steps reproduce for you though? |
I just tried to do the same as you and managed to get it to fail. Seems like it can't be an empty repo, it has to have some objects in it. Steps taken:
|
Ok cool thanks so much for your help in narrowing this down! I've posted a fix for this at #6252 |
Thank you for pushing a fix for this :) |
This commit disables usage of git templates whenever Cargo manages repositories in its internal git database. Templates don't want to be used at all in these situations and have been known to cause usability bugs. Closes rust-lang#6240
Never use templates when managing git repos This commit disables usage of git templates whenever Cargo manages repositories in its internal git database. Templates don't want to be used at all in these situations and have been known to cause usability bugs. Closes #6240
I don't know how closed this is, certainly the "reproduction" is still a fact in my Ubuntu 18.04, with a different choice of words
Caused by: Caused by: Caused by: I stumbled into this by trying to follow these instructions [https://edgewa.re/lockdrop/gettingstarted.html] . The "bug" seems alive and well with both the curl installation method as well as Ubuntu's package. Creating a new user allowed me to compile the packages, so my default account is somehow tainted, perhaps in a way that proves the fix here was incomplete. |
@reppolice It sounds like your issue is different ("NotFound" instead of "Permission denied"). Can you file a new issue, and zip up the contents of |
Problem
When 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.
Steps
cargo new --bin foobar
cd foobar
echo "diesel = { git = \"https://github.com/diesel-rs/diesel\" }" >> Cargo.toml
cargo build
Possible Solution(s)
By trying to run
cargo
as root it seems likecargo
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.Notes
I tried to reinstall Rust but it didn't resolve the issue.
I'm able to clone git repositories and use git.
I 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.I noticed this issue after updating from Rust 1.27 to 1.29, and now on 1.30.
Output of
cargo version
:cargo 1.30.0 (36d96825d 2018-10-24)
Output of
rustc --version
:rustc 1.30.0 (da5f414c2 2018-10-24)
Output of
rustup toolchain list
:stable-x86_64-apple-darwin (default)
Output of
git --version
:git version 2.17.1 (Apple Git-112)
OS: macOS Version 10.13.6 High Sierra
Contents of
~/.cargo
:Output of
printenv
:The text was updated successfully, but these errors were encountered: