fastfetch-cli / fastfetch

Like neofetch, but much faster because written mostly in C.
MIT License
7.99k stars 345 forks source link

Fastfetch makes one tiny error (additional line) in print when not run in terminal start #101

Closed tomato4 closed 2 years ago

tomato4 commented 2 years ago

When I open new terminal, everything works fine. image

But I have abbreviation for cl = clear; fastfetch. And there it creates one line emtpy and in the end it also creates 1 empty prompt. image

(and it's not problem of clear - when I run only fastfetch it does the same thing) image

It's not a big deal. I'm just perfectionist, so it bothers me a little :D Additional informations about my setup is in the pictures... Or feel free to ask.

Also I tried it on Termite, XTerm, urxvt and it does it in all of these terminals Also tried Bash instead of Fish and no change. Still does it

LinusDierheimer commented 2 years ago

Please post the output of fastfetch --show-errors --multithreading false

tomato4 commented 2 years ago

image

LinusDierheimer commented 2 years ago

Does fastfetch --structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Resolution:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:Locale:Break:Colors have the same issue?

tomato4 commented 2 years ago

yes it does

tomato4 commented 2 years ago

Well it is fine when I erase "resolution" item. So it's caused because of this module I think image

LinusDierheimer commented 2 years ago

Thanks, that makes debugging easier.

tomato4 commented 2 years ago

Of course, not a problem.

LinusDierheimer commented 2 years ago

Let me sum it up so i can be sure:

If all of that is true, tbh i have no idea what even could be the problem.

LinusDierheimer commented 2 years ago

Does the following command have the issue?

fastfetch --multithreading false --structure Title:Separator:OS:Host:Kernel:Uptime:Packages:Resolution:DE:WM:WMTheme:Theme:Icons:Font:Cursor:CPU:GPU:Memory:Disk:Battery:Locale:Break:Colors
tomato4 commented 2 years ago

Yes, all of that is true. Also it does that on my second device (stable PC) with same OS setup.

Does the following command have the issue?

Yes it does

Maybe I could some day try some debugging myself. I know C a little. But not sure what I can do.

LinusDierheimer commented 2 years ago

The best thing you can try is to go to src/common/detectTerminalShell.c. In line 190 you find static void getShellVersionGeneric(FFstrbuf* exe, const char* exeName, FFstrbuf* version). See if it gets executed. This is the only method that could potentially add a newline to an output. If it does, something is wrong with static void getShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version).

tomato4 commented 2 years ago

Ok I will look at that later. I will comment here once I try figure out something

LinusDierheimer commented 2 years ago

I just fixed a bug in shell code, i don't believe this fixes your problem, but who knows.

tomato4 commented 2 years ago

Nope. Still same.

But found out another interesting fact. If I run fastfetch via run.sh it works properly, but if I run directly fastfetch it does not.

PS: I'm still planning to look at that code (especialy the func you recomended to me), but I haven't much time lately...

image image

LinusDierheimer commented 2 years ago

This is kinda expected, since calling a shell script spawns a new instance of sh, so running fastfetch through run.sh is always as if fastfetch is the first command to be entert in a terminal.

LinusDierheimer commented 2 years ago

If you have latest version, can you please post the output of fastfetch --load-config devinfo-verbose?

tomato4 commented 2 years ago

image

LinusDierheimer commented 2 years ago

Output of fastfetch --shell-format "Before {7} After"?

tomato4 commented 2 years ago

image

tomato4 commented 2 years ago

I have problem to debug the program. With CLion nor with gdb I'm unable to reproduce the bug in debugging enviroment. As you said earlier:

This is kinda expected, since calling a shell script spawns a new instance of sh, so running fastfetch through run.sh is always as if fastfetch is the first command to be entert in a terminal.

debugger also creates new env, where the program runs perfectly. If you have any advice, please tell me, but currently I don't know how to debug the program.

Also I have found solution. Kind of... By accident I discovered, that clear; sleep 0.1; fastfetch works perfectly fine. I don't now how's that possible, but it is what it is. It is not clean solution, so if you have any ideas?...

LinusDierheimer commented 2 years ago

This sounds more like a problem with clear in your terminal emulator than with fastfetch. Is it possible that bug happens with other programs too that output very fast, like clear; cat /proc/cpuinfo?

tomato4 commented 2 years ago

well no, because it does it even without clear. Cmd fastfetch will produce bug but sleep 0.1; fastfetch won't. Even without the clear cmd

LinusDierheimer commented 2 years ago

Closing this for now, maybe it gets fixed in future by luck.

tomato4 commented 2 years ago

Actually it was already fixed by luck, but I forget to report it there. Thanks for the effort.