Skip to content

Instantly share code, notes, and snippets.

View jborg's full-sized avatar

Jonas Borgström jborg

  • Stockholm, Sweden
View GitHub Profile
@jborg
jborg / _hashindex.c.patch
Created May 23, 2015 20:58
hashindex 32 bit alignment fix
diff --git a/attic/_hashindex.c b/attic/_hashindex.c
index 3d311dd..4d117f1 100644
--- a/attic/_hashindex.c
+++ b/attic/_hashindex.c
@@ -18,6 +18,9 @@
#error Unknown byte order
#endif
+/* Adjustment to make sure buckets locations are 32 bit aligned */
+#define ALIGNMENT_ADJUSTMENT 2
@jborg
jborg / gist:d50975951580c53322a0
Created February 25, 2015 12:52
xmlsec1-config: Add missing XMLSEC_NO_SIZE_T
--- /usr/bin/xmlsec1-config.orig 2015-02-25 13:47:13.384286257 +0100
+++ /usr/bin/xmlsec1-config 2015-02-25 13:46:54.849285579 +0100
@@ -199,7 +199,7 @@
#
# Assemble all the settings together
#
-the_flags="$the_flags -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_XKMS=1 -DXMLSEC_DL_LIBLTDL=1 -I/usr/include/xmlsec1 $the_xml_flags $the_xslt_flags $the_crypto_flags"
+the_flags="$the_flags -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_XKMS=1 -DXMLSEC_DL_LIBLTDL=1 -DXMLSEC_NO_SIZE_T -I/usr/include/xmlsec1 $the_xml_flags $the_xslt_flags $the_crypto_flags"
the_libs="$the_libs -L${package_libdir} -lxmlsec1 -lltdl $the_xmlsec_crypto_lib -lxmlsec1 $the_xml_libs $the_xslt_libs $the_crypto_libs"
diff --git a/attic/repository.py b/attic/repository.py
index 8d39323..eed85dc 100644
--- a/attic/repository.py
+++ b/attic/repository.py
@@ -408,12 +408,14 @@ class LoggedIO(object):
self.fds = None # Just to make sure we're disabled
def segment_iterator(self, reverse=False):
- for dirpath, dirs, filenames in os.walk(os.path.join(self.path, 'data')):
- dirs.sort(key=int, reverse=reverse)
diff --git a/attic/archive.py b/attic/archive.py
index 171da3f..58e5427 100644
--- a/attic/archive.py
+++ b/attic/archive.py
@@ -351,12 +351,12 @@ class Archive:
}
if self.numeric_owner:
item[b'user'] = item[b'group'] = None
- xattrs = xattr.get_all(path, follow_symlinks=False)
- if xattrs:
diff --git a/attic/_hashindex.c b/attic/_hashindex.c
index 6e932c0..d3fa288 100644
--- a/attic/_hashindex.c
+++ b/attic/_hashindex.c
@@ -7,7 +7,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-#include <sys/mman.h>
import sys
from attic.remote import RemoteRepository
from attic.repository import Repository
from attic.helpers import Location, Manifest, unhexlify
if __name__ == '__main__':
location = Location(sys.argv[1])
if location.proto == 'ssh':
repository = RemoteRepository(location)
from binascii import hexlify
import sys
from attic.archive import Archive
from attic.remote import RemoteRepository
from attic.repository import Repository
from attic.helpers import Location, Manifest
if __name__ == '__main__':
location = Location(sys.argv[1])
if location.proto == 'ssh':
diff --git a/attic/archive.py b/attic/archive.py
index e796d71..c55293c 100644
--- a/attic/archive.py
+++ b/attic/archive.py
@@ -1,3 +1,4 @@
+from binascii import hexlify
from datetime import datetime, timedelta, timezone
from getpass import getuser
from itertools import groupby
@@ -617,14 +618,21 @@ class ArchiveChecker:
diff --git a/attic/_chunker.c b/attic/_chunker.c
index 8dbbce5..7cdfa51 100644
--- a/attic/_chunker.c
+++ b/attic/_chunker.c
@@ -1,4 +1,15 @@
#include <Python.h>
+#include <openssl/aes.h>
+
+#if defined(BYTE_ORDER)&&(BYTE_ORDER == BIG_ENDIAN)
+#define _le32toh(x) __builtin_bswap32(x)
@jborg
jborg / attic_file_cache.patch
Created May 2, 2014 19:00
Reduce attic file cache memory usage
diff --git a/attic/cache.py b/attic/cache.py
index 65362ff..6368005 100644
--- a/attic/cache.py
+++ b/attic/cache.py
@@ -12,6 +12,8 @@ from .hashindex import ChunkIndex
class Cache(object):
"""Client Side cache
"""
+ # Do not cache file metadata for files smaller than this
+ FILE_MIN_SIZE = 4096