Bug 46162 - Last pkgtools & libchk produce strange paths to libraries in /usr/X11R6
Summary: Last pkgtools & libchk produce strange paths to libraries in /usr/X11R6
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Akinori MUSHA
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-10 11:20 UTC by lev
Modified: 2002-12-17 18:47 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lev 2002-12-10 11:20:02 UTC
   Last pkgtools & libchk (sysutils/portupgrade, sysutils/libchk) produce strange paths to libraries in /usr/X11R6:

  `pkgclean -Li' and `libchk' add second slash to library paths.
  Here is output of `libchk -v' (not full, of course):

==========================================================
Binaries that are linked with: /usr/X11R6/lib//libICE.so.6
        /usr/X11R6/bin/AbiWord_d
==========================================================

  And here is one of MANY warnings of `portsclean -Li':

==============================================================================
** /usr/X11R6/lib//libguppi.so.16 is shadowed by /usr/X11R6/lib/libguppi.so.16
        /usr/X11R6/lib/libguppi.so.16   <- guppi-0.40.3_2
        /usr/X11R6/lib//libguppi.so.16  <- guppi-0.40.3_2
 --> Two packages install the same library in different directories!
==============================================================================

  It seems, that it is not problem of my package database (/var/db/pkg) or linker,
  because `ldd /usr/X11R6/bin/AbiWord_d | grep '//'' and
  `cat /var/db/pkg/guppi-0.40.3_2/+CONTENTS | grep '//'' shows nothing
Comment 1 Tilman Keskinoz freebsd_committer freebsd_triage 2002-12-10 16:25:05 UTC
Responsible Changed
From-To: freebsd-ports->knu

Over to Maintainer
Comment 2 Akinori MUSHA 2002-12-11 04:49:18 UTC
At Tue, 10 Dec 2002 14:19:27 +0300 (MSK),
Lev A. Serebryakov wrote:
>   It seems, that it is not problem of my package database (/var/db/pkg) or linker,
>   because `ldd /usr/X11R6/bin/AbiWord_d | grep '//'' and
>   `cat /var/db/pkg/guppi-0.40.3_2/+CONTENTS | grep '//'' shows nothing

libchk and portsclean don't use ldd(1), and they take care of
sequences of /'s in +CONTENTS (actually it's read through
pkg_info(1)), so these two are irrelevant to the problem.

I guess the problem is ldconfig(1).  Run 'ldconfig -r' and if it
produces sequences of /'s, try these patches:

For libchk:

Index: libchk.rb
===================================================================
RCS file: /home/cvs/libchk/libchk.rb,v
retrieving revision 1.6
diff -u -u -u -r1.6 libchk.rb
--- libchk.rb	3 Sep 2002 13:31:56 -0000	1.6
+++ libchk.rb	11 Dec 2002 04:42:16 -0000
@@ -226,6 +226,9 @@
     when %r"^\d+:-l.*\s+=>\s+(/.*/([^/]+))"
       path, filename = $1, $2
 
+      # handle sequences of /'s (tr_s is not multibyte-aware, hence gsub)
+      path.gsub!(%r"//+", '/')
+
       libtable[filename] = path
     end
   }

For portsclean:

Index: libchk.rb
===================================================================
RCS file: /home/cvs/libchk/libchk.rb,v
retrieving revision 1.6
diff -u -u -u -r1.6 libchk.rb
--- libchk.rb	3 Sep 2002 13:31:56 -0000	1.6
+++ libchk.rb	11 Dec 2002 04:42:16 -0000
@@ -226,6 +226,9 @@
     when %r"^\d+:-l.*\s+=>\s+(/.*/([^/]+))"
       path, filename = $1, $2
 
+      # handle sequences of /'s (tr_s is not multibyte-aware, hence gsub)
+      path.gsub!(%r"//+", '/')
+
       libtable[filename] = path
     end
   }


-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"I believe in what I see, I believe in what I hear,
   I believe that what I'm feeling changes how the world appears."
Comment 3 Akinori MUSHA 2002-12-11 04:54:42 UTC
At Tue, 10 Dec 2002 20:50:03 -0800 (PST),
I wrote:
>  libchk and portsclean don't use ldd(1), and they take care of
>  sequences of /'s in +CONTENTS (actually it's read through
>  pkg_info(1)), so these two are irrelevant to the problem.
                             ^cases

>  For portsclean:

I put the wrong patch.  Use this one:

