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

Long path name in NTFS will cause Bad address (os error 14) #893

Closed
FlandreDaisuki opened this issue Jun 20, 2021 · 4 comments
Closed

Long path name in NTFS will cause Bad address (os error 14) #893

FlandreDaisuki opened this issue Jun 20, 2021 · 4 comments

Comments

@FlandreDaisuki
Copy link

If exa does something unexpected, or its output looks wrong, or it displays an error on the screen, or if it outright crashes, then please include the following information in your report:

  • The version of exa being used (exa --version)
    • v0.10.1 [+git]
  • The command-line arguments you are using
    • exa
  • Your operating system and hardware platform
    • OS: Linux Mint 20.1 x86_64
    • Kernel: 5.4.0-73-generic
    • DE: MATE

If it’s a crash, please include the full text of the crash that gets printed to the screen. If you’re seeing unexpected behaviour, a screenshot of the issue will help a lot.


with debug flag
$ EXA_DEBUG=1 exa
[DEBUG exa] Running with options: Options {
    dir_action: List,
    filter: FileFilter {
        list_dirs_first: false,
        sort_field: Name(
            AaBbCc,
        ),
        reverse: false,
        only_dirs: false,
        dot_filter: JustFiles,
        ignore_patterns: IgnorePatterns {
            patterns: [],
        },
        git_ignore: Off,
    },
    view: View {
        mode: Grid(
            Options {
                across: false,
            },
        ),
        width: Automatic,
        file_style: Options {
            classify: JustFilenames,
            show_icons: Off,
        },
    },
    theme: Options {
        use_colours: Automatic,
        colour_scale: Fixed,
        definitions: Definitions {
            ls: Some(
                "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:",
            ),
            exa: None,
        },
    },
}
[DEBUG exa::fs::file] Statting file "."
[INFO exa::fs::dir] Reading directory "."
".": Bad address (os error 14)

I have both fs, ntfs & ext4, in my system:

$ lsblk --fs /dev/sdc
NAME   FSTYPE LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sdc                                                                     
├─sdc1 ntfs         021440A176AA6AA3                      810.5G     9% /media/flandre/021440A176AA6AA3
└─sdc2 ext4         68479aae-805e-461a-b3de-31028103ebbe  910.7G     0% /media/flandre/dev-ext4-1t

When I create a folder with long name in Mate Desktop until it cause "name too long error".
In ext4 the maximum name length is /media/flandre/dev-ext4-1t/一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五
and in /media/flandre/dev-ext4-1t/ call exa is ok.

The main problem is in ntfs.
The maximum name length is /media/flandre/021440A176AA6AA3/long/一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五 and in /media/flandre/021440A176AA6AA3/long/ call exa will show ".": Bad address (os error 14)
I test the minimal length will cause this error: /media/flandre/021440A176AA6AA3/long/一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六

Here is some screenshot with Mint File Manager (caja) and Terminal:

Show the maximum availible name length in DE:
Show the maximum availible name length in DE

Show the minimum name length that cause the error:
Show the minimum name length that cause the error

Work in long name folder which have short name files:
Work in long name folder which have short name files

@ariasuni
Copy link
Collaborator

I can reproduce, and it also makes starship crash, so it may something Rust-related.

@ariasuni
Copy link
Collaborator

ariasuni commented Jun 24, 2021

There error comes from exa here:

.map(|result| result.map(|entry| entry.path()))

I believe comes from Rust here:
https://github.com/rust-lang/rust/blob/5a7834050f3a0ebcd117b4ddf0bc1e8459594309/library/std/src/sys/unix/fs.rs#L1005

Edit: minimal reproduction case:

use std::env;
use std::fs::{self, ReadDir};

fn main() {
    test().unwrap();
}

fn test() -> std::io::Result<ReadDir> {
    let args: Vec<String> = env::args().collect();
    for result in fs::read_dir(&args[1])? {
        result.map(|entry| entry.path()).unwrap();
    }
    todo!()
}

it gives thread 'main' panicked at 'called Result::unwrap()on anErr value: Os { code: 0, kind: Other, message: "Success" }', test.rs:11:42 (I couldn’t reproduce exactly the same thing, with Bad address (os error 14) but since the Rust code calls a function called last_os_error(), that makes sense that the output differs depending on what was executed before).

@ariasuni
Copy link
Collaborator

It’s been fixed upstream! 🎉

$ cargo +beta run /run/media/ariasuni/NO_LABEL/exa_test/
    Finished dev [unoptimized] target(s) in 0.03s
     Running `target/debug/exa /run/media/ariasuni/NO_LABEL/exa_test/`
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十
一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五

It works when compiled with Rust beta, so I’ll close this, but you’ll have to wait for a version of exa compiled with a recent Rust (or build one yourself). Thanks for the bug report, it helped fix a bug in Rust upstream and improve exa!

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

No branches or pull requests

3 participants
@ariasuni @FlandreDaisuki and others