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

ls: Behaviour differs from GNU Coreutils with "--dired"/"-D" #6697

Open
kkkykin opened this issue Sep 15, 2024 · 0 comments · May be fixed by #6699
Open

ls: Behaviour differs from GNU Coreutils with "--dired"/"-D" #6697

kkkykin opened this issue Sep 15, 2024 · 0 comments · May be fixed by #6699
Labels

Comments

@kkkykin
Copy link

kkkykin commented Sep 15, 2024

ls -lF --dired should record end of filename before any file type indicator.

See coreutils-ls-dired

Expected:

d:\test>ls.exe -lF --dired
  total 0
  lrwxrwxrwx 1 somebody somegroup 0 Sep 15 22:29 aaa@ -> d:\test\dir\aaa
  drwxrwxrwx 1 somebody somegroup 0 Sep 15 22:29 dir/
  lrwxrwxrwx 1 somebody somegroup 0 Sep 15 22:27 foo.txt@ -> d:\test\dir\foo.txt
//DIRED// 59 62 132 135 186 193
//DIRED-OPTIONS// --quoting-style=literal

Actual:

The length of "aaa" filename is (59 - 82) = 23, which treat "@ -> d:\test\dir\aaa" as part of filename.
The length of "dir" filename is (136 - 132) = 4, which treat "/" as part of filename.

d:\test>ls.exe -lF --dired
  total 0
  lrwxrwxrwx 1 somebody somegroup 0 Sep 15 22:29 aaa@ -> d:\test\dir\aaa
  drwxrwxrwx 1 somebody somegroup 0 Sep 15 22:29 dir/
  lrwxrwxrwx 1 somebody somegroup 0 Sep 15 22:27 foo.txt@ -> d:\test\dir\foo.txt
//DIRED// 59 82 132 136 186 217
//DIRED-OPTIONS// --quoting-style=literal

Explanation

The main difference is in the second-to-last line. "--dired" argument should record end of file name before '@' or '/'.

GNU Coreutils under wsl

[kkky@mywsl:/mnt/d/test]$ ls -lF --dired
  total 0
  lrwxrwxrwx 1 kkky users   19 Sep 15 22:29 aaa -> /mnt/d/test/dir/aaa/
  drwxrwxrwx 1 kkky users 4096 Sep 15 22:29 dir/
  lrwxrwxrwx 1 kkky users   23 Sep 15 22:27 foo.txt -> /mnt/d/test/dir/foo.txt*
//DIRED// 54 57 126 129 175 182
//DIRED-OPTIONS// --quoting-style=shell-escape

Please excuse my poor English.

kkkykin added a commit to kkkykin/coreutils that referenced this issue Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants