NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/55361: realpath(3) does not resolve magic symlinks



>Number:         55361
>Category:       lib
>Synopsis:       realpath(3) does not resolve magic symlinks
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 09 17:05:00 +0000 2020
>Originator:     Frank Kardel
>Release:        NetBSD 9.99.65
>Organization:
	
>Environment:
	
	
System: NetBSD test2 9.99.65 NetBSD 9.99.65 (GENERIC) #2: Tue Jun 9 01:58:38 CEST 2020 kardel@Andromeda:/src/NetBSD/cur/src/obj.amd64/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	realpath(3) does not replace the magic symlink variables when
	magic symlinks are enabled (vfs.generic.magicsymlinks=1).
	This leads to unexpected / hard to explain / hard to debug in build.sh runs as
	some realpath resolved paths are embedded in built tools.

Example (part of running multiple userlands match the current kernel version)
# sysctl vfs.generic.magiclinks
vfs.generic.magiclinks = 1
# uname -r
9.99.65
# ls -ld /usr
lrwxr-xr-x  1 root  wheel  14 May 13 11:50 /usr -> @osrelease/usr
# ls -l /@osrelease
lrwxr-xr-x  1 root  wheel  7 May 13 11:56 /@osrelease -> 8.99.24
# realpath /usr
/8.99.24/usr                   <= unexpected for magiclinks=1
# ( cd /usr && pwd )
/9.99.65/usr                   <= kernel correctly resolves the path

Thus realpath(3) and kernel disagree on the final path.

>How-To-Repeat:
	see above
>Fix:
	- put a warning/bug into realpath(3) manual about not coping with magiclinks
	- fix realpath(3) to pick up sysctl.generic.magiclinks and do
          the respective replacements if needed.

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index