eza-community / eza

A modern alternative to ls
https://eza.rocks
European Union Public License 1.2
11.36k stars 204 forks source link

bug: incorrect display of `eza -T --absolute /full/path` #995

Open j-xella opened 4 months ago

j-xella commented 4 months ago

Version: v0.18.15 [+git]

~/tmp/20240516 22:05:52$ mkdir -p a/b/c/d

# this output is OK
~/tmp/20240516 22:06:00$ eza -TD --absolute a
/users/xxx/tmp/20240516/a
└── /users/xxx/tmp/20240516/a/b
   └── /users/xxx/tmp/20240516/a/b/c
      └── /users/xxx/tmp/20240516/a/b/c/d

# this one is NOT - path repeated twice in the root dir
~/tmp/20240516 22:06:21$ eza -TD --absolute $PWD/a
/users/xxx/tmp/20240516//users/xxx/tmp/20240516/a
└── /users/xxx/tmp/20240516/a/b
   └── /users/xxx/tmp/20240516/a/b/c
      └── /users/xxx/tmp/20240516/a/b/c/d
cafkafk commented 4 months ago

Could you expand on why this is incorrect?

j-xella commented 4 months ago

It seems that when you call eza --absolute -T path/to/dir, eza outputs the root folder incorrectly. Subfolders and files there seem to be OK.

It seems that eza calculates the full path to the argument (path/to/dir), but only replaces the file name (dir) with it, leaving the path (path/to) intact. As a result, you end up with root folder having double path. In this example:

eza --absolute -T path/to/dir

The root folder is shown as

**path/to**/full/path/to/dir instead of just /full/path/to/dir