Exa: Stop working with broken softlink

Created on 30 Jan 2020  Â·  9Comments  Â·  Source: ogham/exa

After renaming a file which is the destination of a softlink I went to the directory which contains the softlink and invoked the command exa -lhgba --git --color-scale with my alias ll.

I only got this error message.

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[1]    626274 abort (core dumped)  exa -lhgba --git --color-scale

Unfortunatly I couldn't figure out which option caused the error. But blank exa and exa --git worked perfekt.

After deleting the broken link everything was fine.

Most helpful comment

This appears to be a duplicate of #526, which was fixed in #584. I can confirm I can't reproduce it in master.

All 9 comments

Same here

✸ exa --git
bootstrap.bundle.js.map  JournalJs.js               SearchCss.css
bootstrap.css.map        JournalJs.orig.js          SearchJs.js
Bootstrap CSS.css        jQueryAutoCompleteCss.css
Bootstrap CSS.orig.css   jQueryAutoCompleteJs.js
BootstrapJS.js           Logo.png
BootstrapJS.orig.js      QuickstartJs.js

✸ exa -l
lrwxrwxrwx   50 aron 30 Jan 16:09 bootstrap.bundle.js.map -> ../../../bootstrap/dist/js/bootstrap.bundle.js.map
lrwxrwxrwx   45 aron 30 Jan 16:09 bootstrap.css.map -> ../../../bootstrap/dist/css/bootstrap.css.map
lrwxrwxrwx   41 aron 30 Jan 16:09 Bootstrap CSS.css -> ../../../bootstrap/dist/css/bootstrap.css
.rw-r--r-- 259k aron 30 Jan 16:09 Bootstrap CSS.orig.css
lrwxrwxrwx   46 aron 30 Jan 16:09 BootstrapJS.js -> ../../../bootstrap/dist/js/bootstrap.bundle.js
.rw-r--r--  74k aron 30 Jan 16:09 BootstrapJS.orig.js
lrwxrwxrwx   23 aron 30 Jan 16:09 JournalJs.js -> ../../../cms/journal.js
.rw-r--r--  12k aron 30 Jan 16:09 JournalJs.orig.js
.rw-r--r--  860 aron 30 Jan 16:09 jQueryAutoCompleteCss.css
.rw-r--r-- 5.0k aron 30 Jan 16:09 jQueryAutoCompleteJs.js
.rw-r--r-- 7.9k aron 30 Jan 16:09 Logo.png
lrwxrwxrwx   26 aron 30 Jan 16:09 QuickstartJs.js -> ../../../cms/quickstart.js
.rw-r--r-- 677k aron 30 Jan 16:09 SearchCss.css
.rw-r--r-- 872k aron 30 Jan 16:09 SearchJs.js

✸ exa --git -l
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Aborted (core dumped)

In this directory, JournalJs.js and QuickstartJs.js are both broken symlinks.

Downloading a binary from arch repo's is the only way I was able to replicate the bug. After cloning the repo and compiling from source the issue doesn't seem to be present. I would assume that your package manager is distributing an old version of exa.

It reproduces for me with 0.9.0 (latest release) downloaded from https://github.com/ogham/exa/releases

I haven't built from master. If that fixes it, it seems like a release is due. :smile:

Yep, for me also with 0.9.0. Installed with pacman.

Built directly with cargo:

$ cargo --version
cargo 1.42.0

$ ~/.cargo/bin/exa --version                    
exa v0.9.0

If there's a broken symlink (deleted target) and we pass --long and --git as parameters:

