WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] whichcraft  (Read 180 times)

Online Leee

  • Full Member
  • ***
  • Posts: 135
[Solved] whichcraft
« on: January 17, 2025, 01:40:40 PM »
I'm putting this in "Off-Topic" because I'm not sure if it's a base issue, an extension issue or  a pebcak issue but here's the story.  If anyone can tell me what's up, or just that I need more sleep, I'd appreciate it.

I'm running Core 15.0 / x86_64 on one of my many decrepit old laptops and putting together a suite if system info scripts including neofetch.  This particular box is on both the wired and wireless subnets but neofetch only shows one of them (the wifi) so I decided to hack it to show both.  But, in the process of hacking it, I ran into what appears to me to be a system issue.

The original neofetch script is mount-installed in the usual manner:
Code: [Select]
tc@gramlt:~/.config/neofetch$ ls -l /usr/local/bin/neofetch
lrwxrwxrwx    1 root     root            43 Jan 17 00:52 /usr/local/bin/neofetch -> /tmp/tcloop/neofetch/usr/local/bin/neofetch


My gently hacked copy is in my personal bin directory:
Code: [Select]
tc@gramlt:~/.config/neofetch$ ls -l ~/bin/neofetch
-rwxr--r--    1 tc       staff       334829 Jan 17 13:24 /home/tc/bin/neofetch


My PATH includes my personal bin directory first:
Code: [Select]
tc@gramlt:~/.config/neofetch$ echo "${PATH}" |tr ":" "\n"
/home/tc/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin


The only aliases in play are the default ones:
Code: [Select]
tc@gramlt:~/.config/neofetch$ alias
ls='ls -p'
cp='cp -i'
df='df -h'
rm='rm -i'
mv='mv -i'
la='ls -la'
du='du -h'
ce='cd /etc/sysconfig/tcedir'
ll='ls -l'


The which command tells me just what I'd expect:
Code: [Select]
tc@gramlt:~/.config/neofetch$ which neofetch
/home/tc/bin/neofetch


However, when I invoke neofetch by simply naming it, the original (in /usr/local/bin ) runs.  Note the "Script Name" line, which outputs ${0}:
Code: [Select]
tc@gramlt:~/.config/neofetch$ neofetch
                                                                                                                                                                         
    0000                   Script Name: /usr/local/bin/neofetch
   00                      Which Script: /home/tc/bin/neofetch
  00     00                Host: gramlt
  00     00  0000          Model: HP 2000 Notebook PC 0889130000305910000620100
   00                      OS: TinyCoreLinux 15.0 x86_64
    0000                   Kernel: 6.6.8-tinycore64
      00  0000             Uptime: 2 days, 17 hours, 42 mins
     00  00  00            Packages: 233 (tce-status)
    00  00    00           Shell: sh
   00  00      00          Resolution: , 1920x1080
  00  00        00         WM: JWM
  00  00        00         Terminal: /dev/pts/0
               00          CPU: AMD A6-5200 APU (4) @ 2.000GHz
  00  00      00    (°-    GPU: AMD ATI Radeon HD 8400 / R3 Series
   0000      00     //\    Memory: 365MiB / 7433MiB
    00  0000  0000  v_/_   Disk (/mnt/sda1): 11G / 92G (13%)
                           tce dir: /mnt/sda1/boot/core15.0/tce64
                           Local IP: 10.0.0.156



When I invoke neofetch the way "which" thinks it should be invoked, the hacked script (in /home/tc/bin/ ) runs.  Again, note the "Script Name" line:
Code: [Select]
tc@gramlt:~/.config/neofetch$ which neofetch
/home/tc/bin/neofetch
tc@gramlt:~/.config/neofetch$
tc@gramlt:~/.config/neofetch$ `which neofetch`
                                                                                                                                                                         
    0000                   Script Name: /home/tc/bin/neofetch
   00                      Which Script: /home/tc/bin/neofetch
  00     00                Host: gramlt
  00     00  0000          Model: HP 2000 Notebook PC 0889130000305910000620100
   00                      OS: TinyCoreLinux 15.0 x86_64
    0000                   Kernel: 6.6.8-tinycore64
      00  0000             Uptime: 2 days, 17 hours, 50 mins
     00  00  00            Packages: 233 (tce-status)
    00  00    00           Shell: sh
   00  00      00          Resolution: , 1920x1080
  00  00        00         WM: JWM
  00  00        00         Terminal: /dev/pts/0
               00          CPU: AMD A6-5200 APU (4) @ 2.000GHz
  00  00      00    (°-    GPU: AMD ATI Radeon HD 8400 / R3 Series
   0000      00     //\    Memory: 364MiB / 7433MiB
    00  0000  0000  v_/_   Disk (/mnt/sda1): 11G / 92G (13%)
                           tce dir: /mnt/sda1/boot/core15.0/tce64
                           Local IP: 192.168.1.100 - and - 10.0.0.156



In the grand scheme of things, I'm thinking I can probably just hack the config file ( ~/.config/neofetch/config.conf ) instead of the main script.
But, in the even grander scheme of things, WTF?!?

For anyone who is interested, attached is the TinyCore logo file that I had to make for myself, since TinyCore is not one of the -many- little known distros for which neofetch has built in logos.

« Last Edit: January 17, 2025, 03:37:57 PM by Rich »
core 15.0 x86_64

Offline ovacikar

  • Jr. Member
  • **
  • Posts: 69
Re: whichcraft
« Reply #1 on: January 17, 2025, 02:49:04 PM »
Did you try:

Code: [Select]
hash -r

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11770
Re: whichcraft
« Reply #2 on: January 17, 2025, 02:54:16 PM »
Hi Leee
ovacikar is correct. I just ran into that same issue (again) the
other day. Sometimes after loading an extension, the terminal
you are using isn't aware of the change.

Either running:
Code: [Select]
hash -ror launching a new terminal should fix it.

Online Leee

  • Full Member
  • ***
  • Posts: 135
Re: whichcraft
« Reply #3 on: January 17, 2025, 03:29:01 PM »
Hi Leee
ovacikar is correct. I just ran into that same issue (again) the
other day. Sometimes after loading an extension, the terminal
you are using isn't aware of the change.

Either running:
Code: [Select]
hash -ror launching a new terminal should fix it.

Thanks @ovacikar and @rich !

That apparently was exactly the issue.  I tried opening a new terminal and it worked correctly.  Then went back to the original terminal and tested it before and after running
Code: [Select]
hash -r and it worked the wrong way before and the correct way afterward.

I've never used the hash command before - sounds like it should have something to do with substance abuse.     :)

In the mean time, I moved my changes to the neofetch config file and can now throw away the modified neofetch anyway.  Still, I've learned something so my day is complete.

« Last Edit: January 17, 2025, 03:30:50 PM by Leee »
core 15.0 x86_64

Online Leee

  • Full Member
  • ***
  • Posts: 135
Re: whichcraft
« Reply #4 on: January 17, 2025, 03:32:18 PM »
@rich I've forgotten how to mark the issue as "solved".
core 15.0 x86_64

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11770
Re: [Solved] whichcraft
« Reply #5 on: January 17, 2025, 03:39:36 PM »
Hi Leee
Easy, just ask me. :)

Posts can not be edited after 30 minutes.