romkatv / romkatv/gitstatus

gitstatus failed to initialize on NetBSD 10.0

Open
#437 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.8k
Forks
134
Avg merge
2d 18h
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the gitstatusd startup path shown in the Zsh and daemon logs, focusing on the getconf _NPROCESSORS_ONLN lookup and the subsequent FIFO setup. Reproduce on NetBSD 10.0, verify that initialization completes without the broken-pipe failure, and check the debug logs for any additional startup errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
zsh
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.