Monday, October 30, 2017

pkg_info fails for non-installed packages when PKG_CACHE is set to a directory the current user can't write to

Oct 27 snapshot, amd64.

When PKG_CACHE is set:

$ cat /etc/profile
export PKG_CACHE=/var/cache/pkg

To a directory the current user lacks write access to:

$ touch /var/cache/pkg/somefile
touch: /var/cache/pkg/somefile: Permission denied

Trying to call pkg_info on an uninstalled package fails:

$ pkg_info -e lumina-1.3.0pl1p2; echo $?
1
$ pkg_info lumina-1.3.0pl1p2
Fatal error: bad PKG_CACHE directory /var/cache/pkg
at /usr/libdata/perl5/OpenBSD/PackageRepository.pm line 669.

This is surprising, because I didn't expect pkg_info to write anything
but temporary files; PKG_CACHE is not documented on pkg_info(1). The
program doesn't apparently even intend to cache anything, as when I
temporarily set PKG_CACHE to something writable:

$ cd $HOME
$ PKG_CACHE=. pkg_info lumina-1.3.0pl1p2
Information for https://ftp.eu.openbsd.org/pub/OpenBSD/snapshots
/packages/amd64/lumina-1.3.0pl1p2.tgz

Comment:
Lumina Desktop Environment

Description:
Lumina-DE is a lightweight, BSD licensed desktop environment.

Maintainer: Bryan C. Everly <bryan@bceassociates.com>

WWW: http://lumina-desktop.org/

It works, but nothing is actually cached:

$ ls lumina-1.3.0pl1p2.tgz
ls: lumina-1.3.0pl1p2.tgz: No such file or directory

Is this a bug, or just an unsupported use case?

No comments:

Post a Comment