After recent pkg upgrade a week ago on quarterly branch (reproducible in 2.6.2) I've noticed that Tab-completion in zsh have broken after typing pkg info (no matter with -l or not) and pressing Tab - it says that it can't find any packages. The same completion under root user, however, works OK. Moreover, after trying by root it begins to work under non-privileged user - but stops to do so on the next day (after nightly periodic).
Tracing problem in zsh I've reproduced to just one command:
$ /usr/local/sbin/pkg -N query %n-%v
pkg: package database non-existent
which, however, works without -N or from root.
Probable Root Cause
pkg now defaults to WAL mode for SQLite (or somewhat similar journal-related commit was done this year)
- SQLite requires creating/opening
-shm and -wal files even for read-only access in WAL mode.
- The -N flag (used by shell completion scripts) fails immediately when it cannot initialize these files due to
EACCES (Permission denied) in /var/db/pkg
- This creates a "flaky" bug: completion works if root left -shm/-wal files with world-readable permissions, but fails after periodic scripts or pkg clean up these files.
That is, I observe it fails when only local.sqlite is present in /var/db/pkg, but works OK when local.sqlite-shm (32K) and local.sqlite-wal (zero bytes) are also present, left there by pkg info in root's terminal.
After recent
pkgupgrade a week ago on quarterly branch (reproducible in 2.6.2) I've noticed that Tab-completion inzshhave broken after typingpkg info(no matter with-lor not) and pressingTab- it says that it can't find any packages. The same completion underrootuser, however, works OK. Moreover, after trying byrootit begins to work under non-privileged user - but stops to do so on the next day (after nightlyperiodic).Tracing problem in
zshI've reproduced to just one command:which, however, works without
-Nor fromroot.Probable Root Cause
pkgnow defaults to WAL mode for SQLite (or somewhat similar journal-related commit was done this year)-shmand-walfiles even for read-only access in WAL mode.EACCES(Permission denied) in/var/db/pkgThat is, I observe it fails when only
local.sqliteis present in/var/db/pkg, but works OK whenlocal.sqlite-shm(32K) andlocal.sqlite-wal(zero bytes) are also present, left there bypkg infoinroot's terminal.