Remove support for absolutes pathnames completely. This can't work with

binary packages like we support them now.
This commit is contained in:
tron 1999-05-30 16:08:23 +00:00
parent 01849b81ca
commit 343ac4c964
5 changed files with 25 additions and 62 deletions

View File

@ -1,11 +1,11 @@
/* $NetBSD: extract.c,v 1.17 1999/05/29 20:44:20 christos Exp $ */
/* $NetBSD: extract.c,v 1.18 1999/05/30 16:08:23 tron Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp";
#else
__RCSID("$NetBSD: extract.c,v 1.17 1999/05/29 20:44:20 christos Exp $");
__RCSID("$NetBSD: extract.c,v 1.18 1999/05/30 16:08:23 tron Exp $");
#endif
#endif
@ -69,10 +69,7 @@ rollback(char *name, char *home, plist_t *start, plist_t *stop)
dir = home;
for (q = start; q != stop; q = q->next) {
if (q->type == PLIST_FILE) {
if (q->name[0] == '/')
snprintf(try, FILENAME_MAX, "%s", q->name);
else
snprintf(try, FILENAME_MAX, "%s/%s", dir, q->name);
snprintf(try, FILENAME_MAX, "%s/%s", dir, q->name);
if (make_preserve_name(bup, FILENAME_MAX, name, try) && fexists(bup)) {
(void)chflags(try, 0);
(void)unlink(try);
@ -143,12 +140,8 @@ extract_plist(char *home, package_t *pkg)
case PLIST_FILE:
last_file = p->name;
if (Verbose) {
if (p->name[0] == '/')
printf("extract: %s\n", p->name);
else
printf("extract: %s/%s\n", Directory, p->name);
}
if (Verbose)
printf("extract: %s/%s\n", Directory, p->name);
if (!Fake) {
char try[FILENAME_MAX];
@ -158,10 +151,7 @@ extract_plist(char *home, package_t *pkg)
}
/* first try to rename it into place */
if (p->name[0] == '/')
snprintf(try, FILENAME_MAX, "%s", p->name);
else
snprintf(try, FILENAME_MAX, "%s/%s", Directory, p->name);
snprintf(try, FILENAME_MAX, "%s/%s", Directory, p->name);
if (fexists(try)) {
(void)chflags(try, 0); /* XXX hack - if truly immutable, rename fails */
if (preserve && PkgName) {
@ -181,17 +171,12 @@ extract_plist(char *home, package_t *pkg)
if (rename(p->name, try) == 0) {
/* note in pkgdb */
{
char *s, t[FILENAME_MAX], *u;
char *s, t[FILENAME_MAX];
int rc;
if (p->name[0] == '/')
u=p->name;
else {
snprintf(t, FILENAME_MAX, "%s/%s", Directory, p->name);
u=t;
}
snprintf(t, FILENAME_MAX, "%s/%s", Directory, p->name);
s=pkgdb_retrieve(u);
s=pkgdb_retrieve(t);
#ifdef PKGDB_DEBUG
printf("pkgdb_retrieve(\"%s\")=\"%s\"\n", t, s); /* pkgdb-debug - HF */
#endif

View File

@ -1,8 +1,8 @@
/* $NetBSD: main.c,v 1.4 1999/05/29 20:44:21 christos Exp $ */
/* $NetBSD: main.c,v 1.5 1999/05/30 16:08:24 tron Exp $ */
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: main.c,v 1.4 1999/05/29 20:44:21 christos Exp $");
__RCSID("$NetBSD: main.c,v 1.5 1999/05/30 16:08:24 tron Exp $");
#endif
/*
@ -84,10 +84,7 @@ static void check1pkg(const char *pkgdir)
abort();
}
if (p->name[0] == '/')
snprintf(file, FILENAME_MAX, "%s", p->name);
else
snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name);
snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name);
if (!isfile(file))
warnx("%s: File %s is in %s but not on filesystem!", PkgName, file, CONTENTS_FNAME);
@ -211,10 +208,7 @@ static void rebuild(void)
abort();
}
if (p->name[0] == '/')
snprintf(file, FILENAME_MAX, "%s", p->name);
else
snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name);
snprintf(file, FILENAME_MAX, "%s/%s", dirp, p->name);
if (!isfile(file))
warnx("%s: File %s is in %s but not on filesystem!",

View File

@ -1,11 +1,11 @@
/* $NetBSD: pl.c,v 1.12 1999/05/29 20:44:21 christos Exp $ */
/* $NetBSD: pl.c,v 1.13 1999/05/30 16:08:25 tron Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: pl.c,v 1.11 1997/10/08 07:46:35 charnier Exp";
#else
__RCSID("$NetBSD: pl.c,v 1.12 1999/05/29 20:44:21 christos Exp $");
__RCSID("$NetBSD: pl.c,v 1.13 1999/05/30 16:08:25 tron Exp $");
#endif
#endif
@ -139,16 +139,11 @@ check_list(char *home, package_t *pkg, const char *PkgName)
* starts, it's ok to do this somewhere here
*/
{
char *s, t[FILENAME_MAX], *u;
char *s, t[FILENAME_MAX];
if (p->name[0] == '/')
u=p->name;
else {
snprintf(t, FILENAME_MAX, "%s/%s", cwd, p->name);
u=t;
}
snprintf(t, FILENAME_MAX, "%s/%s", cwd, p->name);
s=pkgdb_retrieve(u);
s=pkgdb_retrieve(t);
#ifdef PKGDB_DEBUG
fprintf(stderr, "pkgdb_retrieve(\"%s\")=\"%s\"\n", t, s); /* pkgdb-debug - HF */
#endif
@ -163,12 +158,7 @@ check_list(char *home, package_t *pkg, const char *PkgName)
}
}
if (p->name[0] == '/')
(void) snprintf(name, sizeof(name), "%s",
p->name);
else
(void) snprintf(name, sizeof(name), "%s/%s",
srcdir ? srcdir : cwd, p->name);
(void) snprintf(name, sizeof(name), "%s/%s", srcdir ? srcdir : cwd, p->name);
if (lstat(name, &st) < 0) {
warnx("can't stat `%s'", name);
continue;

View File

@ -1,11 +1,11 @@
/* $NetBSD: show.c,v 1.14 1999/05/29 20:44:22 christos Exp $ */
/* $NetBSD: show.c,v 1.15 1999/05/30 16:08:25 tron Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp";
#else
__RCSID("$NetBSD: show.c,v 1.14 1999/05/29 20:44:22 christos Exp $");
__RCSID("$NetBSD: show.c,v 1.15 1999/05/30 16:08:25 tron Exp $");
#endif
#endif
@ -213,10 +213,7 @@ show_files(char *title, package_t *plist)
switch(p->type) {
case PLIST_FILE:
if (!ign) {
if (p->name[0] == '/')
printf("%s\n", p->name);
else
printf("%s/%s\n", dir, p->name);
printf("%s/%s\n", dir, p->name);
}
ign = FALSE;
break;

View File

@ -1,11 +1,11 @@
/* $NetBSD: plist.c,v 1.19 1999/05/29 20:44:22 christos Exp $ */
/* $NetBSD: plist.c,v 1.20 1999/05/30 16:08:26 tron Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
#else
__RCSID("$NetBSD: plist.c,v 1.19 1999/05/29 20:44:22 christos Exp $");
__RCSID("$NetBSD: plist.c,v 1.20 1999/05/30 16:08:26 tron Exp $");
#endif
#endif
@ -339,10 +339,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg)
case PLIST_FILE:
last_file = p->name;
if (p->name[0] == '/')
(void) snprintf(tmp, sizeof(tmp), p->name);
else
(void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name);
(void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name);
if (isdir(tmp)) {
warnx("attempting to delete directory `%s' as a file\n"
"this packing list is incorrect - ignoring delete request", tmp);