Re: Fixing pkg_add Fatal error: can't parse object version error after 4.9 upgrade

2011-06-08 Thread Marc Espie
On Tue, Jun 07, 2011 at 11:57:42AM -0700, yary wrote:
 I have installed my own build of perl into /usr/local which might be
 the cause- though it can also happen with the system perl, All one has
 to do is install a binary/XS version of a library that system perl has
 a non-binary version of, in a directory that the system perl uses.

Don't do that. No, it can't happen with the system perl, we control that.



Re: Fixing pkg_add Fatal error: can't parse object version error after 4.9 upgrade

2011-06-08 Thread yary
On Tue, Jun 07, 2011 at 11:57:42AM -0700, yary wrote:
 I have installed my own build of perl into /usr/local which might be
 the cause- though it can also happen with the system perl, All one has
 to do is install a binary/XS version of a library that system perl has
 a non-binary version of, in a directory that the system perl uses.

 Ariane van der Steldt wrote:
Don't do that. No, it can't happen with the system perl, we control that.

It happens, though I'm not sure why or how to prevent it.

Note that in 4.9 the system perl looks in some /usr/local directories
before /usr/libdata -

$ /usr/bin/perl -e 'print join \n,@INC'
/usr/local/libdata/perl5/site_perl/i386-openbsd
/usr/libdata/perl5/site_perl/i386-openbsd
/usr/local/libdata/perl5/site_perl
/usr/libdata/perl5/site_perl
/usr/libdata/perl5/i386-openbsd/5.12.2
/usr/local/libdata/perl5/i386-openbsd/5.12.2
/usr/libdata/perl5
/usr/local/libdata/perl5

The right way to fix this is to have all the /usr/libdata paths before
any /usr/local paths in the system perl's @INC. Order them like so:

/usr/libdata/perl5/site_perl/i386-openbsd
/usr/libdata/perl5/site_perl
/usr/libdata/perl5/i386-openbsd/5.12.2
/usr/libdata/perl5
/usr/local/libdata/perl5/site_perl/i386-openbsd
/usr/local/libdata/perl5/site_perl
/usr/local/libdata/perl5/i386-openbsd/5.12.2
/usr/local/libdata/perl5


Here's a scenario- and I don't have a 4.8 system to test it on, just
from memory-

In OpenBSD 4.8, using only the system perl, install the XS version of
Digest::SHA. OBSD 4.8 uses perl 5.10. This isn't so farfetched. Even
if 4.8 comes with a binary Digest::SHA, it may have an update that you
want.

Perl decides to put it under /usr/local/libdata/perl5/site_perl/i386-openbsd/

Upgrade the same machine to OpenBSD 4.9. It uses perl 5.12 which is
not binary-compatible with perl 5.10

Now any system utilities that use Digest::SHA will get the version in
/usr/local/libdata/perl5/site_perl/i386-openbsd , at the top of @INC.

Not sure if that's what happened to me (or the other poster at
http://comments.gmane.org/gmane.os.openbsd.misc/185763 ) but it's my
most plausible guess



Fixing pkg_add Fatal error: can't parse object version error after 4.9 upgrade

2011-06-07 Thread yary
Hi,

I saw another message about getting a perl error 'Fatal error: can't
parse  object version... after an upgrade to 4.9, and have a fix and
an explanation.

Fix: add this line:

  no lib qw(/usr/local/libdata/perl5
/usr/local/libdata/perl5/i386-openbsd/5.12.2
/usr/local/libdata/perl5/site_perl
/usr/local/libdata/perl5/site_perl/i386-openbsd);

 to the start of these libs, near the package declaration:

  /usr/libdata/perl5/OpenBSD/Error.pm
  /usr/libdata/perl5/OpenBSD/Paths.pm

Explanation: In a /usr/local directory is a shared library from a
different version of perl- Digest::SHA- and it's a binary (aka XS or
.so) version.

I have installed my own build of perl into /usr/local which might be
the cause- though it can also happen with the system perl, All one has
to do is install a binary/XS version of a library that system perl has
a non-binary version of, in a directory that the system perl uses.

System perl programs only need libraries in these directories, which
yo probably will never install anything into-
/usr/libdata/perl5
/usr/libdata/perl5/i386-openbsd/5.12.2
/usr/libdata/perl5/site_perl
/usr/libdata/perl5/site_perl/i386-openbsd

My no lib solution tells systerm Perl programs to ignore the
/usr/local perl libraries. Not sure if those two modules cover all
system perl programs, but it works for the pkg_* ones for sure.

-y