Index: portsclean
===================================================================
RCS file: /home/cvs/pkgtools/bin/portsclean,v
retrieving revision 1.53
diff -u -u -u -r1.53 portsclean
--- portsclean	7 Dec 2002 21:30:09 -0000	1.53
+++ portsclean	11 Dec 2002 04:49:37 -0000
@@ -299,7 +299,7 @@
 
   compatlib_re = /^#{Regexp.quote(compatlibdir)}/
 
-  ld_entry_re = %r"^\d+:-l.*\s+=>\s+(((#{Regexp.quote(localbase)}|#{Regexp.quote(x11base)})?/.*)/lib([^/]+)\.so\.(\d+))"
+  libpath_re = %r"^((#{Regexp.quote(localbase)}|#{Regexp.quote(x11base)})?/.*)/lib([^/]+)\.so\.(\d+)$"	#"
 
   libtable = {}
 
@@ -309,8 +309,15 @@
     case line
     when /^search directories:\s*(.*)/
       libdirs = $1.split(':')
-    when ld_entry_re
-      path, dir, prefix, libname, ver = $~[1..-1]
+    when /^\d+:-l.*\s+=>\s+(\/.*)/
+      path = $1
+
+      # handle sequences of /'s (tr_s is not multibyte-aware, hence gsub)
+      path.gsub!(%r"//+", '/')
+
+      libpath_re =~ path or next
+
+      dir, prefix, libname, ver = $~[1..-1]
 
       pkgname = $pkgdb.which(path)
 

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"I believe in what I see, I believe in what I hear,
   I believe that what I'm feeling changes how the world appears."
Comment 4 Giorgos Keramidas freebsd_committer freebsd_triage 2002-12-14 23:05:55 UTC
Adding to audit trail:
:
: Message-Id: <86d6o995dg.wl@archon.local.idaemons.org>
: Date: Wed, 11 Dec 2002 01:59:55 +0900
: From: "Akinori MUSHA" <knu@iDaemons.org>
:
: At Tue, 10 Dec 2002 14:19:27 +0300 (MSK),
: Lev A. Serebryakov wrote:
: >   It seems, that it is not problem of my package database (/var/db/pkg) or linker,
: >   because `ldd /usr/X11R6/bin/AbiWord_d | grep '//'' and
: >   `cat /var/db/pkg/guppi-0.40.3_2/+CONTENTS | grep '//'' shows nothing
:
: Neither libchk nor portsclean uses ldd(1) or directly looks into
: +CONTENTS anyway.  The problem will be somewhere else.
Comment 5 Akinori MUSHA freebsd_committer freebsd_triage 2002-12-16 06:05:43 UTC
State Changed
From-To: open->feedback

Pending feedback from the submitter.
Comment 6 lev 2002-12-16 08:23:01 UTC
Hello, freebsd-gnats-submit! How are you?

  (1) ldconfig -r | grep // show nothing
  (2) I had power-down at my place, and after it problem dissapear...
      It is very strange, but even not-patched portsclean and libchk
      works fine now. BUT! power-down (I don't have UPS :( ) corrupt
      slightly `/var' filesystem and I've rebuild pkgdb.db from
      scratches. May be database was corrupted before?

   So, here is no problem now.

               Lev Serebryakov
/-----------------------------------------------\
| FIDONet: 2:5030/661.0                         |
| E-Mail:  lev@serebryakov.spb.ru               | 
| Page:    http://lev.serebryakov.spb.ru/       |
| ICQ UIN: 3670018                              |
| Phone:   You know, if you have world nodelist |
\===============================================/
Comment 7 Akinori MUSHA 2002-12-16 08:36:59 UTC
At Mon, 16 Dec 2002 00:30:04 -0800 (PST),
Lev Serebryakov wrote:
>    (1) ldconfig -r | grep // show nothing
>    (2) I had power-down at my place, and after it problem dissapear...
>        It is very strange, but even not-patched portsclean and libchk
>        works fine now. BUT! power-down (I don't have UPS :( ) corrupt
>        slightly `/var' filesystem and I've rebuild pkgdb.db from
>        scratches. May be database was corrupted before?

My guess is that one of the ldconfig search directories might have had
a trailing / and that produced double / paths.  I tweaked libchk and
portsclean to trim trailing /'s if any.  Stay tuned for the next
releases.

>     So, here is no problem now.

Thanks for your help.

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"I believe in what I see, I believe in what I hear,
   I believe that what I'm feeling changes how the world appears."
Comment 8 Akinori MUSHA freebsd_committer freebsd_triage 2002-12-17 18:46:56 UTC
State Changed
From-To: feedback->closed

Fixed in the latest versions of portupgrade and libchk.  Thanks.