Skip to content

bug: ls: panics on dangling symlink with --color=auto -l #6227

@sisungo

Description

@sisungo

There is a symlink ipaddr pointing to non-existent file /bin/busybox.

Outputs

pwork-server1:/bin$ ls --color=auto -l ip*
-rwxr-xr-x 1 root root 606712 Nov  6 20:24 ip
ls: cannot access '/bin/busybox': No such file or directory
thread 'main' panicked at src/uu/ls/src/ls.rs:3379:58:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Full Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/805813650248c1a2f6f271460d728d1bb852d2a7/library/std/src/panicking.rs:646:5
   1: core::panicking::panic_fmt
             at /rustc/805813650248c1a2f6f271460d728d1bb852d2a7/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/805813650248c1a2f6f271460d728d1bb852d2a7/library/core/src/panicking.rs:141:5
   3: core::option::unwrap_failed
             at /rustc/805813650248c1a2f6f271460d728d1bb852d2a7/library/core/src/option.rs:1984:5
   4: core::option::Option<T>::unwrap
             at /rustc/805813650248c1a2f6f271460d728d1bb852d2a7/library/core/src/option.rs:932:21
   5: uu_ls::color_name::{{closure}}
             at /root/Downloads/coreutils-0.0.25/src/uu/ls/src/ls.rs:3379:33
   6: core::result::Result<T,E>::unwrap_or_else
             at /rustc/805813650248c1a2f6f271460d728d1bb852d2a7/library/core/src/result.rs:1431:23
   7: uu_ls::color_name
             at /root/Downloads/coreutils-0.0.25/src/uu/ls/src/ls.rs:3378:18
   8: uu_ls::display_item_name
             at /root/Downloads/coreutils-0.0.25/src/uu/ls/src/ls.rs:3235:40
   9: uu_ls::display_item_long
             at /root/Downloads/coreutils-0.0.25/src/uu/ls/src/ls.rs:2766:13
  10: uu_ls::display_items
             at /root/Downloads/coreutils-0.0.25/src/uu/ls/src/ls.rs:2475:13
  11: uu_ls::list
             at /root/Downloads/coreutils-0.0.25/src/uu/ls/src/ls.rs:2050:5
  12: uu_ls::uumain::uumain
             at /root/Downloads/coreutils-0.0.25/src/uu/ls/src/ls.rs:1162:5
  13: uu_ls::uumain
             at /root/Downloads/coreutils-0.0.25/src/uu/ls/src/ls.rs:1149:1
  14: coreutils::main
             at /root/Downloads/coreutils-0.0.25/src/bin/coreutils.rs:103:31
  15: core::ops::function::FnOnce::call_once
             at /rustc/805813650248c1a2f6f271460d728d1bb852d2a7/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions