pkg_info -g not working for unprivileged user + unreadable files

Florent Thoumie flz at
Mon Feb 7 09:38:15 UTC 2011

On Mon, Feb 7, 2011 at 7:52 AM, Doug Barton <dougb at> wrote:
> flz,
> In r206043 you converted fexists() in src/lib/libpkg/file.c to use open()
> instead of lstat(). Unfortunately this has the side effect of breaking
> 'pkg_info -g' for unprivileged users with files that have no +r bits. For
> example:
> pkg_info -g sudo-
> Information for sudo-
> Mismatched Checksums:
> pkg_info: /usr/local/bin/sudo doesn't exist
> pkg_info: /usr/local/bin/sudoedit doesn't exist
> pkg_info: /usr/local/bin/sudoreplay doesn't exist
> pkg_info: /usr/local/sbin/visudo doesn't exist

How can you compute the checksum if you don't have read access?
I understand that the error message should rather be "Cannot open %s".

> Reverting your change produces the expected behavior. So my questions are,
> why was the change made, what are its benefits, and how can we fix this
> problem?  :)

I'm sure there was a good reason at the time. I'll have a better look later.

Florent Thoumie
flz at
FreeBSD Committer

More information about the freebsd-ports mailing list