Subject: lib/30943: realpath() behaviour changed with nonexistant relative path
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Mark Davies <mark@mcs.vuw.ac.nz>
List: netbsd-bugs
Date: 08/08/2005 10:32:00
>Number:         30943
>Category:       lib
>Synopsis:       realpath() behaviour changed with nonexistant relative path
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 08 10:32:00 +0000 2005
>Originator:     Mark Davies
>Release:        NetBSD 3.99.7
>Organization:
Victoria University of Wellington
>Environment:
System: NetBSD lap2.home.vuw.ac.nz 3.99.7 NetBSD 3.99.7 (MCS_GEN_LAPTOP) #0: 
Thu Aug 4 14:07:55 NZST 2005 
mark@lap2.home.vuw.ac.nz:/mnt/SAVE/build.obj/mnt/src/src/sys/arch/i386/compile/MCS_GEN_LAPTOP 
i386
Architecture: i386
Machine: i386
>Description:
	Changes made to realpath() in July have changed its behaviour when given a
	non-existant relative path (such as "applications-merged/"). Its current
	behaviour not only differs from the previous NetBSD behaviour but also from
	that on Solaris and Linux and breaks its usage in KDE.
>How-To-Repeat:
	Compile and run the following program:

#include <sys/param.h>
#include <stdlib.h>
#include <stdio.h>

main()
{
  char foo[MAXPATHLEN];
  char *bar;

  bar = realpath("applications-merged/", foo);
  printf ("<%s><%s>\n", bar ? bar : "(null)", foo);
}

	On -current it produces:
</tmp/applications-merged></tmp/applications-merged>
	On NetBSD pre 1 July it produces:
<(null)></tmp/applications-merged>
	On Solaris 9:
<(null)><applications-merged/>
	On Linux (fedora 3)
<(null)></tmp/applications-merged>

>Fix:
	Unknown.