summaryrefslogtreecommitdiff
path: root/sys-fs
diff options
context:
space:
mode:
authorStuart Herbert <stuart@gentoo.org>2004-12-18 21:20:05 +0000
committerStuart Herbert <stuart@gentoo.org>2004-12-18 21:20:05 +0000
commite9c81a113baf24ddc8af07f51291525a1c84139f (patch)
tree875c60c051ffefa67b1a1e6674e9077eb826bb10 /sys-fs
parent#65572 (diff)
downloadgentoo-2-e9c81a113baf24ddc8af07f51291525a1c84139f.tar.gz
gentoo-2-e9c81a113baf24ddc8af07f51291525a1c84139f.tar.bz2
gentoo-2-e9c81a113baf24ddc8af07f51291525a1c84139f.zip
Updated unlink patch
Diffstat (limited to 'sys-fs')
-rw-r--r--sys-fs/copyfs/ChangeLog6
-rw-r--r--sys-fs/copyfs/Manifest6
-rw-r--r--sys-fs/copyfs/copyfs-1.0.ebuild4
-rw-r--r--sys-fs/copyfs/files/copyfs-1.0-unlink.patch125
4 files changed, 102 insertions, 39 deletions
diff --git a/sys-fs/copyfs/ChangeLog b/sys-fs/copyfs/ChangeLog
index f728e8ca5b30..f65c583231af 100644
--- a/sys-fs/copyfs/ChangeLog
+++ b/sys-fs/copyfs/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for sys-fs/copyfs
# Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/copyfs/ChangeLog,v 1.1 2004/12/16 22:21:34 stuart Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/copyfs/ChangeLog,v 1.2 2004/12/18 21:20:05 stuart Exp $
+
+ 18 Dec 2004; Stuart Herbert <stuart@gentoo.org>
+ files/copyfs-1.0-unlink.patch:
+ Updated the unlink patch to prevent it leaking memory
*copyfs-1.0 (16 Dec 2004)
diff --git a/sys-fs/copyfs/Manifest b/sys-fs/copyfs/Manifest
index 0c81769a6224..5ae111eb5f33 100644
--- a/sys-fs/copyfs/Manifest
+++ b/sys-fs/copyfs/Manifest
@@ -1,6 +1,6 @@
-MD5 a6cf703e3aaf237dae6065a4c68e40a2 ChangeLog 397
-MD5 cc8fdbc927e570d3cf2b4c60f6a099b1 copyfs-1.0.ebuild 949
+MD5 7e76c6f4e1763e1d174d4df0d26b5224 ChangeLog 537
+MD5 18f351358a857d400149146c916c3927 copyfs-1.0.ebuild 949
MD5 71da003bb2109fed15aff6635287c6a6 metadata.xml 222
MD5 c05721e998e3acccd0813319c8e08dfd files/digest-copyfs-1.0 62
MD5 5ec647183c280e2dbed2a9f03d5d5776 files/copyfs-1.0-gentoo.patch 1330
-MD5 1902efbf4abea16617145fe1d8cb2963 files/copyfs-1.0-unlink.patch 2833
+MD5 d0f37bf52fe97fab73a0f7c0cefafb62 files/copyfs-1.0-unlink.patch 4412
diff --git a/sys-fs/copyfs/copyfs-1.0.ebuild b/sys-fs/copyfs/copyfs-1.0.ebuild
index 29391c413db7..1bab6916d21d 100644
--- a/sys-fs/copyfs/copyfs-1.0.ebuild
+++ b/sys-fs/copyfs/copyfs-1.0.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/copyfs/copyfs-1.0.ebuild,v 1.2 2004/12/16 22:24:39 stuart Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/copyfs/copyfs-1.0.ebuild,v 1.3 2004/12/18 21:20:05 stuart Exp $
inherit eutils
DESCRIPTION="fuse-based filesystem for maintaining configuration files"
@@ -8,7 +8,7 @@ HOMEPAGE="http://invaders.mars-attacks.org/~boklm/copyfs/"
SRC_URI="${HOMEPAGE}/${P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
-KEYWORDS="-x86"
+KEYWORDS="~x86"
IUSE=""
#RESTRICT="nostrip"
DEPEND=">=sys-fs/fuse-2.0
diff --git a/sys-fs/copyfs/files/copyfs-1.0-unlink.patch b/sys-fs/copyfs/files/copyfs-1.0-unlink.patch
index c63f7cc29715..9e6614f54271 100644
--- a/sys-fs/copyfs/files/copyfs-1.0-unlink.patch
+++ b/sys-fs/copyfs/files/copyfs-1.0-unlink.patch
@@ -1,25 +1,21 @@
+Only in copyfs-1.0: Makefile
diff -u --recursive copyfs-1.0-orig/cache.c copyfs-1.0/cache.c
---- copyfs-1.0-orig/cache.c 2004-12-16 21:07:38.953286336 +0000
-+++ copyfs-1.0/cache.c 2004-12-16 22:00:40.158056066 +0000
-@@ -94,6 +94,50 @@
+--- copyfs-1.0-orig/cache.c 2004-12-10 13:34:08.000000000 +0000
++++ copyfs-1.0/cache.c 2004-12-18 20:30:17.945445677 +0000
+@@ -94,6 +94,61 @@
}
/*
+ * Remove metadata from the cache
+ */
-+void cache_remove_metadata(const char *vpath)
++void cache_remove_metadata(metadata_t *metadata)
+{
-+ bucket_t *bucket;
-+ metadata_t *metadata;
++ version_t * version;
++
+ int atHead = 1;
+ int atTail = 1;
+
-+ /* Lookup the item */
-+ bucket = &cache_hash_table[CACHE_HASH(vpath)];
-+ metadata = bucket->b_contents;
-+ while (metadata && strcmp(metadata->md_vfile, vpath))
-+ metadata = metadata->md_next;
-+ if (!metadata)
++ if (NULL == metadata)
+ return ;
+
+ /* Disconnect it from the list */
@@ -37,13 +33,29 @@ diff -u --recursive copyfs-1.0-orig/cache.c copyfs-1.0/cache.c
+
+ if (atHead)
+ {
-+ bucket->b_contents = metadata->md_next;
-+ bucket->b_contents->md_previous = NULL;
++ metadata->md_bucket->b_contents = metadata->md_next;
++ if (metadata->md_next != NULL)
++ metadata->md_next->md_previous = NULL;
++ }
++
++ metadata->md_bucket->b_count--;
++ if (metadata->md_bucket->b_count == 0)
++ metadata->md_bucket->b_contents = NULL;
++
++ version = metadata->md_versions;
++
++ while (NULL != version)
++ {
++ metadata->md_versions = version->v_next;
++ free(version);
++ version = metadata->md_versions;
+ }
+
-+ bucket->b_count--;
-+ if (bucket->b_count == 0)
-+ bucket->b_contents = NULL;
++ if (metadata->md_vfile != NULL)
++ free (metadata->md_vfile);
++
++ if (metadata->md_vpath != NULL)
++ free (metadata->md_vpath);
+
+ free(metadata);
+}
@@ -52,24 +64,28 @@ diff -u --recursive copyfs-1.0-orig/cache.c copyfs-1.0/cache.c
* Clean the older items out of the cache to free space. The goal is to
* half the number of items, so that we don't get called constantly.
*/
+@@ -122,6 +177,7 @@
+ bucket = &cache_hash_table[CACHE_HASH(metadata->md_vfile)];
+ metadata->md_previous = NULL;
+ metadata->md_next = bucket->b_contents;
++ metadata->md_bucket = bucket;
+ if (bucket->b_contents)
+ bucket->b_contents->md_previous = metadata;
+ bucket->b_contents = metadata;
diff -u --recursive copyfs-1.0-orig/cache.h copyfs-1.0/cache.h
---- copyfs-1.0-orig/cache.h 2004-12-16 21:07:38.953286336 +0000
-+++ copyfs-1.0/cache.h 2004-12-16 22:00:28.463400204 +0000
+--- copyfs-1.0-orig/cache.h 2004-12-10 13:34:08.000000000 +0000
++++ copyfs-1.0/cache.h 2004-12-18 20:04:32.072307652 +0000
@@ -11,6 +11,7 @@
void cache_initialize(void);
void cache_finalize(void);
metadata_t *cache_get_metadata(const char *vpath);
-+void cache_remove_metadata(const char *vpath);
++void cache_remove_metadata(metadata_t *metadata);
void cache_add_metadata(metadata_t *metadata);
int cache_find_maximal_match(char **array, metadata_t **result);
-Only in copyfs-1.0: config.cache
-Only in copyfs-1.0: config.log
-Only in copyfs-1.0: config.status
-Only in copyfs-1.0: fcopyfs-daemon
diff -u --recursive copyfs-1.0-orig/interface.c copyfs-1.0/interface.c
---- copyfs-1.0-orig/interface.c 2004-12-16 21:07:38.953286336 +0000
-+++ copyfs-1.0/interface.c 2004-12-16 22:01:40.393756516 +0000
+--- copyfs-1.0-orig/interface.c 2004-12-18 20:04:21.560474299 +0000
++++ copyfs-1.0/interface.c 2004-12-18 20:17:22.367357210 +0000
@@ -137,6 +137,7 @@
file = helper_build_composite("-S", "/", entry->d_name +
strlen(METADATA_PREFIX));
@@ -78,12 +94,43 @@ diff -u --recursive copyfs-1.0-orig/interface.c copyfs-1.0/interface.c
free(file);
if (metadata && !metadata->md_deleted)
{
-@@ -181,13 +182,16 @@
- return -errno;
- if (S_ISDIR(st_rfile.st_mode))
- return -EISDIR;
-+ if (unlink(version->v_rfile) == -1)
-+ return -errno;
+@@ -176,18 +177,42 @@
+ metadata = rcs_translate_to_metadata(path, rcs_version_path);
+ if (!metadata || metadata->md_deleted)
+ return -ENOENT;
+- version = rcs_find_version(metadata, LATEST, LATEST);
+- if (lstat(version->v_rfile, &st_rfile) == -1)
+- return -errno;
+- if (S_ISDIR(st_rfile.st_mode))
+- return -EISDIR;
++
++ /* remove all of the versions that we know about */
++
++ version = metadata->md_versions;
++
++ while (NULL != version)
++ {
++ /* if we can't stat the file, we assume it's already toast */
++
++ if (lstat(version->v_rfile, &st_rfile) == 0)
++ {
++ if (S_ISDIR(st_rfile.st_mode))
++ {
++ return -EISDIR;
++ }
++
++ if (unlink(version->v_rfile) == -1)
++ return -errno;
++ }
++
++ /* move on to the next version */
++ metadata->md_versions = version->v_next;
++ free(version);
++
++ version = metadata->md_versions;
++ }
++
++ /* if we get to here, we've released all the versions */
metadata->md_deleted = 1;
metafile = create_meta_name(metadata->md_vfile, "metadata");
- if (write_metadata_file(metafile, metadata) == -1) {
@@ -93,8 +140,20 @@ diff -u --recursive copyfs-1.0-orig/interface.c copyfs-1.0/interface.c
- }
free(metafile);
+
-+ cache_remove_metadata(version->v_rfile);
++ cache_remove_metadata(metadata);
+
return 0;
}
+diff -u --recursive copyfs-1.0-orig/structs.h copyfs-1.0/structs.h
+--- copyfs-1.0-orig/structs.h 2004-12-10 13:34:08.000000000 +0000
++++ copyfs-1.0/structs.h 2004-12-18 20:04:32.073307446 +0000
+@@ -38,6 +38,8 @@
+
+ metadata_t *md_next; /* Next file in bucket */
+ metadata_t *md_previous; /* Previous " */
++
++ bucket_t *md_bucket; /* Our container */
+ };
+
+ struct bucket_t