denisidoro / navi

An interactive cheatsheet tool for the command-line
Apache License 2.0
14.93k stars 498 forks source link

2.22.1 fails to build due to fs_at crate #830

Closed 0323pin closed 1 year ago

0323pin commented 1 year ago

Describe the bug 2.22.1 fails to build on NetBSD.

Versions:

Additional context Build fails due to fs_at as follows:

   Compiling fs_at v0.1.4
error[E0425]: cannot find value `O_PATH` in crate `libc`
   --> /usr/pkgsrc/wip/navi/work/vendor/fs_at-0.1.4/src/unix.rs:130:55
    |
130 |             libc::O_RDONLY | libc::O_NOFOLLOW | libc::O_PATH | libc::O_CLOEXEC | libc::O_NOCTTY;
    |                                                       ^^^^^^ not found in `libc`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `fs_at` due to previous error
warning: build failed, waiting for other jobs to finish...
*** Error code 101

Stop.
make[1]: stopped in /usr/pkgsrc/wip/navi
*** Error code 1

Stop.
welcome[bot] commented 1 year ago

Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)

denisidoro commented 1 year ago

Could you please try to use the same versions as defined by the repo?

Namely, rust 1.67.0 instead of 1.68.2 with locked dependencies from Cargo.lock?

0323pin commented 1 year ago

@denisidoro

I'm the NetBSD package maintainer and all our package builds are done in offline mode. The crate dependency versions used are the ones specified in Cargo.lock.

I don't see how downgrading Rust would help solving an issue related to a unknown variable.

I understand that this is basically not a navi issue, rather a problem in fs_at but, our package is currently stuck at 2.20.1 which, didn't depend on fs_at.

EDIT: Building fs_at standalone:

fs_at-0.1.4 > cargo build --release --locked
    Updating crates.io index
  Downloaded static_assertions v1.1.0
  Downloaded nix v0.26.2
  Downloaded cfg-if v0.1.10
  Downloaded bitflags v1.3.2
  Downloaded libc v0.2.140
  Downloaded cvt v0.1.1
  Downloaded cfg-if v1.0.0
  Downloaded 7 crates (1010.8 KB) in 1.19s
   Compiling libc v0.2.140
   Compiling bitflags v1.3.2
   Compiling static_assertions v1.1.0
   Compiling cfg-if v0.1.10
   Compiling cfg-if v1.0.0
   Compiling cvt v0.1.1
   Compiling nix v0.26.2
   Compiling fs_at v0.1.4 (/home/pin/Downloads/fs_at-0.1.4)
error[E0425]: cannot find value `O_PATH` in crate `libc`
   --> src/unix.rs:130:55
    |
130 |             libc::O_RDONLY | libc::O_NOFOLLOW | libc::O_PATH | libc::O_CLOEXEC | libc::O_NOCTTY;
    |                                                       ^^^^^^ not found in `libc`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `fs_at` due to previous error
Exception: cargo exited with 101
0323pin commented 1 year ago

