cargo: Improve error message when there's a colon in the project directory name

Steps to reproduce:

  • cargo new bla
  • mv bla "bla:"
  • cd "bla:"
  • cargo test --verbose

Error:

error: failed to join search paths together: path segment contains separator `:`
Does $LD_LIBRARY_PATH have an unterminated quote character?

Caused by:
  failed to join path array: ["/tmp/bla:/target/debug/deps", "/home/minijackson/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib"]

As LD_LIBRARY_PATH is a Unix thingy, I don’t know if it is reproducible in Windows 😉

Meta:

cargo 0.18.0-nightly (56083a3 2017-02-18)
release: 0.18.0
commit-hash: 56083a3362999695193a8f2252d17b0e4c32145e
commit-date: 2017-02-18

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

This is a massive problem for me while building openSUSE packages, because our project names always include a colon. See building of python-maturin package:

maturin-0.11.2@kusansky$ env|grep LIB
PERL5LIB=/home/matej/.local/share/perl5
LIBVIRT_DEFAULT_URI=qemu:///system
RUBYLIB=/home/matej/.gem/local
maturin-0.11.2@kusansky$ pwd
/home/matej/build/devel:languages:python/python-maturin/maturin-0.11.2
maturin-0.11.2@kusansky$ cargo build
error: failed to join search paths together
Does $LD_LIBRARY_PATH have an unterminated quote character?

Caused by:
  failed to join path array: ["/home/matej/build/devel:languages:python/python-maturin/maturin-0.11.2/target/debug/deps", "/usr/lib"]

Caused by:
  path segment contains separator `:`
maturin-0.11.2@kusansky$

I don’t think I do anything illegal Unix-wise, but cargo build still hates me.

And yes, technically, I could build Rust packages in specifically non-colon-using directories, but it seems like me working around a broken tool.

Could you share how you solve it these days?

Poorly. cp -r maturin-0.13.5 /tmp/ covers multitude of sins, but mostly our internal build command uses different (chrooted) filesystem where there are no colons in path.