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

Broken dependency resolution on non-Linux unixes #40

Closed
mqudsi opened this issue Dec 22, 2021 · 6 comments · Fixed by #41
Closed

Broken dependency resolution on non-Linux unixes #40

mqudsi opened this issue Dec 22, 2021 · 6 comments · Fixed by #41

Comments

@mqudsi
Copy link

mqudsi commented Dec 22, 2021

In Cargo.toml, chrono is declared as a dependency only under Linux:

trash-rs/Cargo.toml

Lines 36 to 37 in 3c566ef

[target.'cfg(target_os = "linux")'.dependencies]
chrono = "0.4.9"

But it is used in the Freedesktop backend without a Linux-only precondition:

use chrono::{NaiveDateTime, TimeZone};

And the Freedesktop backend is used for any non-macOS unix target:

trash-rs/src/lib.rs

Lines 33 to 35 in 3c566ef

#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
#[path = "freedesktop.rs"]
mod platform;

This causes the build to fail when compiled on a non-Linux unix-ish platform like FreeBSD.

The conditional dependency logic in Cargo.toml needs to match your actual use.

@ArturKovacs
Copy link
Collaborator

ArturKovacs commented Dec 22, 2021

Feel free to ping me in January if I don't get back until then, because I would be willing to fix this, but not in the coming days.

Byron added a commit that referenced this issue Dec 23, 2021
@Byron
Copy link
Owner

Byron commented Dec 23, 2021

Thanks very much for reporting, and thanks @ArturKovacs for offering help, it's all very much appreciated.

To get a little more acquainted with the code-base I took a stab at it myself and released a fix.

Now the directives match so I'd hope this also fixes the related issue in dua-cli.

@ArturKovacs
Copy link
Collaborator

Thank you for taking good care of this repo @Byron ❤️

@mqudsi
Copy link
Author

mqudsi commented Dec 25, 2021

Thanks for the quick fix and I'm glad I could help. I was originally inclined to reported this as a dua bug because I use trash-rs in my own crates (thanks @ArturKovacs!) and haven't had issues compiling on FreeBSD but I just checked and it's because I opted into using trash 1.3 because of the guidance that was in the README at the time (details of which I cannot precisely recall at the moment).

Sorry to report that build still fails on non-Linux because of a different issue (unsafe use of Linux-only getmntent). There's an alternative way available on the BSDs (and macOS) but it means the code in freedesktop.org will no longer be free of conditional compilation.

@Byron
Copy link
Owner

Byron commented Dec 26, 2021

Step by step. If you could post the details here maybe a fix can be created from that.

It might also be useful to try and run CI on FreeBSD, which doesn't seem to be straightforward yet.

So I guess we have to go step by step here, maybe it's easiest if @mqudsi would submit a PR that is proven to work.

@wezm
Copy link
Contributor

wezm commented Jan 21, 2022

Sorry to report that build still fails on non-Linux because of a different issue (unsafe use of Linux-only getmntent).

Just ran into this issue on FreeBSD too.

It might also be useful to try and run CI on FreeBSD, which doesn't seem to be straightforward yet.

The easiest way to do CI for FreeBSD is with Cirrus CI. It's free for open source

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

Successfully merging a pull request may close this issue.

4 participants