Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 877371 - app-text/opensp-1.5.2-r7: does not require net-libs/libnsl
Summary: app-text/opensp-1.5.2-r7: does not require net-libs/libnsl
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Benda Xu
URL:
Whiteboard:
Keywords: NeedPatch
Depends on:
Blocks:
 
Reported: 2022-10-17 04:53 UTC by Jocelyn Mayer
Modified: 2022-12-18 14:31 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
output from emerge --info =app-text/opensp-1.5.2-r7 (emerge-info,23.34 KB, text/plain)
2022-10-17 04:53 UTC, Jocelyn Mayer
Details
output from emerge --info =app-text/opensp-1.5.2-r7 (emerge-info,23.28 KB, text/plain)
2022-10-19 06:38 UTC, Jocelyn Mayer
Details
output from emerge --info =app-text/opensp-1.5.2-r7 (emerge_infos,24.81 KB, text/plain)
2022-10-19 06:39 UTC, Jocelyn Mayer
Details
Ebuild patch to remove unused libnsl dependency (app-text_opensp_opensp-1.5.2-r7.ebuild.patch,1000 bytes, patch)
2022-10-19 06:40 UTC, Jocelyn Mayer
Details | Diff
Source code patch to remove unused libnsl dependency (opensp-1.5.2-inconditional_http.patch,1.36 KB, patch)
2022-10-19 06:40 UTC, Jocelyn Mayer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jocelyn Mayer 2022-10-17 04:53:14 UTC
app-text/opensp-1.5.2-r7 has net-libs/libnsl:0 in RDEPEND.
However, the configure script properly detect the absence of the library and do not try to link against it when not present.


Reproducible: Always

Steps to Reproduce:
1. Use a system without libnsl installed and / or without any NIS support
2. Build and use opensp
3.
Actual Results:  
Refuses to build when libnsl is not present

Expected Results:  
Should not block build on libnsl absence

--- app-text/opensp/opensp-1.5.2-r7.ebuild      2022-02-27 05:09:47.000000000 +0100
+++ app-text/opensp/opensp-1.5.2-r7.ebuild      2022-04-22 20:46:49.778429482 +0200
@@ -18,8 +18,6 @@
 IUSE="doc nls static-libs test"
 RESTRICT="!test? ( test )"
 
