kyoheiu / felix

tui file manager with vim-like key mapping
https://kyoheiu.dev/felix/
MIT License
712 stars 25 forks source link

Can't compile v2.2.0 on NetBSD #157

Closed 0323pin closed 1 year ago

0323pin commented 1 year ago

Hi,

Maybe related to #154 , while building v2.2.0 to update our package, I'm getting the following error,

Compiling felix v2.2.0 (/usr/pkgsrc/wip/felix/work/felix-2.2.0)
error[E0201]: duplicate definitions with name `open_file_in_new_window`:
   --> src/state.rs:266:5
    |
219 |     pub fn open_file_in_new_window(&self) -> Result<(), FxError> {
    |     ------------------------------------------------------------ previous definition of `open_file_in_new_window` here
...
266 |     pub fn open_file_in_new_window(&self) -> Result<(), FxError> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definition

For more information about this error, try `rustc --explain E0201`.
error: could not compile `felix` due to previous error
*** Error code 101

Stop.

NetBSD-9.99.108 current dev. Rust-1.65

0323pin commented 1 year ago

@kyoheiu Line 264 in src/state.rs, #[cfg(not(target_os = "linux"))] also needs to be adapted, else NetBSD is now defined in two places.

Replacing it with

#[cfg(all(
    not(target_os = "linux"),
    not(target_os = "netbsd")
))]

should be enough but, I didn't had the time to check if other definitions need to be adjusted somewhere else.

EDIT: Just gone through state.rs and that looks like the only change needed. Maybe, I should recursive grep the whole repository just to be sure but, I'm not on a *nix system before tonight.

This week I have too much real life work, also very soon we are entering a package freeze ahead of branching the next stable-packages iteration.

If you have time for a quick fix, it would be awesome, if not I can do a PR next week. Regards

0323pin commented 1 year ago

Hmm ... it seems the above is not enough.

   Compiling felix v2.2.0 (/home/pin/Git/felix)
error[E0277]: `?` couldn't convert the error to `FxError`
   --> src/state.rs:234:75
    |
234 | ...                   nix::sys::wait::waitpid(Some(child), None)?;
    |                                                                 ^ the trait `From<Errno>` is not implemented for `FxError`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <FxError as From<FromUtf8Error>>
              <FxError as From<SetLoggerError>>
              <FxError as From<ZipError>>
              <FxError as From<serde_yaml::Error>>
              <FxError as From<std::io::Error>>
              <FxError as From<syntect::Error>>
              <FxError as From<walkdir::Error>>
    = note: required for `Result<(), FxError>` to implement `FromResidual<Result<Infallible, Errno>>`

error[E0277]: `?` couldn't convert the error to `FxError`
   --> src/state.rs:238:54
    |
238 | ...                   nix::unistd::setsid()?;
    |                                            ^ the trait `From<Errno>` is not implemented for `FxError`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <FxError as From<FromUtf8Error>>
              <FxError as From<SetLoggerError>>
              <FxError as From<ZipError>>
              <FxError as From<serde_yaml::Error>>
              <FxError as From<std::io::Error>>
              <FxError as From<syntect::Error>>
              <FxError as From<walkdir::Error>>
    = note: required for `Result<(), FxError>` to implement `FromResidual<Result<Infallible, Errno>>`

error[E0599]: no variant or associated item named `Nix` found for enum `FxError` in the current scope
   --> src/state.rs:250:48
    |
250 |                         Err(e) => Err(FxError::Nix(e.to_string())),
    |                                                ^^^ variant or associated item not found in `FxError`
    |
   ::: src/errors.rs:4:1
    |
4   | pub enum FxError {
    | ---------------- variant or associated item `Nix` not found for this enum

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `felix` due to 3 previous errors
Exception: cargo exited with 101

Maybe the previous PR was a bad idea :(

kyoheiu commented 1 year ago

Hi, sorry for the late reply. Fixed this issue by #158 , so it'd be great if you can check this can be compiled.

0323pin commented 1 year ago

@kyoheiu Thanks! I should have looked in errors.rs 🤦‍♂️ I'll kick a new build later today (in about 14h).

0323pin commented 1 year ago

@kyoheiu A few more places were missing. Compiling from your latest change #158 yielded the following error,

   Compiling felix v2.2.0 (/home/pin/Git/felix)
error[E0277]: `?` couldn't convert the error to `FxError`
   --> src/state.rs:234:75
    |
234 | ...                   nix::sys::wait::waitpid(Some(child), None)?;
    |                                                                 ^ the trait `From<Errno>` is not implemented for `FxError`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <FxError as From<FromUtf8Error>>
              <FxError as From<SetLoggerError>>
              <FxError as From<ZipError>>
              <FxError as From<serde_yaml::Error>>
              <FxError as From<std::io::Error>>
              <FxError as From<syntect::Error>>
              <FxError as From<walkdir::Error>>
    = note: required for `Result<(), FxError>` to implement `FromResidual<Result<Infallible, Errno>>`

error[E0277]: `?` couldn't convert the error to `FxError`
   --> src/state.rs:238:54
    |
238 | ...                   nix::unistd::setsid()?;
    |                                            ^ the trait `From<Errno>` is not implemented for `FxError`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <FxError as From<FromUtf8Error>>
              <FxError as From<SetLoggerError>>
              <FxError as From<ZipError>>
              <FxError as From<serde_yaml::Error>>
              <FxError as From<std::io::Error>>
              <FxError as From<syntect::Error>>
              <FxError as From<walkdir::Error>>
    = note: required for `Result<(), FxError>` to implement `FromResidual<Result<Infallible, Errno>>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `felix` due to 2 previous errors
Exception: cargo exited with 101

I've fixed the missing parts in #159

It builds fine with these last changes.

kyoheiu commented 1 year ago

Ah, I had overlooked that. Merged, thanks! Guess I should rethink the module structure or add extra CI to avoid this type of error. I'll give it a try.

0323pin commented 1 year ago

Thanks for the quick merge and the point release. I'll do what I can to get the update merged before branching stable.

0323pin commented 1 year ago

@kyoheiu I've managed to get it done in time, https://mail-index.netbsd.org/pkgsrc-changes/2022/12/17/msg265437.html