$ RUST_BACKTRACE=1 ~/.cargo/bin/exa --long --git
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /home/luka/.cargo/registry/src/github.com-1ecc6299db9ec823/exa-0.9.0/src/fs/feature/git.rs:268:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /build/rust/src/rustc-1.42.0-src/vendor/backtrace/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /build/rust/src/rustc-1.42.0-src/vendor/backtrace/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1052
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:204
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:224
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:472
  11: rust_begin_unwind
             at src/libstd/panicking.rs:380
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  13: core::option::expect_none_failed
             at src/libcore/option.rs:1199
  14: exa::fs::feature::git::reorient
  15: exa::fs::feature::git::Git::status
  16: exa::output::table::Table::display
  17: <F as scoped_threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[1]    933286 abort (core dumped)  RUST_BACKTRACE=1 ~/.cargo/bin/exa --long --git

Same here on v0.9.0 on macOS (installed via homebrew)

exa -l --git
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:1084:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[1]    11027 abort      exa -l --git

Below work well

exa -l
lrwxr-xr-x   113 ashrimp 21 3  0:18 bazel-bin -> /private/var/tmp/_bazel_ashrimp/a7f8b998302b72e24be91b8eac17d7cb/execroot/__main__/bazel-out/darwin-fastbuild/bin
lrwxr-xr-x    82 ashrimp 21 3  0:18 bazel-Onyx -> /private/var/tmp/_bazel_ashrimp/a7f8b998302b72e24be91b8eac17d7cb/execroot/__main__
lrwxr-xr-x    92 ashrimp 21 3  0:18 bazel-out -> /private/var/tmp/_bazel_ashrimp/a7f8b998302b72e24be91b8eac17d7cb/execroot/__main__/bazel-out
lrwxr-xr-x   118 ashrimp 21 3  0:18 bazel-testlogs -> /private/var/tmp/_bazel_ashrimp/a7f8b998302b72e24be91b8eac17d7cb/execroot/__main__/bazel-out/darwin-fastbuild/testlogs
drwxr-xr-x     - ashrimp 20 3 23:13 onyx
drwxr-xr-x     - ashrimp 20 3 23:13 onyx-demo
.rw-r--r--@   52 ashrimp  5 4 14:13 README.md
drwxr-xr-x     - ashrimp 20 3 23:13 vulkan-sdk
.rw-r--r--  1.0k ashrimp 20 3 23:13 WORKSPACE
exa --git
bazel-bin  bazel-Onyx  bazel-out  bazel-testlogs  onyx  onyx-demo  README.md  vulkan-sdk  WORKSPACE

OS: Mac OS X Mojave
exa version: exa v0.9.0
pkg manager: Homebrew

confirmed that this only happens in a git repo when the link target is missing.

workaround for now is to not use the --git param by default in my alias

Test case 1 - outside a git repo

> cd ./tmp
> touch testlink
> ln -s newlink
> exa --long --git -a --header --color always --sort .Name newlink
# lrwxr-xr-x     8 david.e.freeman 18 May 15:50  newlink -> testlink 
# rm testlink
> exa --long --git -a --header --color always --sort .Name newlink
# lrwxr-xr-x     8 david.e.freeman 18 May 15:50  newlink -> testlink*

test scenario 2 - in a git repo

> cd ./tmp
> git init
> touch testlink
> ln -s testlink newlink
> git add testlink newlink; git commit
> exa --long --git -a --header --color always --sort .Name newlink
# lrwxr-xr-x     8 david.e.freeman 18 May 15:50  newlink -> testlink 
> rm testlink
> exa --long --git -a --header --color always --sort .Name newlink
# thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
fish: 'exa --long --git -a --header --…' terminated by signal SIGABRT (Abort)
> exa --long -a --header --color always --sort .Name newlink
# lrwxr-xr-x     8 david.e.freeman 18 May 15:54  newlink -> testlink*

This appears to be a duplicate of #526, which was fixed in #584. I can confirm I can't reproduce it in master.

Yep, verified it with the AUR exa-git.
Unfortunately #584 is not in the last release. But the current release 0.9.0 is just 80 commits behind... https://github.com/ogham/exa/compare/v0.9.0...master

@ogham maybe you can create a new release?

Was this page helpful?
0 / 5 - 0 ratings