@denisidoro This is worst than I thought, although I was afraid this would be the case :(

~ > grep -r "O_PATH" libc-0.2.141
...
libc-0.2.141/src/unix/bsd/freebsdlike/freebsd/mod.rs:pub const O_PATH: ::c_int = 0x00400000;
libc-0.2.141/src/unix/linux_like/android/mod.rs:pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/emscripten/mod.rs:pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/linux/gnu/b32/mod.rs:        pub const O_PATH: ::c_int = 0x1000000;
libc-0.2.141/src/unix/linux_like/linux/gnu/b32/mod.rs:        pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs:pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs:pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs:pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs:pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs:pub const O_PATH: ::c_int = 2097152;
libc-0.2.141/src/unix/linux_like/linux/gnu/b64/s390x.rs:pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs:pub const O_PATH: ::c_int = 0x1000000;
libc-0.2.141/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs:pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/linux/musl/mod.rs:pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/linux/uclibc/arm/mod.rs:pub const O_PATH: ::c_int = 0o10000000;
libc-0.2.141/src/unix/linux_like/linux/uclibc/mips/mod.rs:pub const O_PATH: ::c_int = 0o010000000;

No NetBSD support in libc :(

denisidoro commented 1 year ago

When I find some time, I'll check cargo tree to understand why fs_at is being included.

If it's not being used by the core logic, in theory I could put the logic behind a cargo feature so that we can build a more stripped down version for NetBSD

0323pin commented 1 year ago

Seria óptimo, se for possível. Obrigado!

0323pin commented 1 year ago
navi v2.22.1 (/home/pin/Downloads/navi)
├── anyhow v1.0.70
├── clap v4.2.1
│   ├── clap_builder v4.2.1
│   │   ├── anstream v0.2.6
│   │   │   ├── anstyle v0.3.5
│   │   │   ├── anstyle-parse v0.1.1
│   │   │   │   └── utf8parse v0.2.1
│   │   │   ├── concolor-override v1.0.0
│   │   │   ├── concolor-query v0.3.3
│   │   │   ├── is-terminal v0.4.6
│   │   │   │   ├── io-lifetimes v1.0.9
│   │   │   │   │   └── libc v0.2.140
│   │   │   │   └── rustix v0.37.7
│   │   │   │       ├── bitflags v1.3.2
│   │   │   │       ├── errno v0.3.0
│   │   │   │       │   └── libc v0.2.140
│   │   │   │       ├── io-lifetimes v1.0.9 (*)
│   │   │   │       └── libc v0.2.140
│   │   │   └── utf8parse v0.2.1
│   │   ├── anstyle v0.3.5
│   │   ├── bitflags v1.3.2
│   │   ├── clap_lex v0.4.1
│   │   ├── once_cell v1.17.1
│   │   └── strsim v0.10.0
│   ├── clap_derive v4.2.0 (proc-macro)
│   │   ├── heck v0.4.0
│   │   ├── proc-macro2 v1.0.56
│   │   │   └── unicode-ident v1.0.8
│   │   ├── quote v1.0.26
│   │   │   └── proc-macro2 v1.0.56 (*)
│   │   └── syn v2.0.13
│   │       ├── proc-macro2 v1.0.56 (*)
│   │       ├── quote v1.0.26 (*)
│   │       └── unicode-ident v1.0.8
│   └── once_cell v1.17.1
├── crossterm v0.26.1
│   ├── bitflags v1.3.2
│   ├── libc v0.2.140
│   ├── mio v0.8.3
│   │   ├── libc v0.2.140
│   │   └── log v0.4.14
│   │       └── cfg-if v1.0.0
│   ├── parking_lot v0.12.0
│   │   ├── lock_api v0.4.6
│   │   │   └── scopeguard v1.1.0
│   │   └── parking_lot_core v0.9.1
│   │       ├── cfg-if v1.0.0
│   │       ├── libc v0.2.140
│   │       └── smallvec v1.10.0
│   ├── signal-hook v0.3.13
│   │   ├── libc v0.2.140
│   │   └── signal-hook-registry v1.4.0
│   │       └── libc v0.2.140
│   └── signal-hook-mio v0.2.3
│       ├── libc v0.2.140
│       ├── mio v0.8.3 (*)
│       └── signal-hook v0.3.13 (*)
├── directories-next v2.0.0
│   ├── cfg-if v1.0.0
│   └── dirs-sys-next v0.1.2
│       └── libc v0.2.140
├── dns_common v0.2.1
│   ├── anyhow v1.0.70
│   ├── directories-next v2.0.0 (*)
│   ├── serde v1.0.159
│   │   └── serde_derive v1.0.159 (proc-macro)
│   │       ├── proc-macro2 v1.0.56 (*)
│   │       ├── quote v1.0.26 (*)
│   │       └── syn v2.0.13 (*)
│   ├── serde_json v1.0.95
│   │   ├── itoa v1.0.6
│   │   ├── ryu v1.0.9
│   │   └── serde v1.0.159 (*)
│   ├── serde_yaml v0.9.21
│   │   ├── indexmap v1.9.3
│   │   │   └── hashbrown v0.12.3
│   │   │   [build-dependencies]
│   │   │   └── autocfg v1.0.1
│   │   ├── itoa v1.0.6
│   │   ├── ryu v1.0.9
│   │   ├── serde v1.0.159 (*)
│   │   └── unsafe-libyaml v0.2.8
│   ├── tracing v0.1.37
│   │   ├── cfg-if v1.0.0
│   │   ├── pin-project-lite v0.2.9
│   │   ├── tracing-attributes v0.1.23 (proc-macro)
│   │   │   ├── proc-macro2 v1.0.56 (*)
│   │   │   ├── quote v1.0.26 (*)
│   │   │   └── syn v1.0.109
│   │   │       ├── proc-macro2 v1.0.56 (*)
│   │   │       ├── quote v1.0.26 (*)
│   │   │       └── unicode-ident v1.0.8
│   │   └── tracing-core v0.1.30
│   │       └── once_cell v1.17.1
│   └── tracing-subscriber v0.3.16
│       ├── matchers v0.1.0
│       │   └── regex-automata v0.1.10
│       │       └── regex-syntax v0.6.29
│       ├── nu-ansi-term v0.46.0
│       │   └── overload v0.1.1
│       ├── once_cell v1.17.1
│       ├── regex v1.7.3
│       │   ├── aho-corasick v0.7.18
│       │   │   └── memchr v2.4.0
│       │   ├── memchr v2.4.0
│       │   └── regex-syntax v0.6.29
│       ├── sharded-slab v0.1.4
│       │   └── lazy_static v1.4.0
│       ├── smallvec v1.10.0
│       ├── thread_local v1.1.7
│       │   ├── cfg-if v1.0.0
│       │   └── once_cell v1.17.1
│       ├── tracing v0.1.37 (*)
│       ├── tracing-core v0.1.30 (*)
│       └── tracing-log v0.1.3
│           ├── lazy_static v1.4.0
│           ├── log v0.4.14 (*)
│           └── tracing-core v0.1.30 (*)
├── dns_common_derive v0.2.1 (proc-macro)
│   ├── proc-macro2 v1.0.56 (*)
│   ├── quote v1.0.26 (*)
│   └── synstructure v0.12.6
│       ├── proc-macro2 v1.0.56 (*)
│       ├── quote v1.0.26 (*)
│       ├── syn v1.0.109 (*)
│       └── unicode-xid v0.2.2
├── edit v0.1.4
│   ├── tempfile v3.2.0
│   │   ├── cfg-if v1.0.0
│   │   ├── libc v0.2.140
│   │   ├── rand v0.8.3
│   │   │   ├── libc v0.2.140
│   │   │   ├── rand_chacha v0.3.1
│   │   │   │   ├── ppv-lite86 v0.2.10
│   │   │   │   └── rand_core v0.6.2
│   │   │   │       └── getrandom v0.2.3
│   │   │   │           ├── cfg-if v1.0.0
│   │   │   │           └── libc v0.2.140
│   │   │   └── rand_core v0.6.2 (*)
│   │   └── remove_dir_all v0.5.3
│   └── which v4.1.0
│       ├── either v1.6.1
│       └── libc v0.2.140
├── lazy_static v1.4.0
├── regex v1.7.3 (*)
├── remove_dir_all v0.8.2
│   ├── cfg-if v1.0.0
│   ├── cvt v0.1.2
│   │   └── cfg-if v1.0.0
│   ├── fs_at v0.1.4
│   │   ├── cfg-if v1.0.0
│   │   ├── cvt v0.1.2 (*)
│   │   ├── libc v0.2.140
│   │   └── nix v0.26.2
│   │       ├── bitflags v1.3.2
│   │       ├── cfg-if v1.0.0
│   │       ├── libc v0.2.140
│   │       └── static_assertions v1.1.0
│   ├── lazy_static v1.4.0
│   ├── libc v0.2.140
│   └── normpath v1.1.1
├── serde v1.0.159 (*)
├── serde_yaml v0.9.21 (*)
├── shellwords v1.1.0
│   ├── lazy_static v1.4.0
│   └── regex v1.7.3 (*)
├── strip-ansi-escapes v0.1.1
│   └── vte v0.10.1
│       ├── arrayvec v0.5.2
│       ├── utf8parse v0.2.1
│       └── vte_generate_state_changes v0.1.1 (proc-macro)
│           ├── proc-macro2 v1.0.56 (*)
│           └── quote v1.0.26 (*)
├── thiserror v1.0.40
│   └── thiserror-impl v1.0.40 (proc-macro)
│       ├── proc-macro2 v1.0.56 (*)
│       ├── quote v1.0.26 (*)
│       └── syn v2.0.13 (*)
├── unicode-width v0.1.10
└── walkdir v2.3.3
    └── same-file v1.0.6

Looks like remove_dir_all v0.8.2 is pulling it in.

0323pin commented 1 year ago

@denisidoro Workaround patch submitted, https://github.com/rbtcollins/fs_at/pull/74

...
   Compiling navi v2.22.1 (/usr/pkgsrc/wip/navi/work/navi-2.22.1)
    Finished release [optimized] target(s) in 3m 48s
0323pin commented 1 year ago

Merged, http://mail-index.netbsd.org/pkgsrc-changes/2023/04/11/msg272305.html