$OpenBSD: patch-share_functions___fish_print_packages_fish,v 1.1.1.1 2017/12/16 05:14:32 abieber Exp $

This can be removed when 3.0 is released:
https://github.com/fish-shell/fish-shell/pull/4584/

Index: share/functions/__fish_print_packages.fish
--- share/functions/__fish_print_packages.fish.orig
+++ share/functions/__fish_print_packages.fish
@@ -27,11 +27,17 @@ function __fish_print_packages

     # Pkg is fast on FreeBSD and provides versioning info which we want for
     # installed packages
-    if begin
-            type -q -f pkg
-            and test (uname) = "FreeBSD"
-        end
+    if type -q -f pkg
         pkg query "%n-%v"
+        return
+    end
+
+    # pkg_info on OpenBSD provides versioning info which we want for
+    # installed packages but, calling it directly can cause delays in
+    # returning information if another pkg_* tool have a lock.
+    # Listing /var/db/pkg is a clean alternative.
+    if type -q -f pkg_add
+        set -l files /var/db/pkg/*; string replace '/var/db/pkg/' '' -- $files
         return
     end

