summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2008-02-13 10:20:39 -0800
committerAaron Plattner <aplattner@nvidia.com>2008-02-13 10:20:39 -0800
commit7fd526bcfb5cc2d43230f5845b91fa92c819a66c (patch)
treea514e04e4fe9f1908144c6603149cecd986f2d7e
parent46eb90bcd7f3a3e9e7a5e5b2059bc1d6a3a87dca (diff)
100.14.19100.14.19
-rw-r--r--DRIVER_VERSION2
-rw-r--r--command-list.c35
-rw-r--r--command-list.h2
-rw-r--r--files.c119
-rw-r--r--install-from-cwd.c62
-rw-r--r--nvLegacy.h4
-rw-r--r--nvidia-installer.h16
7 files changed, 163 insertions, 77 deletions
diff --git a/DRIVER_VERSION b/DRIVER_VERSION
index 9fdda98..f1682d6 100644
--- a/DRIVER_VERSION
+++ b/DRIVER_VERSION
@@ -1 +1 @@
-100.14.11
+100.14.19
diff --git a/command-list.c b/command-list.c
index 963097b..21e4cb6 100644
--- a/command-list.c
+++ b/command-list.c
@@ -67,6 +67,8 @@ static void find_conflicting_kernel_modules(Options *op,
static void find_existing_files(Package *p, FileList *l, unsigned int);
+static void condense_file_list(Package *p, FileList *l);
+
static void add_command (CommandList *c, int cmd, ...);
static void add_file_to_list(const char*, const char*, FileList*);
@@ -183,7 +185,7 @@ CommandList *build_command_list(Options *op, Package *p)
/* condense the file list */
- condense_file_list(l);
+ condense_file_list(p, l);
/* check the conflicting file list for any installed files */
@@ -756,10 +758,10 @@ static void find_conflicting_libraries(Options *op,
* brute-force algorithm.
*/
-void condense_file_list(FileList *l)
+static void condense_file_list(Package *p, FileList *l)
{
char **s = NULL;
- int n = 0, i, j, match;
+ int n = 0, i, j, keep;
struct stat stat_buf, *stat_bufs;
@@ -781,12 +783,27 @@ void condense_file_list(FileList *l)
*/
for (i = 0; i < l->num; i++) {
- match = FALSE;
+ keep = TRUE;
if (lstat(l->filename[i], &stat_buf) == -1)
continue;
-
- for (j = 0; j < n; j++) {
+
+ /*
+ * check if this file is in the package we're trying to
+ * install; we don't want to remove files that are in the
+ * package; symlinks may have tricked us into looking for
+ * conflicting files inside our unpacked .run file.
+ */
+
+ for (j = 0; j < p->num_entries; j++) {
+ if ((p->entries[j].device == stat_buf.st_dev) &&
+ (p->entries[j].inode == stat_buf.st_ino)) {
+ keep = FALSE;
+ break;
+ }
+ }
+
+ for (j = 0; keep && (j < n); j++) {
/*
* determine if the two files are the same by comparing
@@ -795,12 +812,12 @@ void condense_file_list(FileList *l)
if ((stat_buf.st_dev == stat_bufs[j].st_dev) &&
(stat_buf.st_ino == stat_bufs[j].st_ino)) {
- match = TRUE;
+ keep = FALSE;
break;
}
}
-
- if (!match) {
+
+ if (keep) {
s = (char **) nvrealloc(s, sizeof(char *) * (n + 1));
s[n] = nvstrdup(l->filename[i]);
stat_bufs[n] = stat_buf;
diff --git a/command-list.h b/command-list.h
index 6b2d225..5e70a1e 100644
--- a/command-list.h
+++ b/command-list.h
@@ -83,6 +83,4 @@ CommandList *build_command_list(Options*, Package *);
void free_command_list(Options*, CommandList*);
int execute_command_list(Options*, CommandList*, const char*, const char*);
-void condense_file_list(FileList *l);
-
#endif /* __NVIDIA_INSTALLER_COMMAND_LIST_H__ */
diff --git a/files.c b/files.c
index 9c1afef..62ec6d4 100644
--- a/files.c
+++ b/files.c
@@ -873,35 +873,26 @@ int get_prefixes (Options *op)
int add_kernel_module_to_package(Options *op, Package *p)
{
- int n, len;
+ char *file, *name, *dst;
- n = p->num_entries;
-
- p->entries =
- (PackageEntry *) nvrealloc(p->entries, (n + 1) * sizeof(PackageEntry));
+ file = nvstrcat(p->kernel_module_build_directory, "/",
+ p->kernel_module_filename, NULL);
- len = strlen(p->kernel_module_build_directory) +
- strlen(p->kernel_module_filename) + 2;
- p->entries[n].file = (char *) nvalloc(len);
- snprintf(p->entries[n].file, len, "%s/%s",
- p->kernel_module_build_directory, p->kernel_module_filename);
-
- p->entries[n].path = NULL;
- p->entries[n].target = NULL;
- p->entries[n].flags = FILE_TYPE_KERNEL_MODULE;
- p->entries[n].mode = 0644;
-
- p->entries[n].name = strrchr(p->entries[n].file, '/');
- if (p->entries[n].name) p->entries[n].name++;
- if (!p->entries[n].name) p->entries[n].name = p->entries[n].file;
-
- len = strlen(op->kernel_module_installation_path) +
- strlen(p->kernel_module_filename) + 2;
- p->entries[n].dst = (char *) nvalloc(len);
- snprintf (p->entries[n].dst, len, "%s/%s",
- op->kernel_module_installation_path, p->kernel_module_filename);
-
- p->num_entries++;
+ name = strrchr(file, '/');
+ if (name) name++;
+ if (!name) name = file;
+
+ dst = nvstrcat(op->kernel_module_installation_path, "/",
+ p->kernel_module_filename, NULL);
+
+ add_package_entry(p,
+ file,
+ NULL, /* path */
+ name,
+ NULL, /* target */
+ dst,
+ FILE_TYPE_KERNEL_MODULE,
+ 0644);
return TRUE;
@@ -1710,7 +1701,7 @@ done:
void process_libGL_la_files(Options *op, Package *p)
{
- int i, n;
+ int i;
char *tmpfile;
char *tokens[3] = { "__LIBGL_PATH__", "__GENERATED_BY__", NULL };
@@ -1742,22 +1733,25 @@ void process_libGL_la_files(Options *op, Package *p)
if (tmpfile != NULL) {
/* add this new file to the package */
-
- n = p->num_entries;
-
- p->entries =
- (PackageEntry *) nvrealloc(p->entries,
- (n + 1) * sizeof(PackageEntry));
- p->entries[n].file = tmpfile;
- p->entries[n].path = p->entries[i].path;
- p->entries[n].target = NULL;
- p->entries[n].flags = ((p->entries[i].flags & FILE_CLASS_MASK)
- | FILE_TYPE_LIBGL_LA);
- p->entries[n].mode = p->entries[i].mode;
-
- p->entries[n].name = nvstrdup(p->entries[i].name);
-
- p->num_entries++;
+
+ /*
+ * XXX 'name' is the basename (non-directory part) of
+ * the file to be installed; normally, 'name' just
+ * points into 'file', but in this case 'file' is
+ * mkstemp(3)-generated, so doesn't have the same
+ * basename; instead, we just strdup the name from the
+ * template package entry; yes, 'name' will get leaked
+ */
+
+ add_package_entry(p,
+ tmpfile,
+ p->entries[i].path,
+ nvstrdup(p->entries[i].name),
+ NULL, /* target */
+ NULL, /* dst */
+ ((p->entries[i].flags & FILE_CLASS_MASK) |
+ FILE_TYPE_LIBGL_LA),
+ p->entries[i].mode);
}
nvfree(replacements[0]);
@@ -1779,7 +1773,7 @@ void process_libGL_la_files(Options *op, Package *p)
void process_dot_desktop_files(Options *op, Package *p)
{
- int i, n;
+ int i;
char *tmpfile;
char *tokens[3] = { "__UTILS_PATH__", "__PIXMAP_PATH__", NULL };
@@ -1815,22 +1809,25 @@ void process_dot_desktop_files(Options *op, Package *p)
replacements);
if (tmpfile != NULL) {
/* add this new file to the package */
-
- n = p->num_entries;
-
- p->entries =
- (PackageEntry *) nvrealloc(p->entries,
- (n + 1) * sizeof(PackageEntry));
- p->entries[n].file = tmpfile;
- p->entries[n].path = p->entries[i].path;
- p->entries[n].target = NULL;
- p->entries[n].flags = ((p->entries[i].flags & FILE_CLASS_MASK)
- | FILE_TYPE_DOT_DESKTOP);
- p->entries[n].mode = p->entries[i].mode;
-
- p->entries[n].name = nvstrdup(p->entries[i].name);
-
- p->num_entries++;
+
+ /*
+ * XXX 'name' is the basename (non-directory part) of
+ * the file to be installed; normally, 'name' just
+ * points into 'file', but in this case 'file' is
+ * mkstemp(3)-generated, so doesn't have the same
+ * basename; instead, we just strdup the name from the
+ * template package entry; yes, 'name' will get leaked
+ */
+
+ add_package_entry(p,
+ tmpfile,
+ p->entries[i].path,
+ nvstrdup(p->entries[i].name),
+ NULL, /* target */
+ NULL, /* dst */
+ ((p->entries[i].flags & FILE_CLASS_MASK) |
+ FILE_TYPE_DOT_DESKTOP),
+ p->entries[i].mode);
}
}
}
diff --git a/install-from-cwd.c b/install-from-cwd.c
index 17b8ac2..f32efcc 100644
--- a/install-from-cwd.c
+++ b/install-from-cwd.c
@@ -484,7 +484,7 @@ static Package *parse_manifest (Options *op)
char *buf, *c, *flag , *tmpstr;
int done, n, line;
int fd, ret, len = 0;
- struct stat stat_buf;
+ struct stat stat_buf, entry_stat_buf;
Package *p;
char *manifest = MAP_FAILED, *ptr;
@@ -760,7 +760,21 @@ static Package *parse_manifest (Options *op)
if (p->entries[n].name) p->entries[n].name++;
if (!p->entries[n].name) p->entries[n].name = p->entries[n].file;
-
+
+ /*
+ * store the inode and device information, so that we can
+ * later recognize it, to avoid accidentally moving it as
+ * part of the 'find_conflicting_files' path
+ */
+
+ if (stat(p->entries[n].file, &entry_stat_buf) != -1) {
+ p->entries[n].inode = entry_stat_buf.st_ino;
+ p->entries[n].device = entry_stat_buf.st_dev;
+ } else {
+ p->entries[n].inode = 0;
+ p->entries[n].device = 0;
+ }
+
/* free the line */
free(buf);
@@ -796,6 +810,50 @@ static Package *parse_manifest (Options *op)
/*
+ * add_package_entry() - add a PackageEntry to the package's entries
+ * array.
+ */
+
+void add_package_entry(Package *p,
+ char *file,
+ char *path,
+ char *name,
+ char *target,
+ char *dst,
+ unsigned int flags,
+ mode_t mode)
+{
+ int n;
+ struct stat stat_buf;
+
+ n = p->num_entries;
+
+ p->entries =
+ (PackageEntry *) nvrealloc(p->entries, (n + 1) * sizeof(PackageEntry));
+
+ p->entries[n].file = file;
+ p->entries[n].path = path;
+ p->entries[n].name = name;
+ p->entries[n].target = target;
+ p->entries[n].dst = dst;
+ p->entries[n].flags = flags;
+ p->entries[n].mode = mode;
+
+ if (stat(p->entries[n].file, &stat_buf) != -1) {
+ p->entries[n].inode = stat_buf.st_ino;
+ p->entries[n].device = stat_buf.st_dev;
+ } else {
+ p->entries[n].inode = 0;
+ p->entries[n].device = 0;
+ }
+
+ p->num_entries++;
+
+} /* add_package_entry() */
+
+
+
+/*
* free_package() - free the Package data structure
*/
diff --git a/nvLegacy.h b/nvLegacy.h
index 9fb21fe..cc41cca 100644
--- a/nvLegacy.h
+++ b/nvLegacy.h
@@ -26,8 +26,8 @@ typedef struct _LEGACY_STRINGS {
* This table describes how we should refer to legacy branches.
*/
static const LEGACY_STRINGS LegacyStrings[] = {
- { 2, "1.0-96xx" },
- { 1, "1.0-71xx" }
+ { 2, "96.43.xx" },
+ { 1, "71.86.xx" }
};
// This is the list of the legacy GPUs
diff --git a/nvidia-installer.h b/nvidia-installer.h
index 9d40a70..f2a8569 100644
--- a/nvidia-installer.h
+++ b/nvidia-installer.h
@@ -224,6 +224,14 @@ typedef struct __package_entry {
unsigned int flags;
mode_t mode;
+ ino_t inode;
+ dev_t device; /*
+ * inode of the file after extraction from the
+ * package; this is needed to compare against the
+ * files on the user's system that we consider for
+ * removal, so that symlink loops don't confuse us
+ * into deleting the files from the package.
+ */
} PackageEntry;
@@ -472,6 +480,14 @@ void log_printf(Options *op, const int wb,
int install_from_cwd(Options *op);
int add_this_kernel(Options *op);
+void add_package_entry(Package *p,
+ char *file,
+ char *path,
+ char *name,
+ char *target,
+ char *dst,
+ unsigned int flags,
+ mode_t mode);
/* XXX */
typedef TextRows *(*FormatTextRows)(const char*, const char*, int, int);