Rob Browning <
r...@defaultvalue.org> writes:
> Rob Browning <
r...@defaultvalue.org> writes:
>
>> So that's a real problem. I'll need to figure out why that's happening.
>> I added dev/shadow-bin to the front of the PATH so that we can't
>> accidentally run (and/or test) the locally installed bup. Might have
>> missed some places.
>
> Oh, wait - that was just the check of the check I added... Nevermind,
> should be fine. Maybe I'll add a bit of calmative output just before
> the test so future me won't do this again :)
I actually didn't mean to complain about the shadow check (even though I
didn't understand it). What I meant was that bup was dumping core and
the tests failed to run.
But, I figured it out. realpath(3) has a historical behavior from
4.4BSD, where the 2nd arg must be present and the output goes there.
POSIX added the option for it to be NULL and if so the output is
malloced. So NULL 2nd blew up, and when I passed a MAXPATHLEN array the
free blew up. I have adjusted the code to use the 4.4BSD approach,
which is also required by POSIX, and runs on my NetBSD 9 system (tests
in process but some have passed already).
I also need to mess with pytest and $@ because of some shell
differences, but I don't understand that yet, and it only affects tests.
Patch to follow shortly.
I'll let you know test results offlist if they are good, and raise them
here if not.
Here's the NetBSD 5 realpath:
----------------------------------------
REALPATH(3) NetBSD Library Functions Manual REALPATH(3)
NAME
realpath -- returns the canonicalized absolute pathname
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/param.h>
#include <stdlib.h>
char *
realpath(const char *pathname, char resolvedname[MAXPATHLEN]);
DESCRIPTION
The realpath() function resolves all symbolic links, extra ``/'' charac-
ters and references to /./ and /../ in pathname, and copies the resulting
absolute pathname into the memory referenced by resolvedname. The
resolvedname argument must refer to a buffer capable of storing at least
MAXPATHLEN characters.
The realpath() function will resolve both absolute and relative paths and
return the absolute pathname corresponding to pathname.
RETURN VALUES
The realpath() function returns resolvedname on success. If an error
occurs, realpath() returns NULL, and resolvedname contains the pathname
which caused the problem.
ERRORS
The function realpath() may fail and set the external variable errno for
any of the errors specified for the library functions chdir(2), close(2),
fchdir(2), lstat(2), open(2), readlink(2) and getcwd(3).
SEE ALSO
getcwd(3)
HISTORY
The realpath() function call first appeared in 4.4BSD.
BUGS
This implementation of realpath() differs slightly from the Solaris
implementation. The 4.4BSD version always returns absolute pathnames,
whereas the Solaris implementation will, under certain circumstances,
return a relative resolvedname when given a relative pathname.
NetBSD 5.2_STABLE August 13, 2005 NetBSD 5.2_STABLE