Change:
"No such file" would be nicer.
Still happens. Seems like just a bug, so not nominating.
This is still an issue.

Discussion:
let lib = m.move_iter().next().unwrap(); if slot.is_none() { <del> info!("{} reading meatadata from: {}", flavor, lib.display()); </del> <ins> info!("{} reading metadata from: {}", flavor, lib.display()); </ins> match get_metadata_section(self.os, &lib) { <del> Some(blob) => { </del> <ins> Ok(blob) => { </ins> if self.crate_matches(blob.as_slice()) { *slot = Some(blob); } else {

return None; } } <del> None => { </del> <ins> Err(_) => { </ins> info!("no metadata found"); return None }

} // Just a small wrapper to time how long reading metadata takes. <del> fn get_metadata_section(os: Os, filename: &Path) -> Option<MetadataBlob> { </del> <ins> fn get_metadata_section(os: Os, filename: &Path) -> Result<MetadataBlob, ~str> { </ins> let start = time::precise_time_ns(); let ret = get_metadata_section_imp(os, filename); info!("reading {} => {}ms", filename.filename_display(),

return ret; } <del> fn get_metadata_section_imp(os: Os, filename: &Path) -> Option<MetadataBlob> { </del> <ins> fn get_metadata_section_imp(os: Os, filename: &Path) -> Result<MetadataBlob, ~str> { if !filename.exists() { return Err(format!("no such file: '{}'", filename.display())); } </ins> if filename.filename_str().unwrap().ends_with(".rlib") { // Use ArchiveRO for speed here, it's backed by LLVM and uses mmap // internally to read the file. We also avoid even using a memcpy by

Some(ar) => ar, None => { debug!("llvm didn't like `{}`", filename.display()); <del> return None; </del> <ins> return Err(format!("failed to read rlib metadata: '{}'", filename.display())); </ins> } }; <del> return ArchiveMetadata::new(archive).map(|ar| MetadataArchive(ar)); </del> <ins> return match ArchiveMetadata::new(archive).map(|ar| MetadataArchive(ar)) { None => return Err(format!("failed to read rlib metadata: '{}'", filename.display())), Some(blob) => return Ok(blob) } </ins> } unsafe { let mb = filename.with_c_str(|buf| { llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf) }); <del> if mb as int == 0 { return None } </del> <ins> if mb as int == 0 { return Err(format!("error reading library: '{}'",filename.display())) } </ins> let of = match ObjectFile::new(mb) { Some(of) => of, <del> _ => return None </del> <ins> _ => return Err(format!("provided path not an object file: '{}'", filename.display())) </ins> }; let si = mk_section_iter(of.llof); while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False {

if read_meta_section_name(os) == name { let cbuf = llvm::LLVMGetSectionContents(si.llsi); let csz = llvm::LLVMGetSectionSize(si.llsi) as uint; <del> let mut found = None; </del> <ins> let mut found = Err(format!("metadata not found: '{}'", filename.display())); </ins> let cvbuf: *u8 = cast::transmute(cbuf); let vlen = encoder::metadata_encoding_version.len(); debug!("checking {} bytes of metadata-version stamp",

let minsz = cmp::min(vlen, csz); let version_ok = vec::raw::buf_as_slice(cvbuf, minsz, |buf0| buf0 == encoder::metadata_encoding_version); <del> if !version_ok { return None; } </del> <ins> if !version_ok { return Err(format!("incompatible metadata version found: '{}'", filename.display()));} </ins> let cvbuf1 = cvbuf.offset(vlen as int); debug!("inflating {} bytes of compressed metadata", csz - vlen); vec::raw::buf_as_slice(cvbuf1, csz-vlen, |bytes| { let inflated = flate::inflate_bytes(bytes); <del> found = Some(MetadataVec(inflated)); </del> <ins> found = Ok(MetadataVec(inflated)); </ins> }); <del> if found.is_some() { </del> <ins> if found.is_ok() { </ins> return found; } } llvm::LLVMMoveToNextSection(si.llsi); } <del> return None; </del> <ins> return Err(format!("metadata not found: '{}'", filename.display())); </ins> } }

pub fn list_file_metadata(os: Os, path: &Path, out: &mut io::Writer) -> io::IoResult<()> { match get_metadata_section(os, path) { <del> Some(bytes) => decoder::list_crate_metadata(bytes.as_slice(), out), None => { write!(out, "could not find metadata in {}.n", path.display()) </del> <ins> Ok(bytes) => decoder::list_crate_metadata(bytes.as_slice(), out), Err(msg) => { write!(out, "{}n", msg) </ins> } } }