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 install of exa fails for Rust 1.8.0 #108

Closed
kecors opened this issue Apr 15, 2016 · 2 comments
Closed

Cargo install of exa fails for Rust 1.8.0 #108

kecors opened this issue Apr 15, 2016 · 2 comments
Assignees

Comments

@kecors
Copy link

kecors commented Apr 15, 2016

On my 64 bit Arch Linux machine I tried to use cargo to install exa, and got the following error:

$ cargo install --git https://github.com/ogham/exa
   Updating git repository `https://github.com/ogham/exa`
   Compiling exa v0.4.0 (https://github.com/ogham/exa#9b87ef1d)
.multirust/toolchains/stable/cargo/git/checkouts/exa-243d74bb3bec7b92/master/src/file.rs:226:29: 226:51 error: mismatched types:
 expected `i64`,
    found `u64` [E0308]
.multirust/toolchains/stable/cargo/git/checkouts/exa-243d74bb3bec7b92/master/src/file.rs:226             f::Blocks::Some(self.metadata.blocks())
                                                                                                                         ^~~~~~~~~~~~~~~~~~~~~~
.multirust/toolchains/stable/cargo/git/checkouts/exa-243d74bb3bec7b92/master/src/file.rs:226:29: 226:51 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to previous error
failed to compile `exa v0.4.0 (https://github.com/ogham/exa#9b87ef1d)`, intermediate artifacts can be found at `/home/kecors/target-install`

Caused by:
  Could not compile `exa`.

To learn more, run the command again with --verbose.

The release notes for 1.8.0 indicate that MetadataExt was changed and no longer returns platform specific types. In particular:

impl MetadataExt for Metadata1.1.0
...
fn blocks(&self) -> u64

Here is the code in exa at the point of the error (in file.rs):

    /// This file's number of filesystem blocks.
    ///
    /// (Not the size of each block, which we don't actually report on)
    pub fn blocks(&self) -> f::Blocks {
        if self.is_file() || self.is_link() {
            f::Blocks::Some(self.metadata.blocks())
        }
        else {
            f::Blocks::None
        }
    }

f::Blocks is defined as follows:

pub mod fields {
    use libc::{blkcnt_t, gid_t, ino_t, nlink_t, time_t, uid_t};
...
    pub enum Blocks {
        Some(blkcnt_t),
        None,
    }

Currently in exa, the Blocks enum is used only for display. It appears that this problem could be resolved by changing the Blocks enum to use u64 rather than blkcnt_t from libc.

@ogham ogham self-assigned this Apr 16, 2016
@ogham
Copy link
Owner

ogham commented Apr 16, 2016

Yep, fails for me too. Thanks for the really detailed report.

@ogham ogham closed this as completed in b65043d Apr 16, 2016
@ogham
Copy link
Owner

ogham commented Apr 16, 2016

I changed the type definitions so they're specific ones now, which should match the ones that get returned from the methods on Metadata. Your notes really helped!

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