Skip to content
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

cargo ws publish segfaults on Nix #86

Open
Stonks3141 opened this issue Feb 11, 2023 · 7 comments
Open

cargo ws publish segfaults on Nix #86

Stonks3141 opened this issue Feb 11, 2023 · 7 comments

Comments

@Stonks3141
Copy link

Stonks3141 commented Feb 11, 2023

To reproduce

install Nix and run these commands:

cargo new foo
cd foo
cat <<EOF > shell.nix
{ pkgs ? import <nixpkgs> {} }: pkgs.mkShell {
  packages = with pkgs; [
    cargo
    rustc
    cargo-workspaces
  ];
}
EOF
nix-shell --run 'cargo ws publish --from-git'
@pksunkara
Copy link
Owner

  1. I don't use Nix.
  2. Can you please paste the error message here?
  3. Segfault is not something that can happen inside the lib. Are you sure this is not caused by rust itself?

@Stonks3141
Copy link
Author

Stonks3141 commented Feb 12, 2023

  1. I do, and I want to use your project. Here is a link to an online code environment that reproduces the bug. Below are instructions to set up a Docker image that reproduces the bug. Both of these took me less than ten minutes to figure out.
  2. Segmentation fault (core dumped)
  3. Everything else works except for the publish subcommand with the --from-git flag. Even if your application isn't responsible, it's still a bug that's manifesting in it and causing problems for a user.

I found your response dismissive and unhelpful. I reported a clear bug in good faith with repro instructions, and you immediately closed the issue without any further investigation of the problem. I was and still am perfectly willing to provide whatever additional information you might need or work on a fix myself.

Docker instructions
  1. Start the NixOS image: sudo docker run -it nixos/nix
  2. Run nix-shell -p cargo to install cargo
  3. Run the original repro instructions.

@pksunkara pksunkara reopened this Feb 12, 2023
@pksunkara
Copy link
Owner

I am still unable to reproduce it. I spun up the docker as you said and created the foo crate and added the shell.nix file.

bash-5.1# nix-shell -p 'cargo ws publish --from-git'
error: undefined variable 'publish'

       at «string»:1:116:

            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (cargo ws publish --from-git) ]; } ""
             |                                                                                                                    ^
(use '--show-trace' to show detailed location information)

FWIW, doing cargo install cargo-workspaces inside nix-shell is failing too for me.

@pksunkara
Copy link
Owner

As an alternative, try git init in the repo first. Maybe that is what causing this.

@Stonks3141
Copy link
Author

cargo new initializes a Git repository, that shouldn't be a problem.

@Stonks3141
Copy link
Author

I'm not sure why you can't reproduce it with Docker. Running these commands reproduces it consistently for me:

sudo docker run -it nixos/nix
nix-shell -p cargo rustc cargo-workspaces
cargo new foo
cd foo
cargo ws publish --from-git

Have you tried the Replit?

@pksunkara
Copy link
Owner

I don't know what repl.it does and it would be hard to debug in there.

Can confirm that I was able to reproduce it. Though I did get some weird errors sometimes.

[nix-shell:/foo]# cargo ws publish --from-git
error: crates index error: reference 'refs/heads/master' not found; class=Reference (4); code=NotFound (-3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants