Possible bug/conflict with PKGDIR environment variable

It seems that I might have located a possible bug or conflict with the PKGDIR environment variable. According to pkg_add(1), the PKGDIR variable is used to tell pkg_add where to place downloaded packages when the -K option is used. I have it set to /usr/ports/packages. However, with this variable set, and if one does a make package or make install on a port, it will fail saying that the pkg-descr file cannot be found. If I unset PKGDIR, then it works normally.
 
That looks like a mistake in the manual page of pkg_add(1), the variable PKGDIR is not for setting a directory for storing the built packages but for setting a directory where the port build keeps its temporary files for package creation.

The variable to set for directory for built packages is PACKAGES as noted in ports(7).

# make -C /usr/ports/archivers/zip package PACKAGES=/some/path/packages.
The directory has to exist, otherwise the package will placed in current directory
 
It seems that it's not only a mistake in the manual page but also in the pkg_add(1) program itself, it uses the PKGDIR variable when it really should use PACKAGES.
 
Thanks for narrowing that down. I am now inclined to go look at it and see if I can correct the problem.

EDIT:

I found where PKGDIR is referenced. It's in a library file that is called by the pkg_add(1) program. That is located at /usr/src/usr.sbin/pkg_install/lib/url.c:95. The problem is that I am not sure if I change it that it will break something else.

EDIT:

pkg_info(1) also uses that same function call as well. Looking at it's man page, it's wrong there too. So this will need to be fixed in multiple locations.
 
Back
Top