-RDEPEND="elibc_glibc? ( net-libs/libnsl:0= )"
-DEPEND="${RDEPEND}"
 BDEPEND="
        doc? (
                app-text/xmlto
Comment 1 Jocelyn Mayer 2022-10-17 04:53:57 UTC
Created attachment 824495 [details]
output from emerge --info =app-text/opensp-1.5.2-r7
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-17 04:59:29 UTC
The provided patch is insufficient. In the situation you described ("used when present), we call it an "automagic dependency" and we must either fix the build system or hard depend on the package to avoid breaking e.g binpkgs.
Comment 3 Jocelyn Mayer 2022-10-18 04:10:51 UTC
Sorry, I'm not sure to understand properly what you mean...
Would an additional USE flag and add the dependency on this flag to fix the issue you mention ?
After further investigation, I guess the configure script has some kind of problem: when libnsl, ie /usr/lib64/libnsl.so is not present, it uses /lib64/libnsl.so.1 provided by glibc.
As far as I understand from the package description, libnsl is used to provide IPv6 support to NIS.
Then, would an ipv6 USE flag addition would be a proper fix to add the libnsl dependency when needed ?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-19 02:58:55 UTC
(In reply to Jocelyn Mayer from comment #3)
> Sorry, I'm not sure to understand properly what you mean...

Give these a read:
- https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Automagic_dependencies
- https://flameeyes.blog/2010/07/01/ever-present-automagic-dependencies/

> Would an additional USE flag and add the dependency on this flag to fix the
> issue you mention ?

Yes -- the key part is that the USE flag has to pass something into the build system though.

> After further investigation, I guess the configure script has some kind of
> problem: when libnsl, ie /usr/lib64/libnsl.so is not present, it uses
> /lib64/libnsl.so.1 provided by glibc.

That's another issue, although not so much of a problem given we only support modern glibcs now.

> As far as I understand from the package description, libnsl is used to
> provide IPv6 support to NIS.
> Then, would an ipv6 USE flag addition would be a proper fix to add the
> libnsl dependency when needed ?

Yes - but with a patch to ensure the build system allows you to turn it off _even when libnsl is installed_ (as it may not be installed on a binpkg consumer, it could be installed purely by chance) - see above links, then let me know if have any questions.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-19 02:59:32 UTC
also, thanks for filing all these, they are valuable and trying to trim down the NIS stuff is particularly useful as a lot of it is cruft
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-19 03:00:04 UTC
(In reply to Sam James from comment #5)
> also, thanks for filing all these, they are valuable and trying to trim down
> the NIS stuff is particularly useful as a lot of it is cruft

.. one more thing: you might find "iwdevtools" useful for finding deps which should in fact be optional and so on: https://github.com/ionenwks/iwdevtools.
Comment 7 Jocelyn Mayer 2022-10-19 06:34:25 UTC
Thanks for those clarifications, I'll try to take care of this for now.
And, yes, it seems that the iwdevtools may help me to solve such problems.

For this particuliar case, it seems to me now that the configure system is quite broken: we have an optional --enable-http for the configure script though http support is not optional: the sources files referencing HTTP are compiled inconditionnaly, ie URLStorage.cxx and URLStorageMessages.h in lib/Makefile.am

Furtermore, on a system which has libnsl installed, it happens not to be used by opensp:
# ldd -d -r -u /usr/bin/osp*
/usr/bin/ospam:
Unused direct dependencies:
        /usr/lib64/libnsl.so.3
        /lib64/libm.so.6
/usr/bin/ospcat:
Unused direct dependencies:
        /usr/lib64/libnsl.so.3
        /lib64/libm.so.6
/usr/bin/ospent:
Unused direct dependencies:
        /usr/lib64/libnsl.so.3
        /lib64/libm.so.6
# ldd -d -r -u /usr/bin/osgmlnorm
Unused direct dependencies:
        /usr/lib64/libnsl.so.3
        /lib64/libm.so.6
# ldd -d -r -u /usr/bin/onsgmls 
Unused direct dependencies:
        /usr/lib64/libnsl.so.3
        /lib64/libm.so.6
# ldd -d -r -u /usr/bin/osx
Unused direct dependencies:
        /usr/lib64/libnsl.so.3
        /lib64/libm.so.6
# ldd -d -r -u /usr/lib64/libosp.so
Unused direct dependencies:
        /usr/lib64/libnsl.so.3
        /lib64/libm.so.6
And the only non-system library used (ie not glibc, libm, gcc libs, ...), ie libtirpc, is a libnsl dependency so there seem not to be indirect dependencies either.
I also did not find any reference to NIS in the code.

Then, I guess it's possible to remove:
1/ the --enable-http option as http support is always compiled
2/ the libnsl presence check from the configure script
3/ the libnsl dependency from the ebuild
4/ the --enable-http option given to econf
5/ always call eautoreconf during prepare phase

Unfortunately, autoreconf seems to break the tests/Makefile thus some kind of hack seems required during prepare phase so the tests run fine on a system without libnsl and on a system with it, with finally no link dependency on this library in the later case: I've been able to depclean it (and mask it for the future).

Hope this will make the trick...
Comment 8 Jocelyn Mayer 2022-10-19 06:38:02 UTC
Created attachment 824725 [details]
output from emerge --info =app-text/opensp-1.5.2-r7

Built with new patches on a system without libnsl installed
Comment 9 Jocelyn Mayer 2022-10-19 06:39:09 UTC
Created attachment 824727 [details]
output from emerge --info =app-text/opensp-1.5.2-r7

built with new patches on a system with libnsl installed, without using this library at last.
Comment 10 Jocelyn Mayer 2022-10-19 06:40:11 UTC
Created attachment 824729 [details, diff]
Ebuild patch to remove unused libnsl dependency
Comment 11 Jocelyn Mayer 2022-10-19 06:40:53 UTC
Created attachment 824731 [details, diff]
Source code patch to remove unused libnsl dependency
Comment 12 Jocelyn Mayer 2022-12-18 14:31:15 UTC
Ooops...
Reviewing my patches, the comment for the later ones are incorrect.
The purpose here is to remove --enable-http option as http is used unconditionally in lib/URLStorage.cxx