Subject: pkg/21863: wrong x11-links symlinks with LOCALBASE=/usr
To: None <gnats-bugs@gnats.netbsd.org>
From: None <reed@reedmedia.net>
List: netbsd-bugs
Date: 06/11/2003 15:19:05
>Number:         21863
>Category:       pkg
>Synopsis:       wrong x11-links symlinks with LOCALBASE=/usr
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 11 22:20:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.6
>Organization:
http://bsd.reedmedia.net/
>Environment:
	
	
System: NetBSD rainier.reedmedia.net 1.6 NetBSD 1.6 (JCR-20020927) #3: Sat Sep 28 13:40:20 PDT 2002 reed@rainier.reedmedia.net:/usr/src/sys/arch/i386/compile/JCR-20020927 i386
Architecture: i386
Machine: i386
>Description:
mk/buildlink2/bsd.buildlink2.mk puts the x11-links in place with:
${_PKG_SILENT}${_PKG_DEBUG}${CP} -R ${_BLNK_X11_DIR}/* ${BUILDLINK_X11_DIR}


$ ls -l work/.buildlink/include/X11/Intrinsic.h 
lrwxrwxrwx    1 reed     reed           41 Jun 11 14:31 work/.buildlink/include/X11/Intrinsic.h -> ../../../../X11R6/include/X11/Intrinsic.h

$ ls -l /usr/share/x11-links/include/X11/Intrinsic.h 
lrwxrwxrwx    1 root     root           41 Jun  7 21:28 /usr/share/x11-links/include/X11/Intrinsic.h -> ../../../../X11R6/include/X11/Intrinsic.h

$ cd /usr/share/x11-links/include/X11/
$ ls -l ../../../../X11R6/include/X11/Intrinsic.h
-r--r--r--    1 root     root        73241 Mar 25 07:38 ../../../../X11R6/include/X11/Intrinsic.h


So the problem is that the links have relative path (../../../../).

When pkgtools/x11-links is installed in first place, it is temporarily
correct until:
Full pathname symlink ... is target of ... adjusting to ...

(This is done in CheckSymlink() of pkg_install's create.pl.c)

My LOCALBASE is /usr. I am doing this under Linux.

Some of my old emails about this:
http://mail-index.netbsd.org/tech-pkg/2003/04/01/0001.html 
http://mail-index.netbsd.org/tech-pkg/2002/11/26/0024.html
>How-To-Repeat:
Attempt to build x11/rxvt when LOCALBASE=/usr.

 In file included from rxvt.c:1:
 rxvtlib.h:46:73: X11/Intrinsic.h: No such file or directory

(This is not an rxvt issue; this happens with packages needing x11-links.)

>Fix:
	
Maybe patch pkg_install/create/pl.c so if cwd is /usr then ignore.

If this adjusting pathname symlinks is really important then keep it,
but make it so that mk/buildlink2/bsd.buildlink2.mk does the right thing,
but just creating symlinks or copies the target of the file itself.

My work-around for several months is to make the symlinks using
GNU cp -s switch.
>Release-Note:
>Audit-Trail:
>Unformatted: