Hello community,
here is the log from the commit of package fusecompress
checked in at Fri Sep 5 00:56:56 CEST 2008.
--------
--- fusecompress/fusecompress.changes 2008-08-27 15:10:49.000000000 +0200
+++ fusecompress/fusecompress.changes 2008-09-03 14:06:20.000000000 +0200
@@ -1,0 +2,16 @@
+Mon Sep 1 13:24:12 CEST 2008 - uli@suse.de
+
+- update -> SVN trunk r64
+ - handle non-page-aligned reads when caching (for direct I/O)
+ - fixed assertion in direct_rename() (issue #2)
+ - cache uncompressed data ("cache_skipped" option)
+ - added FS option "uncompressed_binaries" (don't compress shared objects
+ and standard binary directories)
+ - added FS options for compression method and detaching (issue #19)
+ - added read-only support (issue #18, test included)
+ - made run_tests clean up after failed test cases
+ - added my copyright where appropriate
+ - clarified GPL version (some files said any, others said v2)
+- move fsck to /bin
+
+-------------------------------------------------------------------
Old:
----
fusecompress-0.9.2svn20080815.tar.gz
New:
----
fusecompress-0.9.2svn20080901.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ fusecompress.spec ++++++
--- /var/tmp/diff_new_pack.O17224/_old 2008-09-05 00:53:35.000000000 +0200
+++ /var/tmp/diff_new_pack.O17224/_new 2008-09-05 00:53:35.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package fusecompress (Version 0.9.2svn20080815)
+# spec file for package fusecompress (Version 0.9.2svn20080901)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -22,8 +22,8 @@
License: GPL v2 only
Group: System/Filesystems
AutoReqProv: on
-Version: 0.9.2svn20080815
-Release: 3
+Version: 0.9.2svn20080901
+Release: 1
Summary: FUSE-based filesystem with transparent compression
Source: %name-%version.tar.gz
Url: http://code.google.com/p/fusecompress/
@@ -62,7 +62,6 @@
make %{?jobs:-j%jobs} debug
mv fusecompress fusecompress.debug
make clean
-# link LZO statically (the shared lib is in /usr)
make %{?jobs:-j%jobs} release
mv fusecompress fusecompress.release
@@ -70,15 +69,29 @@
install -D -m 755 fusecompress.release $RPM_BUILD_ROOT/bin/fusecompress
install -d -m 755 $RPM_BUILD_ROOT%_bindir
install -m 755 fusecompress.debug $RPM_BUILD_ROOT%_bindir/
-install -m 755 fsck.fusecompress fusecompress_offline $RPM_BUILD_ROOT%_bindir/
+install -m 755 fusecompress_offline $RPM_BUILD_ROOT%_bindir/
+install -m 755 fsck.fusecompress $RPM_BUILD_ROOT/bin/
%files
%defattr(-,root,root)
%doc README BUGS
-/bin/fusecompress
+/bin/*
%_bindir/*
%changelog
+* Mon Sep 01 2008 uli@suse.de
+- update -> SVN trunk r64
+ - handle non-page-aligned reads when caching (for direct I/O)
+ - fixed assertion in direct_rename() (issue #2)
+ - cache uncompressed data ("cache_skipped" option)
+ - added FS option "uncompressed_binaries" (don't compress shared objects
+ and standard binary directories)
+ - added FS options for compression method and detaching (issue #19)
+ - added read-only support (issue #18, test included)
+ - made run_tests clean up after failed test cases
+ - added my copyright where appropriate
+ - clarified GPL version (some files said any, others said v2)
+- move fsck to /bin
* Wed Aug 27 2008 crrodriguez@suse.de
- fix build, lzo static library is gone and shared lib is now in /lib
* Fri Aug 15 2008 uli@suse.de
++++++ fusecompress-0.9.2svn20080815.tar.gz -> fusecompress-0.9.2svn20080901.tar.gz ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/background_compress.c new/fusecompress/background_compress.c
--- old/fusecompress/background_compress.c 2006-03-31 13:46:29.000000000 +0200
+++ new/fusecompress/background_compress.c 2008-08-15 15:10:43.000000000 +0200
@@ -5,8 +5,7 @@
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/background_compress.h new/fusecompress/background_compress.h
--- old/fusecompress/background_compress.h 2006-03-31 13:46:29.000000000 +0200
+++ new/fusecompress/background_compress.h 2008-08-15 15:13:06.000000000 +0200
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/compress.c new/fusecompress/compress.c
--- old/fusecompress/compress.c 2008-08-12 10:42:14.000000000 +0200
+++ new/fusecompress/compress.c 2008-08-22 17:18:30.000000000 +0200
@@ -5,8 +5,7 @@
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -74,6 +73,23 @@
if (strstr(file->filename, FUSE))
return NULL;
+ /* ignore binaries and shared objects when mounted at / or /usr */
+ if (root_fs)
+ {
+ for (ext = mmapped_dirs; *ext != NULL; ext++)
+ {
+ DEBUG_("file->filename %s, ext %s", file->filename, *ext);
+ if (strncmp(file->filename, *ext, strlen(*ext)) == 0)
+ return NULL;
+ }
+ if ((r = rindex(file->filename, '.')))
+ {
+ if (!strcmp(r, ".so")) /* name ends with .so */
+ return NULL;
+ if (strstr(file->filename, ".so.")) /* name contains .so. */
+ return NULL;
+ }
+ }
/* TODO: decide about compressor and it's compression level from size */
return compressor_default;
}
@@ -115,6 +131,22 @@
}
}
+ if (file->cache)
+ {
+ int i;
+ for (i = 0; i < file->cache_size ; i++)
+ {
+ if (file->cache[i])
+ {
+ decomp_cache_size -= DC_PAGE_SIZE;
+ free(file->cache[i]);
+ }
+ }
+ file->cache = NULL;
+ file->cache_size = 0;
+ DEBUG_("decomp_cache_size %d", decomp_cache_size);
+ }
+
// Open file
//
fd_source = file_open(file->filename, O_RDWR);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/compress.h new/fusecompress/compress.h
--- old/fusecompress/compress.h 2008-08-05 17:02:17.000000000 +0200
+++ new/fusecompress/compress.h 2008-08-15 15:08:49.000000000 +0200
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/direct_compress.c new/fusecompress/direct_compress.c
--- old/fusecompress/direct_compress.c 2008-08-12 11:36:02.000000000 +0200
+++ new/fusecompress/direct_compress.c 2008-08-25 18:06:01.000000000 +0200
@@ -2,11 +2,11 @@
*
* Copyright (C) 2005 Anders Aagaard
* Copyright (C) 2006 Milan Svoboda
+ * Copyright (C) 2008 Ulrich Hecht
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -56,6 +56,19 @@
UNLOCK(&file->lock);
pthread_mutex_destroy(&file->lock);
+ if (file->cache)
+ {
+ int i;
+ for (i = 0; i < file->cache_size; i++)
+ {
+ if (file->cache[i])
+ {
+ decomp_cache_size -= DC_PAGE_SIZE;
+ free(file->cache[i]);
+ }
+ }
+ DEBUG_("decomp_cache_size %d", decomp_cache_size);
+ }
free(file);
}
@@ -97,6 +110,7 @@
((file->size == (off_t) -1) || (file->size > min_filesize_background)) &&
statvfs(file->filename, &stat) == 0 &&
(stat.f_bsize * stat.f_bavail >= file->size || (geteuid() == 0 && stat.f_bsize * stat.f_bfree >= file->size)) &&
+ !read_only &&
choose_compressor(file))
{
DEBUG_("compress file on background");
@@ -181,6 +195,9 @@
file->skipped = 0;
file->status = 0;
+ file->cache = NULL;
+ file->cache_size = 0;
+
file->filename_hash = filename_hash;
file->filename = (char *) file + sizeof(file_t);
memcpy(file->filename, filename, len);
@@ -316,12 +333,21 @@
int direct_decompress(file_t *file, descriptor_t *descriptor, void *buffer, size_t size, off_t offset)
{
int len,ret;
+ int cache_this_read = cache_decompressed_data;
assert(file);
assert(file->compressor);
assert(descriptor);
assert(descriptor->fd != -1);
+ /* This should not happen, except for direct I/O. I cannot get direct I/O to work at all,
+ though, so I cannot check. May be superfluous. */
+ if(offset % DC_PAGE_SIZE != 0 || size % DC_PAGE_SIZE != 0)
+ {
+ DEBUG_("turned off caching for odd read at %ld, size %zd", offset, size);
+ cache_this_read = 0;
+ }
+
NEED_LOCK(&file->lock);
DEBUG_("('%s'), offset: %zi, descriptor->offset: %zi",
@@ -339,13 +365,32 @@
file->type = READ;
}
+ size_t s = 0;
+ if (cache_this_read && (file->type & READ) && file->cache && file->cache[offset / DC_PAGE_SIZE])
+ {
+ DEBUG_("serving data from cache at offset %zd", offset);
+ while(size && file->cache[offset / DC_PAGE_SIZE])
+ {
+ memcpy(buffer, file->cache[offset / DC_PAGE_SIZE], DC_PAGE_SIZE);
+ free(file->cache[offset / DC_PAGE_SIZE]);
+ file->cache[offset / DC_PAGE_SIZE] = NULL;
+ decomp_cache_size -= DC_PAGE_SIZE;
+ size -= DC_PAGE_SIZE;
+ buffer += DC_PAGE_SIZE;
+ offset += DC_PAGE_SIZE;
+ s += DC_PAGE_SIZE;
+ }
+ DEBUG_("decomp_cache_size %d", decomp_cache_size);
+ if (!size) return s;
+ }
// Decompress file if:
// - user wants to read from somewhere else
// - user wants to read when he was writing to file before
//
// If offset is wrong, we need to close and open file in raw mode.
//
- if ((file->skipped > file->size * 3 && file->size > 131072 && offset != descriptor->offset) || (!(file->type & READ)))
+ if ((!cache_this_read || decomp_cache_size > max_decomp_cache_size) &&
+ !read_only && ( (file->skipped > file->size * 3 && file->size > 131072 && offset != descriptor->offset) || (!(file->type & READ)) ) )
{
DEBUG_("\tfallback, offset: %zi, descriptor->offset: %zi, size %zd, !(file->type & READ): %d, file->size %zd, file->skipped %zd",
offset, descriptor->offset, size, (!(file->type & READ)), file->size, file->skipped);
@@ -361,7 +406,9 @@
file->size = -1;
file->skipped = 0;
- return pread(descriptor->fd, buffer, size, offset);
+ ret = pread(descriptor->fd, buffer, size, offset);
+ if (ret < 0) return ret;
+ else return s + ret;
}
if (offset < descriptor->offset)
@@ -403,10 +450,35 @@
if(offset > descriptor->offset)
{
size_t toread = offset - descriptor->offset;
+ void* skipbuf = buffer;
+ if (cache_this_read && !file->cache)
+ {
+ file->cache_size = file->size / DC_PAGE_SIZE + 1;
+ file->cache = calloc(file->cache_size, sizeof(void*));
+ if (!file->cache)
+ {
+ ERR_("out of memory");
+ return -1;
+ }
+ }
DEBUG_("skipping %zd to %zd before reading %zd bytes",toread,offset,size);
while(toread) {
- size_t readsize = toread > size ? size : toread;
- len = file->compressor->read(descriptor->handle, buffer, readsize);
+ size_t readsize = toread > DC_PAGE_SIZE ? DC_PAGE_SIZE : toread;
+
+ if (cache_this_read && !file->cache[descriptor->offset / DC_PAGE_SIZE] && decomp_cache_size < max_decomp_cache_size)
+ {
+ decomp_cache_size += DC_PAGE_SIZE;
+ skipbuf = malloc(DC_PAGE_SIZE);
+ if (!skipbuf)
+ {
+ ERR_("out of memory");
+ return -1;
+ }
+ }
+ else
+ skipbuf = buffer;
+
+ len = file->compressor->read(descriptor->handle, skipbuf, readsize);
DEBUG_("tried %zd bytes, got %d (file size %zd)",readsize,len,file->size);
if(len < 0) {
ERR_("failed to read from compressor");
@@ -425,10 +497,13 @@
}
if(len == 0) return len; /* sought beyond the end of the file */
toread -= len;
+ if (cache_this_read && skipbuf != buffer)
+ file->cache[descriptor->offset / DC_PAGE_SIZE] = skipbuf;
descriptor->offset += len;
file->skipped += len;
DEBUG_("toread %zd offset %zd",toread,descriptor->offset);
}
+ DEBUG_("decomp_cache_size %d", decomp_cache_size);
}
// Do actual decompressing
@@ -449,7 +524,7 @@
descriptor->offset += len;
DEBUG_("read requested len: %zd, got: %d", size, len);
- return len;
+ return len + s;
}
/*
@@ -465,7 +540,8 @@
assert(file->compressor);
assert(descriptor);
assert(descriptor->fd != -1);
-
+ assert(!read_only);
+
NEED_LOCK(&file->lock);
DEBUG_("('%s'), offset: %zi, descriptor->offset: %zi",
@@ -649,11 +725,14 @@
}
UNLOCK(&comp_database.lock);
- /* FIXME: still fails sometimes; very hard to reproduce */
- assert(file_from->accesses == 0);
+ /* Normally, file_from->accesses is 0 here. In some cases it is
+ still 1 because thread_compress() has already removed the file
+ from the database with the intention of compressing it. It will
+ not do so, however, because we mark the file as deleted before
+ releasing the lock on it, so this case is OK, too. */
+ assert(file_from->accesses <= 1);
// The file refered by file_from is now deleted
- //
direct_delete(file_from);
return file_to;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/direct_compress.h new/fusecompress/direct_compress.h
--- old/fusecompress/direct_compress.h 2006-03-31 13:46:29.000000000 +0200
+++ new/fusecompress/direct_compress.h 2008-08-15 15:09:08.000000000 +0200
@@ -4,8 +4,7 @@
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/fusecompress.c new/fusecompress/fusecompress.c
--- old/fusecompress/fusecompress.c 2008-08-15 14:03:02.000000000 +0200
+++ new/fusecompress/fusecompress.c 2008-08-25 17:24:27.000000000 +0200
@@ -1,8 +1,9 @@
/*
FuseCompress
Copyright (C) 2005 Milan Svoboda
+ Copyright (C) 2008 Ulrich Hecht
- This program can be distributed under the terms of the GNU GPL.
+ This program can be distributed under the terms of the GNU GPL v2.
See the file COPYING.
*/
@@ -897,12 +898,17 @@
char compresslevel[3] = "wbx";
+#define MAX_OPTS 50
int main(int argc, char *argv[])
{
int fusec = 0;
int next_option;
- char *fusev[argc + 3];
+ char *fusev[argc + MAX_OPTS];
char *root = NULL;
+ char *fs_opts = NULL;
+ char *o;
+ int ret;
+
#ifdef DEBUG
FILE* debugout = stderr;
#endif
@@ -920,7 +926,18 @@
fusev[fusec++] = "-o";
fusev[fusec++] = "nonempty,kernel_cache,default_permissions,use_ino";
+ root_fs = 0;
+ read_only = 0;
+ cache_decompressed_data = 0;
+ decomp_cache_size = 0;
+ max_decomp_cache_size = 100 * 1024 * 1024;
+
do {
+ if (fusec >= argc + MAX_OPTS - 2)
+ {
+ ERR_("too many options");
+ exit(EXIT_FAILURE);
+ }
next_option = getopt(argc, argv, short_options);
switch (next_option)
{
@@ -946,8 +963,46 @@
exit(EXIT_FAILURE);
case 'o':
- fusev[fusec++] = "-o";
- fusev[fusec++] = optarg;
+ /* strsep() modifies the string, so we need to copy it */
+ fs_opts = strdup(optarg);
+ while (fs_opts)
+ {
+ o = strsep(&fs_opts, ",");
+ if (!strcmp(o, "ro") || !strcmp(o, "rw"))
+ {
+ fusev[fusec++] = "-o";
+ fusev[fusec++] = o;
+ if (o[1] == 'o') read_only = 1;
+ else read_only = 0;
+ }
+ else if (!strcmp(o, "uncompressed_binaries"))
+ {
+ root_fs = 1;
+ }
+ else if (!strcmp(o, "cache_skipped"))
+ {
+ cache_decompressed_data = 1;
+ }
+ else if (!strcmp(o, "detach"))
+ {
+ detach = 1;
+ }
+ else if (!strcmp(o, "nodetach"))
+ {
+ detach = 0;
+ }
+ else if (!strcmp(o, "lzo") || !strcmp(o, "lzma") || !strcmp(o, "bz2") || !strcmp(o, "gz") || !strcmp(o, "null"))
+ {
+ compressor_default = find_compressor_name(o);
+ }
+ else
+ {
+ fusev[fusec++] = "-o";
+ fusev[fusec++] = o;
+ }
+ }
+ /* fs_opts gets lost here, but there is no proper way of freeing it anyway
+ because it is used by fuse_main() */
break;
case 'l':
@@ -1098,5 +1153,9 @@
stderr = debugout;
#endif
- return fuse_main(fusec, fusev, &fusecompress_oper);
+ ret = fuse_main(fusec, fusev, &fusecompress_oper);
+
+ if (fs_opts) free(fs_opts);
+
+ return ret;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/globals.c new/fusecompress/globals.c
--- old/fusecompress/globals.c 2008-08-12 10:42:25.000000000 +0200
+++ new/fusecompress/globals.c 2008-08-22 16:33:23.000000000 +0200
@@ -17,6 +17,11 @@
//
int min_filesize_background;
+int read_only; /* set if mounted read-only to avoid temporary decompression of files */
+int cache_decompressed_data;
+int decomp_cache_size;
+int max_decomp_cache_size;
+
compressor_t *compressor_default = NULL;
// Table of supported compressors. This is array and
@@ -40,6 +45,11 @@
NULL
};
+int root_fs; /* set if you do not want to compress shared objects or binaries in mmapped_dirs[] */
+char *mmapped_dirs[] = {
+ "bin/", "sbin/", "usr/bin/", "usr/sbin/", NULL
+};
+
database_t database = {
.head = LIST_HEAD_INIT(database.head),
.lock = PTHREAD_MUTEX_INITIALIZER,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/globals.h new/fusecompress/globals.h
--- old/fusecompress/globals.h 2008-08-12 10:42:36.000000000 +0200
+++ new/fusecompress/globals.h 2008-08-22 16:30:37.000000000 +0200
@@ -4,6 +4,13 @@
*/
extern int min_filesize_background;
+extern int root_fs;
+extern int read_only;
+
+extern int cache_decompressed_data;
+extern int decomp_cache_size;
+extern int max_decomp_cache_size;
+#define DC_PAGE_SIZE (4096)
extern pthread_t pt_comp;
@@ -12,6 +19,7 @@
extern compressor_t *compressor_default;
extern compressor_t *compressors[5];
extern char *incompressible[];
+extern char *mmapped_dirs[];
extern database_t database;
extern database_t comp_database;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/log.c new/fusecompress/log.c
--- old/fusecompress/log.c 2006-03-31 13:46:29.000000000 +0200
+++ new/fusecompress/log.c 2008-08-15 15:12:55.000000000 +0200
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/log.h new/fusecompress/log.h
--- old/fusecompress/log.h 2008-08-11 12:50:11.000000000 +0200
+++ new/fusecompress/log.h 2008-08-15 15:09:43.000000000 +0200
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/structs.h new/fusecompress/structs.h
--- old/fusecompress/structs.h 2008-08-12 10:52:53.000000000 +0200
+++ new/fusecompress/structs.h 2008-08-22 17:17:16.000000000 +0200
@@ -88,6 +88,9 @@
int dontcompress;
int type;
int status;
+
+ void** cache;
+ int cache_size;
pthread_mutex_t lock;
pthread_cond_t cond;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/test/corrupt.py new/fusecompress/test/corrupt.py
--- old/fusecompress/test/corrupt.py 2008-08-11 12:50:09.000000000 +0200
+++ new/fusecompress/test/corrupt.py 2008-08-22 14:12:57.000000000 +0200
@@ -38,10 +38,6 @@
os.unlink('log.'+comp)
continue
- a.close()
- os.system('fusermount -z -u test')
- time.sleep(1)
- shutil.rmtree('test')
os.abort()
sys.exit(0)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/test/readonly.py new/fusecompress/test/readonly.py
--- old/fusecompress/test/readonly.py 1970-01-01 01:00:00.000000000 +0100
+++ new/fusecompress/test/readonly.py 2008-08-22 14:08:14.000000000 +0200
@@ -0,0 +1,61 @@
+import os
+import stat
+import time
+import shutil
+
+os.mkdir('test')
+
+bigsize = 1000
+
+os.system('../fusecompress -o detach test')
+f = open('test/big', 'w')
+for i in range(0, bigsize):
+ f.write('abcd'*256)
+f.close()
+shutil.copy('/bin/bash', 'test/bashc')
+os.system('fusermount -u test')
+shutil.copy('/bin/bash', 'test/bash')
+assert(os.stat('test/bashc')[stat.ST_SIZE] < os.stat('test/bash')[stat.ST_SIZE])
+
+os.system('../fusecompress -o detach,ro test')
+
+# try to create a file (expect failure)
+passd = False
+try:
+ open('test/1','w')
+except:
+ passd = True
+if not passd:
+ print 'create did not fail as expected'
+ os.abort()
+
+# look at file to get it into the bg compression queue
+# (should not happen)
+os.stat('test/bash')
+# wait until unmount to check if it has been compressed
+
+# try to trigger decompression (should not happen)
+f = open('test/big', 'r')
+off1 = 0
+off2 = bigsize * 256 * 4 - 100
+for i in range(0,10):
+ f.seek(off1)
+ f.read(100)
+ off1 += 4096
+ f.seek(off2)
+ f.read(100)
+ off2 -= 4096
+f.close()
+
+os.system('fusermount -u test')
+time.sleep(1)
+
+if os.stat('test/big')[stat.ST_SIZE] > bigsize * 256 * 2:
+ print 'big file uncompressed'
+ os.abort()
+
+if os.stat('test/bash')[stat.ST_SIZE] < os.stat('/bin/bash')[stat.ST_SIZE]:
+ print 'bash compressed'
+ os.abort()
+
+shutil.rmtree('test')
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/test/rename.py new/fusecompress/test/rename.py
--- old/fusecompress/test/rename.py 2008-08-11 12:50:09.000000000 +0200
+++ new/fusecompress/test/rename.py 2008-08-22 14:13:56.000000000 +0200
@@ -22,7 +22,8 @@
def rf(): return fn(random.randint(0,files))
quit = False
-def out():
+
+def out_ok():
global quit
quit = True
time.sleep(.1)
@@ -32,13 +33,9 @@
shutil.rmtree('test')
break
except: pass
-
-def out_ok():
- out()
sys.exit(0)
def out_barf():
- out()
os.abort()
Timer(30,out_ok).start()
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/test/run_tests new/fusecompress/test/run_tests
--- old/fusecompress/test/run_tests 2008-08-05 17:20:46.000000000 +0200
+++ new/fusecompress/test/run_tests 2008-08-22 14:08:57.000000000 +0200
@@ -24,6 +24,8 @@
rm $i.log
else
echo "FAIL"
+ fusermount -z -u test
+ mv test test.$i
fail=1
fi
else
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/tools/fsck.c new/fusecompress/tools/fsck.c
--- old/fusecompress/tools/fsck.c 2008-08-12 15:01:59.000000000 +0200
+++ new/fusecompress/tools/fsck.c 2008-08-15 15:07:25.000000000 +0200
@@ -2,7 +2,7 @@
fsck.fusecompress
(C) 2008 Ulrich Hecht
- This program can be distributed under the terms of the GNU GPL.
+ This program can be distributed under the terms of the GNU GPL v2.
See the file COPYING.
*/
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/fusecompress/tools/offline.c new/fusecompress/tools/offline.c
--- old/fusecompress/tools/offline.c 2008-08-12 15:02:19.000000000 +0200
+++ new/fusecompress/tools/offline.c 2008-08-15 15:07:19.000000000 +0200
@@ -2,7 +2,7 @@
fusecompress_offline
(C) 2008 Ulrich Hecht
- This program can be distributed under the terms of the GNU GPL.
+ This program can be distributed under the terms of the GNU GPL v2.
See the file COPYING.
*/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org