romkatv / gitstatus

Git status for Bash and Zsh prompt
GNU General Public License v3.0
1.65k stars 101 forks source link

gitstatus failed to initialize on NetBSD 10.0 #437

Open cluesch opened 1 month ago

cluesch commented 1 month ago

I've compiled gitstatusd as per the documentation this time, it will fail on startup with:

  Zsh log (/tmp/gitstatus.POWERLEVEL9K.18911.18165.1717439343.1.xtrace.log):

    +(anon):7> setopt monitor
    +(anon):9> ((  ! _GITSTATUS_STATE_POWERLEVEL9K  ))
    +(anon):10> [[ -r /proc/version && 'NetBSD version 10.0 (netbsd@localhost) (gcc version 10.5.0) NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024' == *Microsoft* ]]
    +(anon):13> print -rn
    +(anon):14> zsystem flock -f lock_fd /tmp/gitstatus.POWERLEVEL9K.18911.18165.1717439343.1.lock
    +(anon):15> [[ 15 == <1-> ]]
    +(anon):18> typeset -gi '_GITSTATUS_LOCK_FD_POWERLEVEL9K=lock_fd'
    +(anon):20> [[ netbsd == cygwin* ]]
    +(anon):41> sysopen -r -o cloexec -u resp_fd /proc/self/fd/14
    +(anon):44> typeset -gi 'GITSTATUS_DAEMON_PID_POWERLEVEL9K=22787'
    +(anon):46> [[ 17 == <1-> ]]
    +(anon):47> typeset -gi '_GITSTATUS_RESP_FD_POWERLEVEL9K=resp_fd'
    +(anon):48> typeset -gi '_GITSTATUS_STATE_POWERLEVEL9K=1'
    +(anon):51> ((  ! async  ))
    +(anon):41> _gitstatus_daemon_p9k_
    +_gitstatus_daemon_p9k_:1> local -i pipe_fd
    +(anon):7> setopt monitor
    +(anon):9> ((  ! _GITSTATUS_STATE_POWERLEVEL9K  ))
    +(anon):51> ((  ! async  ))
    +(anon):52> ((  _GITSTATUS_CLIENT_PID_POWERLEVEL9K == sysparams[pid]  ))
    +(anon):54> local pgid
    +(anon):55> ((  0 < 20  ))
    +(anon):56> [[ -t 17 ]]
    +(anon):57> sysread -s 20 -t 10.0000000000 -i 17 'pgid[$#pgid+1]'
    +(anon):57> return

I've enabled GITSTATUS_LOG_LEVEL=DEBUG which gives:

  Daemon log (/tmp/gitstatus.POWERLEVEL9K.18911.18165.1717439343.1.daemon.log):

    +_gitstatus_daemon_p9k_:3> local pgid=22787
    +_gitstatus_daemon_p9k_:4> [[ 22787 == <1-> ]]
    +_gitstatus_daemon_p9k_:5> cd -q /
    +_gitstatus_daemon_p9k_:90> ((  lock_fd == -1  ))
    +_gitstatus_daemon_p9k_:9> trap '' PIPE
    +_gitstatus_daemon_p9k_:11> local uname_sm
    +_gitstatus_daemon_p9k_:93> zsystem flock -- /tmp/gitstatus.POWERLEVEL9K.18911.18165.1717439343.1.lock
    +_gitstatus_daemon_p9k_:12> uname_sm=+_gitstatus_daemon_p9k_:12> uname -sm
    +_gitstatus_daemon_p9k_:12> uname_sm='netbsd amd64'
    +_gitstatus_daemon_p9k_:13> [[ 'netbsd amd64' == [^\ ]##\ [^\ ]## ]]
    +_gitstatus_daemon_p9k_:14> local uname_s=netbsd
    +_gitstatus_daemon_p9k_:15> local uname_m=amd64
    +_gitstatus_daemon_p9k_:17> [[ '' == <1-> ]]
    +_gitstatus_daemon_p9k_:20> local cpus
    +_gitstatus_daemon_p9k_:21> ((  ! 0  ))
    +_gitstatus_daemon_p9k_:23> ((  ! 1  ))
    +_gitstatus_daemon_p9k_:23> cpus=+_gitstatus_daemon_p9k_:23> getconf _NPROCESSORS_ONLN
    getconf: _NPROCESSORS_ONLN: unknown variable
    +_gitstatus_daemon_p9k_:23> cpus=''
    +_gitstatus_daemon_p9k_:24> cpus=8
    +_gitstatus_daemon_p9k_:27> args+=( -t 16 )
    +_gitstatus_daemon_p9k_:30> mkfifo -- /tmp/gitstatus.POWERLEVEL9K.18911.18165.1717439343.1.fifo
    +_gitstatus_daemon_p9k_:31> print -rnu 14 -- '               22787'
    _gitstatus_daemon_p9k_:print:31: write error: broken pipe
    +_gitstatus_daemon_p9k_:31> return
    +_gitstatus_daemon_p9k_:84> local -i ret=1
    +_gitstatus_daemon_p9k_:85> zf_rm -f -- /tmp/gitstatus.POWERLEVEL9K.18911.18165.1717439343.1.lock /tmp/gitstatus.POWERLEVEL9K.18911.18165.1717439343.1.fifo
    +_gitstatus_daemon_p9k_:86> kill -- -22787

  System information:

    zsh:      5.9
    uname -a: NetBSD sdf 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

The error getconf: _NPROCESSORS_ONLN: unknown variable appears because that variable is called NPROCESSORS_ONLN on NetBSD and FreeBSD, see this answer on StackOverflow.

I'm not sure if this is the only thing which fails though, as the guess of eight CPUs is correct.

romkatv commented 1 month ago

It's not something I am willing to debug. If you figure out how to solve this, please post an update.