Bug 199811 - libnvpair has a sneaky dependency on libzfs
Summary: libnvpair has a sneaky dependency on libzfs
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Andriy Gapon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-30 13:39 UTC by Andriy Gapon
Modified: 2015-12-23 04:36 UTC (History)
1 user (show)

See Also:


Attachments
preliminary patch (1.90 KB, patch)
2015-06-25 11:09 UTC, Andriy Gapon
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andriy Gapon freebsd_committer freebsd_triage 2015-04-30 13:39:24 UTC
/lib/libnvpair.so.2: Undefined symbol "aok"

Symbol aok is provided by lbzfs.so (and libzpool.so as well).
aok variable modifies behavior of assfail() function and ASSERT*() macros provided for illumos contributed code.
ASSERT() is used in sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c file which shared by both the kernel nvlist / nvpair code and the userland library.

Given that lbzfs.so and libzpool.so both depend on libnvpair.so, but the latter depends on neither, it might make sense to collapse 'aok' definition and move it to libnvpair.
More elegant solution would be to introduce a library like "libillumos_compat" that would have illumos compatibility definitions that are not specific to any specialized library.
Comment 1 Andriy Gapon freebsd_committer freebsd_triage 2015-06-25 11:09:21 UTC
Created attachment 158043 [details]
preliminary patch

Attached is a patch based on a patch obtained from bapt@FreeBSD.org that I am currently testing.
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-09-28 15:26:08 UTC
A commit references this bug:

Author: avg
Date: Mon Sep 28 15:25:37 UTC 2015
New revision: 288340
URL: https://svnweb.freebsd.org/changeset/base/288340

Log:
  define aok in libnvpair which is linked to all zfs libraries that need aok

  This removes the circular dependency of libnvpair on libzfs / libzpool.

  PR:		199811
  Obtained from:	bapt
  MFC after:	23 days

Changes:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
  head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
Comment 3 Andriy Gapon freebsd_committer freebsd_triage 2015-10-23 08:06:42 UTC
base r289805
base r289806
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-12-23 04:36:32 UTC
A commit references this bug:

Author: ngie
Date: Wed Dec 23 04:36:16 UTC 2015
New revision: 292643
URL: https://svnweb.freebsd.org/changeset/base/292643

Log:
  MFC r282122,r285339,r288340:

  r282122 (by avg):

  nvpair_type_is_array: DATA_TYPE_INT8_ARRAY was not recognized

  To do:	upstream (https://www.illumos.org/issues/5778)

  r285339 (by oshogbo):

  Rename zfs nvpair files to not colidate with our nvlist.

  PR:		201356
  Approved by:	pjd (mentor)

  r288340 (by avg):

  define aok in libnvpair which is linked to all zfs libraries that need aok

  This removes the circular dependency of libnvpair on libzfs / libzpool.

  PR:		199811
  Obtained from:	bapt

Changes:
_U  user/ngie/stable-10-libnv/
  user/ngie/stable-10-libnv/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  user/ngie/stable-10-libnv/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
  user/ngie/stable-10-libnv/cddl/lib/libnvpair/Makefile
  user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/fnvpair.c
  user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c
  user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/nvpair_alloc_fixed.c
  user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c
  user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
  user/ngie/stable-10-libnv/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair_alloc_fixed.c
  user/ngie/stable-10-libnv/sys/conf/files
  user/ngie/stable-10-libnv/sys/modules/zfs/Makefile