Giter Site home page Giter Site logo

systemd / casync Goto Github PK

View Code? Open in Web Editor NEW
1.5K 82.0 117.0 2.54 MB

Content-Addressable Data Synchronization Tool

C 96.43% Shell 2.12% Emacs Lisp 0.06% Python 0.11% Meson 1.21% SmPL 0.02% Vim Script 0.04%
archive tar file-system http chunking synchronization download upload delivery

casync's Introduction

Systemd

System and Service Manager

Semaphore CI 2.0 Build Status
Coverity Scan Status
OSS-Fuzz Status
CIFuzz
CII Best Practices
CentOS CI - CentOS 9
CentOS CI - Arch
CentOS CI - Arch (sanitizers)
Fossies codespell report
Weblate
Coverage Status
Packaging status
OpenSSF Scorecard

Details

Most documentation is available on systemd's web site.

Assorted, older, general information about systemd can be found in the systemd Wiki.

Information about build requirements is provided in the README file.

Consult our NEWS file for information about what's new in the most recent systemd versions.

Please see the Code Map for information about this repository's layout and content.

Please see the Hacking guide for information on how to hack on systemd and test your modifications.

Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.

When preparing patches for systemd, please follow our Coding Style Guidelines.

If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel

Stable branches with backported patches are available in the stable repo.

We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack

casync's People

Contributors

charles-dyfis-net avatar dguibert avatar edef1c avatar ejoerns avatar elboulangero avatar enkore avatar fhackenberger avatar fsateler avatar glaubitz avatar gportay avatar gunnarx avatar keszybz avatar lducazu avatar martinpitt avatar marv avatar maxice8 avatar michaelforney avatar mihais avatar nikitapuzyryov avatar phomes avatar poettering avatar ruuda avatar sedrubal avatar sergeysedoy97 avatar shadowofs avatar srd424 avatar timgates42 avatar vbatts avatar yann-morin-1998 avatar zonque avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

casync's Issues

Unable to build in alpine arm64 (musl-libc)

I'm trying to build casync in an alpine docker container so I can use it in my alpine based embedded system. I'm having build issues I suspect are because this code hasn't been tested with musl-libc.

To reproduce, try to build the following:

# Build casync in an arm64v8/alpine container
FROM arm64v8/alpine as casync
COPY /usr/bin/qemu-aarch64-static /usr/bin/
RUN apk update && apk upgrade
RUN apk add build-base git
RUN apk add meson xz-dev curl-dev openssl-dev zstd-dev acl-dev fuse-dev linux-headers

RUN git clone --branch=v2 --depth=1 https://github.com/systemd/casync.git
WORKDIR /casync
RUN meson build -Dselinux=false -Dudev=false -Dman=false
RUN ninja -C build

I get the following errors:

[1/65] Compiling C object 'src/shared@sta/cacompression.c.o'.
FAILED: src/shared@sta/cacompression.c.o 
cc  -Isrc/shared@sta -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O0 -g -Wextra -Werror=undef -Werror=format=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Werror=old-style-definition -Werror=pointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=shadow -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Werror=sign-compare -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -include config.h -fPIC -MMD -MQ 'src/shared@sta/cacompression.c.o' -MF 'src/shared@sta/cacompression.c.o.d' -o 'src/shared@sta/cacompression.c.o' -c ../src/cacompression.c
In file included from ../src/cacompression.c:1:0:
../src/util.h:307:22: error: unknown type name 'mode_t'
 char* ls_format_mode(mode_t m, char ret[LS_FORMAT_MODE_MAX]);
                      ^~~~~~
[2/65] Compiling C object 'src/shared@sta/cafileroot.c.o'.
FAILED: src/shared@sta/cafileroot.c.o 
cc  -Isrc/shared@sta -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O0 -g -Wextra -Werror=undef -Werror=format=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Werror=old-style-definition -Werror=pointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=shadow -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Werror=sign-compare -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -include config.h -fPIC -MMD -MQ 'src/shared@sta/cafileroot.c.o' -MF 'src/shared@sta/cafileroot.c.o.d' -o 'src/shared@sta/cafileroot.c.o' -c ../src/cafileroot.c
In file included from ../src/cafileroot.c:2:0:
../src/util.h:307:22: error: unknown type name 'mode_t'
 char* ls_format_mode(mode_t m, char ret[LS_FORMAT_MODE_MAX]);
                      ^~~~~~
[3/65] Compiling C object 'src/shared@sta/caformat-util.c.o'.
[4/65] Compiling C object 'src/shared@sta/cadigest.c.o'.
[5/65] Compiling C object 'src/shared@sta/calocation.c.o'.
FAILED: src/shared@sta/calocation.c.o 
cc  -Isrc/shared@sta -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O0 -g -Wextra -Werror=undef -Werror=format=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Werror=old-style-definition -Werror=pointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=shadow -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Werror=sign-compare -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -include config.h -fPIC -MMD -MQ 'src/shared@sta/calocation.c.o' -MF 'src/shared@sta/calocation.c.o.d' -o 'src/shared@sta/calocation.c.o' -c ../src/calocation.c
In file included from ../src/calocation.c:1:0:
/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Wcpp]
 #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
  ^~~~~~~
../src/calocation.c: In function 'ca_location_parse':
../src/calocation.c:118:21: error: implicit declaration of function 'strndupa' [-Werror=implicit-function-declaration]
                 a = strndupa(e+2, c-e-2);
                     ^~~~~~~~
../src/calocation.c:118:17: warning: nested extern declaration of 'strndupa' [-Wnested-externs]
                 a = strndupa(e+2, c-e-2);
                 ^
../src/calocation.c:118:19: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
                 a = strndupa(e+2, c-e-2);
                   ^
cc1: some warnings being treated as errors
[6/65] Compiling C object 'src/shared@sta/caencoder.c.o'.
FAILED: src/shared@sta/caencoder.c.o 
cc  -Isrc/shared@sta -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O0 -g -Wextra -Werror=undef -Werror=format=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Werror=old-style-definition -Werror=pointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=shadow -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Werror=sign-compare -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -include config.h -fPIC -MMD -MQ 'src/shared@sta/caencoder.c.o' -MF 'src/shared@sta/caencoder.c.o.d' -o 'src/shared@sta/caencoder.c.o' -c ../src/caencoder.c
../src/caencoder.c: In function 'ca_encoder_node_free':
../src/caencoder.c:268:17: error: implicit declaration of function 'freecon' [-Werror=implicit-function-declaration]
                 freecon(n->selinux_label);
                 ^~~~~~~
../src/caencoder.c:268:17: warning: nested extern declaration of 'freecon' [-Wnested-externs]
../src/caencoder.c: In function 'ca_encoder_node_read_dirents':
../src/caencoder.c:486:13: error: implicit declaration of function 'scandirat' [-Werror=implicit-function-declaration]
         r = scandirat(n->fd, ".", &n->dirents, scandir_filter, scandir_compare);
             ^~~~~~~~~
../src/caencoder.c:486:9: warning: nested extern declaration of 'scandirat' [-Wnested-externs]
         r = scandirat(n->fd, ".", &n->dirents, scandir_filter, scandir_compare);
         ^
../src/caencoder.c: In function 'ca_encoder_node_read_selinux_label':
../src/caencoder.c:662:13: warning: unused variable 'r' [-Wunused-variable]
         int r;
             ^
../src/caencoder.c:661:15: warning: unused variable 'label' [-Wunused-variable]
         char *label;
               ^~~~~
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
The command '/bin/sh -c ninja -C build' returned a non-zero code: 1
Makefile:13: recipe for target 'rootfs.tar' failed
make: *** [rootfs.tar] Error 1

Build fails on Centos7 (libcurl version check)

Just wanted to let you know that your build fails for centos7 hosts, as you declare a minimum libcurl version of 7.32.0 while latest on centos7 is currently 7.29.0. I'm testing on docker with Dockerfile

FROM centos:latest
RUN yum -y install https://centos7.iuscommunity.org/ius-release.rpm
RUN yum -y install make xz-devel libcurl-devel git wget gcc liblzma-devel libcurl-devel libacl-devel libfuse-devel
RUN yum -y install python36u python36u-devel
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python3.6 get-pip.py
RUN pip3 install meson ninja

RUN git clone https://github.com/systemd/casync.git
WORKDIR /casync
RUN meson build
RUN ninja -C build
RUN ninja -C build install

by running:

docker build .

Compilation withou SELinux fails

src/caencoder.c seems to use freecon even when compiled without SELinux support:

$ meson build -Dselinux=false
The Meson build system
Version: 0.41.2
Source dir: /home/embe/scm/casync
Build dir: /home/embe/scm/casync/build
Build type: native build
Project name: casync
Native c compiler: cc (gcc 6.3.0)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Compiler for c supports argument -Wextra: YES
Compiler for c supports argument -Werror=undef: YES
Compiler for c supports argument -Werror=format=2: YES
Compiler for c supports argument -Wformat-security: YES
Compiler for c supports argument -Wformat-nonliteral: YES
Compiler for c supports argument -Wlogical-op: YES
Compiler for c supports argument -Wmissing-include-dirs: YES
Compiler for c supports argument -Werror=old-style-definition: YES
Compiler for c supports argument -Werror=pointer-arith: YES
Compiler for c supports argument -Winit-self: YES
Compiler for c supports argument -Wdeclaration-after-statement: YES
Compiler for c supports argument -Wfloat-equal: YES
Compiler for c supports argument -Wsuggest-attribute=noreturn: YES
Compiler for c supports argument -Werror=missing-prototypes: YES
Compiler for c supports argument -Werror=implicit-function-declaration: YES
Compiler for c supports argument -Werror=missing-declarations: YES
Compiler for c supports argument -Werror=return-type: YES
Compiler for c supports argument -Werror=incompatible-pointer-types: YES
Compiler for c supports argument -Werror=shadow: YES
Compiler for c supports argument -Wstrict-prototypes: YES
Compiler for c supports argument -Wredundant-decls: YES
Compiler for c supports argument -Wmissing-noreturn: YES
Compiler for c supports argument -Wendif-labels: YES
Compiler for c supports argument -Wstrict-aliasing=2: YES
Compiler for c supports argument -Wwrite-strings: YES
Compiler for c supports argument -Wno-unused-parameter: YES
Compiler for c supports argument -Wno-missing-field-initializers: YES
Compiler for c supports argument -Wno-unused-result: YES
Compiler for c supports argument -Werror=overflow: YES
Compiler for c supports argument -Werror=sign-compare: YES
Compiler for c supports argument -Wdate-time: YES
Compiler for c supports argument -Wnested-externs: YES
Compiler for c supports argument -ffast-math: YES
Compiler for c supports argument -fno-common: YES
Compiler for c supports argument -fdiagnostics-show-option: YES
Compiler for c supports argument -fno-strict-aliasing: YES
Compiler for c supports argument -fvisibility=hidden: YES
Compiler for c supports argument -fstack-protector: YES
Compiler for c supports argument -fstack-protector-strong: YES
Compiler for c supports argument -fPIE: YES
Compiler for c supports argument --param=ssp-buffer-size=4: YES
Checking for size of "pid_t": 4
Checking for size of "uid_t": 4
Checking for size of "gid_t": 4
Checking for function "renameat2": NO
Checking for function "copy_file_range": NO
Checking for function "getrandom": NO
Checking for function "getrandom": NO
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Native dependency liblzma found: YES 5.2.3
Native dependency libcurl found: YES 7.54.1
Native dependency openssl found: YES 1.0.2l
Native dependency zlib found: YES 1.2.11
Native dependency libzstd found: YES 1.2.0
Library acl found: YES
Native dependency fuse found: YES 2.9.7
Dependency threads found: YES
Library m found: YES
Configuring config.h using configuration
Program sphinx-build-3 found: NO
Program sphinx-build found: YES (/usr/bin/sphinx-build)
Program sh found: YES (/bin/sh)
Program test-files/test-files.sh found: YES (/home/embe/scm/casync/test-files/test-files.sh)
Configuring test-script.sh using configuration
Program test-script.sh found: YES (/home/embe/scm/casync/build/test-script.sh)
Configuring test-script-sha256.sh using configuration
Program test-script-sha256.sh found: YES (/home/embe/scm/casync/build/test-script-sha256.sh)
Configuring test-script-gzip.sh using configuration
Program test-script-gzip.sh found: YES (/home/embe/scm/casync/build/test-script-gzip.sh)
Configuring test-script-xz.sh using configuration
Program test-script-xz.sh found: YES (/home/embe/scm/casync/build/test-script-xz.sh)
Configuring test-nbd.sh using configuration
Program test-nbd.sh found: YES (/home/embe/scm/casync/build/test-nbd.sh)
Configuring test-fuse.sh using configuration
Program test-fuse.sh found: YES (/home/embe/scm/casync/build/test-fuse.sh)
Configuring 75-casync.rules using configuration
Program git found: YES (/usr/bin/git)
Build targets in project: 22
'/home/embe/scm/casync/build/casync-https' -> 'casync-http'
'/home/embe/scm/casync/build/casync-ftp' -> 'casync-http'
'/home/embe/scm/casync/build/casync-sftp' -> 'casync-http'
$ ninja -C build             
ninja: Entering directory `build'
[25/66] Compiling C object 'src/shared@sta/caencoder.c.o'.
FAILED: src/shared@sta/caencoder.c.o 
cc  -Isrc/shared@sta -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O0 -g -Wextra -Werror=undef -Werror=format=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Werror=old-style-definition -Werror=pointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=shadow -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Werror=sign-compare -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -include config.h -fPIC -MMD -MQ 'src/shared@sta/caencoder.c.o' -MF 'src/shared@sta/caencoder.c.o.d' -o 'src/shared@sta/caencoder.c.o' -c ../src/caencoder.c
../src/caencoder.c: In function ‘ca_encoder_node_free’:
../src/caencoder.c:268:17: error: implicit declaration of function ‘freecon’ [-Werror=implicit-function-declaration]
                 freecon(n->selinux_label);
                 ^~~~~~~
../src/caencoder.c:268:17: warning: nested extern declaration of ‘freecon’ [-Wnested-externs]
../src/caencoder.c: In function ‘ca_encoder_node_read_selinux_label’:
../src/caencoder.c:662:13: warning: unused variable ‘r’ [-Wunused-variable]
         int r;
             ^
../src/caencoder.c:661:15: warning: unused variable ‘label’ [-Wunused-variable]
         char *label;
               ^~~~~
cc1: some warnings being treated as errors
[34/66] Generating man with a custom command.
Running Sphinx v1.6.3
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: 2 added, 0 changed, 0 removed
reading sources... [ 50%] casync
reading sources... [100%] index

looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... casync.1 { } 
build succeeded.
ninja: build stopped: subcommand failed.

Performance optimization

Extracting a catar is consistently at least 3x slower than extracting a tar file with the same contents, even when both and source and destination are on tmpfs. This is exceptionally true when verbose logging is enabled (implying that we're blocking on log flushes).

Both the below are best-of-three:

$ rm -rf test.tar.d && mkdir test.tar.d && time tar -xf test.tar -C test.tar.d
real	0m0.245s
user	0m0.039s
sys	0m0.204s
$ rm -rf test.catar.d && mkdir test.catar.d && catar extract test.catar{,.d}
real	0m0.798s
user	0m0.423s
sys	0m0.372s

Unfortunately, this scales up: An install process that took 15 minutes when using tar is well over 30 when using casync, even from a reconstructed catar rather than a series of separate chunks.

Compiling fails with selinux disabled in release v2

Found this compile problem while trying to create a Gentoo ebuild.

casync version: v2 release

Steps to reproduce:

$ meson configure -Dfuse=true -Dselinux=false
$ ninja -C build

Detailed output:

$ meson configure -Dfuse=true -Dselinux=false
The Meson build system
Version: 0.43.0
Source dir: /tmp/casync-2
Build dir: /tmp/casync-2/build
Build type: native build
Project name: casync
Native C compiler: cc (gcc 6.4.0)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Compiler for C supports argument -Wextra: YES
Compiler for C supports argument -Werror=undef: YES
Compiler for C supports argument -Werror=format=2: YES
Compiler for C supports argument -Wformat-security: YES
Compiler for C supports argument -Wformat-nonliteral: YES
Compiler for C supports argument -Wlogical-op: YES
Compiler for C supports argument -Wmissing-include-dirs: YES
Compiler for C supports argument -Werror=old-style-definition: YES
Compiler for C supports argument -Werror=pointer-arith: YES
Compiler for C supports argument -Winit-self: YES
Compiler for C supports argument -Wdeclaration-after-statement: YES
Compiler for C supports argument -Wfloat-equal: YES
Compiler for C supports argument -Wsuggest-attribute=noreturn: YES
Compiler for C supports argument -Werror=missing-prototypes: YES
Compiler for C supports argument -Werror=implicit-function-declaration: YES
Compiler for C supports argument -Werror=missing-declarations: YES
Compiler for C supports argument -Werror=return-type: YES
Compiler for C supports argument -Werror=incompatible-pointer-types: YES
Compiler for C supports argument -Werror=shadow: YES
Compiler for C supports argument -Wstrict-prototypes: YES
Compiler for C supports argument -Wredundant-decls: YES
Compiler for C supports argument -Wmissing-noreturn: YES
Compiler for C supports argument -Wendif-labels: YES
Compiler for C supports argument -Wstrict-aliasing=2: YES
Compiler for C supports argument -Wwrite-strings: YES
Compiler for C supports argument -Wno-unused-parameter: YES
Compiler for C supports argument -Wno-missing-field-initializers: YES
Compiler for C supports argument -Wno-unused-result: YES
Compiler for C supports argument -Werror=overflow: YES
Compiler for C supports argument -Werror=sign-compare: YES
Compiler for C supports argument -Wdate-time: YES
Compiler for C supports argument -Wnested-externs: YES
Compiler for C supports argument -ffast-math: YES
Compiler for C supports argument -fno-common: YES
Compiler for C supports argument -fdiagnostics-show-option: YES
Compiler for C supports argument -fno-strict-aliasing: YES
Compiler for C supports argument -fvisibility=hidden: YES
Compiler for C supports argument -fstack-protector: YES
Compiler for C supports argument -fstack-protector-strong: YES
Compiler for C supports argument -fPIE: YES
Compiler for C supports argument --param=ssp-buffer-size=4: YES
Checking for size of "pid_t": 4
Checking for size of "uid_t": 4
Checking for size of "gid_t": 4
Checking for function "renameat2": NO
Checking for function "copy_file_range": NO
Checking for function "getrandom": YES
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Native dependency liblzma found: YES 5.2.3
Native dependency libcurl found: YES 7.56.1
Native dependency openssl found: YES 1.0.2m
Native dependency zlib found: YES 1.2.11
Native dependency libzstd found: YES 1.3.2
Library acl found: YES
Native dependency fuse found: YES 2.9.7
Dependency threads found: YES
Library m found: YES
Configuring config.h using configuration
Program sphinx-build-3 found: NO
Program sphinx-build found: YES (/usr/bin/sphinx-build)
Program sh found: YES (/bin/sh)
Program test-files/test-files.sh found: YES (/tmp/casync-2/test-files/test-files.sh)
Configuring test-script.sh using configuration
Program test-script.sh found: YES (/tmp/casync-2/build/test-script.sh)
Configuring test-script-sha256.sh using configuration
Program test-script-sha256.sh found: YES (/tmp/casync-2/build/test-script-sha256.sh)
Configuring test-script-gzip.sh using configuration
Program test-script-gzip.sh found: YES (/tmp/casync-2/build/test-script-gzip.sh)
Configuring test-script-xz.sh using configuration
Program test-script-xz.sh found: YES (/tmp/casync-2/build/test-script-xz.sh)
Configuring test-nbd.sh using configuration
Program test-nbd.sh found: YES (/tmp/casync-2/build/test-nbd.sh)
Configuring test-fuse.sh using configuration
Program test-fuse.sh found: YES (/tmp/casync-2/build/test-fuse.sh)
Configuring 75-casync.rules using configuration
Program git found: YES (/usr/bin/git)
Build targets in project: 22
Found ninja-1.8.2 at /usr/bin/ninja
'/tmp/casync-2/build/casync-https' -> 'casync-http'
'/tmp/casync-2/build/casync-ftp' -> 'casync-http'
'/tmp/casync-2/build/casync-sftp' -> 'casync-http'
...
$ ninja -C build
ninja: Entering directory `build'
[15/66] Compiling C object 'src/shared@sta/caencoder.c.o'.
FAILED: src/shared@sta/caencoder.c.o
cc  -Isrc/shared@sta -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O0 -g -Wextra -Werror=undef -Werror=format=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Werror=old-style-definition -Werror=pointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=shadow -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Werror=sign-compare -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -include config.h -fPIC -MMD -MQ 'src/shared@sta/caencoder.c.o' -MF 'src/shared@sta/caencoder.c.o.d' -o 'src/shared@sta/caencoder.c.o' -c ../src/caencoder.c
../src/caencoder.c: In function ‘ca_encoder_node_free’:
../src/caencoder.c:268:17: error: implicit declaration of function ‘freecon’ [-Werror=implicit-function-declaration]
                 freecon(n->selinux_label);
                 ^~~~~~~
../src/caencoder.c:268:17: warning: nested extern declaration of ‘freecon’ [-Wnested-externs]
../src/caencoder.c: In function ‘ca_encoder_node_read_selinux_label’:
../src/caencoder.c:662:13: warning: unused variable ‘r’ [-Wunused-variable]
         int r;
             ^
../src/caencoder.c:661:15: warning: unused variable ‘label’ [-Wunused-variable]
         char *label;
               ^~~~~
cc1: some warnings being treated as errors
[20/66] Compiling C object 'src/shared@sta/casync.c.o'.
ninja: build stopped: subcommand failed.

Local seed can't work when setting a chunk_size

HI,

This is really a work of art, and I'm gonna use it for file distribution. But recently I encountered a problem extracting .caidx file from remote. When using default chunk_size, extraction from remote server works pretty well with an exactly the same local seed. It goes like this...

$ bin/casync extract -v http://tosv.byted.org/obj/inf.bundle/chunk/test/1.0.0.caidx ~/test
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/1.0.0.caidx...
Seeding ./
Seeding .#197_0e590fe2_197.tar.gzfb1c07f53123bb2f
Seeded .#197_0e590fe2_197.tar.gzfb1c07f53123bb2f
Seeding 197_0e590fe2_197.tar.gz
Seeded 197_0e590fe2_197.tar.gz
Seeded ./
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/3868/3868660b7416ec4d239c8bf5a768e4a841840630d1b2f288d2b37770bab33984.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/8261/82610091911935064112266a4cb3b7665eec8fd76b024419e93933aaba9509bf.cacnk...
Extracting ./
Using feature flags: permissions
Excluding files with chattr(1) -d flag: yes
Excluding submounts: no
Digest algorithm: sha512-256
Extracting 197_0e590fe2_197.tar.gz
Extracted 197_0e590fe2_197.tar.gz
Extracted ./
Zero bytes written as sparse files: 36.7K
Bytes cloned through reflinks: 48.8M
Chunk requests fulfilled from local store: 0
Bytes used from local store: 0B
Chunk requests fulfilled from local seed: 778
Bytes used from local seed: 48.8M
Chunk requests fulfilled from remote store: 2
Bytes used from remote store: 119.9K

But when setting a chunk_size, like 1MB, local seed can't not work any more.

$ bin/casync extract -v http://tosv.byted.org/obj/inf.bundle/chunk/test/1.0.0.caidx ~/test
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/1.0.0.caidx...
Seeding ./
Seeding 197_0e590fe2_197.tar.gz
Seeded 197_0e590fe2_197.tar.gz
Seeded ./
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/f721/f7215709a07dead57703f60c370ed95ab142aeebe3e13da9501b3e0df511e302.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/947c/947c2bb717372f30705a8a59d97ef9817d8b39fb7488110fa9f76dad005833b8.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/59cb/59cb09d9269ab0bbae77663b8aefe10a93c0686a69176c9470d67e4f265c13ae.cacnk...
Extracting ./
Using feature flags: permissions
Excluding files with chattr(1) -d flag: yes
Excluding submounts: no
Digest algorithm: sha512-256
Extracting 197_0e590fe2_197.tar.gz
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/554c/554c671ff1aaabc6ab106881d0a9aca1fca7260421d109ece24b9cdaf5c19907.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/7070/70708807e28edddc04b8f25368e46de9175f196742f51b469f70eab7182e4e8b.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/4b17/4b17eb61ea11a2f2f91793d19d4021c87ed70941826a9da70826d68aa864bf7e.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/0c32/0c3267e39f69bf48a425adb2c6fae436a38fd66f82cc8789491eb8e0fdd3424b.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/fe1f/fe1f97b16407ac4699b5064ba3e171ef343333740a471cffd146e6484aaf12aa.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/931c/931c8c9c3af12464d7a74055c8851dca66aa4ce80a7114c29e74c2c76ee75886.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/4d5e/4d5e9f462f6f80d845f5adcfaaa0114d736564b694f3594a3da8c4445064c73c.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/830e/830efd015368dac241db5f60bbbdf3fc02558851c94306dbb0cf409e2b48e8b9.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/dfcf/dfcfa433ba6055bd3cbef0a04e19c1e13a43514571e9cefec810bf37cdfc172e.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/7d2e/7d2e374250997810a307f0654dd6cabb49c36bb4135471965990fd18d78497e5.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/c96c/c96c2d75785764e9c7d62e8b0562f0ee7b6d0fc848122a7ec7914a65c8b75cb4.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/23f2/23f219787e9fa775d34ef71ddc067c18ebf2ae12d52a4434080713d6699b403f.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/5e26/5e267b676c3171ddb27e3204beb77090aab7b3d9c66f1aabf55f16fd652df71f.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/a178/a1788c659e6f0dc8540b0b44c3613fd2b61302c4e63b9987ec59f8b391326917.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/4b68/4b680c8db35fff65bdb1995e0f3f96f007552f4b0d42aca78466b9d52b4b80c2.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/1083/10830d6184eb96875cf78936e6f3be03eb04796ae5dd340788b58ccecca3751d.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/075d/075dcd35dcc3c3ca937b071941287c6aef9d861fc1076db94aa0cbb8ac440d89.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/b0ec/b0ec9fc9feb97b97f2434b23beec3bf9b9158d28769289adafdccd89611b3c72.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/ac11/ac110a3cebb08288666995fe3061ec2a52927c501c4e158bbb4d61660ea416b7.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/9b01/9b0183f59bdc15348ed8ddffd9729cd7d8742d47f6c879dc1820d13261981236.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/8ab9/8ab98012f0259dda789f7076e36e7aa978c08fcdb10215ad50d5ce15fc98633b.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/c0fe/c0fe1ed5015d2a2b2fb1f16e0dcf3d7a18b18ba361fdd1c7cab4ba728f6a7100.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/5e7b/5e7bf1f903ee565c6109eb97fc5fa02b72133fa0d6a3c0d43af57e1590f39b9f.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/c804/c8046fe39f08197f3966546d45d41cb267eec0bde61aed149744d4417f7f9a00.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/042f/042f70bb4b86486bda15e0309cfd880b664d5f5b964d49d0714bd23e10256e07.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/25a9/25a9ccaee30520d517b0b48cc408d6f70147e7d4bfab1cdbc36e9528cedc2ea1.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/5bc4/5bc490c8196f4bdce35313cfa84ed0562d5a5a0e398ed63f7f632d71e49150e2.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/cbd6/cbd6b5ba8efa943e6593212ec2766afba02af94c2fadfff2b5dc5039fd42dc96.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/85f1/85f11aa43807dfc43b6d863002ee7fb72c216cb9bc2e65d3c96ed07d4a35b888.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/33d0/33d0c166f174321629760a8736267bc3f3f785f61bf9fc0049c2cde0edd5fed0.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/729a/729adcec46361a2522be3d7ba1e05dc52d0f357ef7d42830f2f8b08bfcb725dd.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/0c8f/0c8f04465c002e908f86b6583aff9554ba9ce116902bda553044550e8b65c5b0.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/1ae9/1ae902009b5c0428769f9321f272fd6e6928c3cfa375b5a28f85e4e7d34c0c02.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/d8d8/d8d824e454196d8ac4fe8b81163a696caa8163e831f41a647745ec07ad3ea24c.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/e3f8/e3f84f563825c5f8b8b19f917f6b7bc44d692b5bf866193f5339600a3246365b.cacnk...
Acquiring http://tosv.byted.org/obj/inf.bundle/chunk/test/default.castr/8936/89366ea0edbea5ffcbfa5f08ca8b5fa8edf3de3977556ae6918a3b44b3d0712f.cacnk...
Extracted 197_0e590fe2_197.tar.gz
Extracted ./
Zero bytes written as sparse files: 36.7K
Bytes cloned through reflinks: 0B
Chunk requests fulfilled from local store: 0
Bytes used from local store: 0B
Chunk requests fulfilled from local seed: 0
Bytes used from local seed: 0B
Chunk requests fulfilled from remote store: 39
Bytes used from remote store: 48.9M

Test version: v2.
local lib versions:

$ ldd bin/casync
        linux-vdso.so.1 (0x00007ffdbccab000)
        libacl.so.1 => /lib/x86_64-linux-gnu/libacl.so.1 (0x00007f18ef079000)
        libfuse.so.2 => /lib/x86_64-linux-gnu/libfuse.so.2 (0x00007f18eee3b000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f18eec15000)
        libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f18ee9f0000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f18ee7d5000)
        libzstd.so.1 => /usr/lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f18ee550000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f18ee24f000)
        libcrypto.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f18ede53000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f18edc36000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f18ed88b000)
        libattr.so.1 => /lib/x86_64-linux-gnu/libattr.so.1 (0x00007f18ed686000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f18ed482000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f18ed214000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f18ef282000)

There's definitely a bug here. I'm trying to solve this myself, but it seems a bit difficult for me. :(
Thanks for any help.

Unbounded amounts of "Chunk cache is not up-to-date, ignoring" log spam

When performing a multi-GB extraction (casync extract --what=blob-index root.caidx root.catar) to a preexisting output file, I have literally many tens of thousands of lines of Chunk cache is not up-to-date, ignoring.. Without details on how this is actionable to the user, it's effectively just spam.

Perhaps this should only be emitted up to once per file with -v in use, or up to once per session without -v?

Swappable compression tool

Hi.

Could casync take an option for a custom compression/decompression tool? lzma makes some speed tradeoffs that may not always be desirable (especially regarding decompression speed). Something similar to tar's -I, --use-compress-program=COMMAND would be nice.

Though allowing clients to auto-detect the decompression tool to use may require a change in the index format (or maybe use magic numbers to identify the compression format) . :-/

I would understand if using a single compression format was a intentional decision, but this was not mentioned in the blog post or the Readme.

Fails on Linux 3.13 (Ubuntu 14.04 kernel in semaphore) due to missing `renameat2()`

Some tests fail in semaphore as the kernel is rather old there. While Ubuntu 14.04 offers newer kernels, there is no way to install/reboot into them on semaphore, so we have to make-do.

strace can't decipher the syscall unfortunately, but the errno is "Function not implemented".

$ strace -fvvs1024 ./test-casync
[...]
syscall_316(0xffffff9c, 0x7fff0eee8990, 0xffffff9c, 0x7fff0eee8920, 0x1, 0x10eee8b80) = -1 (errno 38)
unlinkat(AT_FDCWD, "/var/tmp/teststore.90853f1e88177e2f/5473/54737747f8c1f940744a24119640f36973f79e2a4367fafea1b1d65d4c213ed3.ba0d1fbaf6ce9875.tmp", 0) = 0
unlinkat(AT_FDCWD, "/var/tmp/teststore.90853f1e88177e2f/5473", AT_REMOVEDIR) = 0
write(2, "Assertion failed: r >= 0\n", 25Assertion failed: r >= 0

The other tests also fail with "Function not implemented", so at first sight it's the same issue.

cc.has_header_symbol('linux/fs.h', 'struct file_clone_range') lies

Thanks for releasing casync. I was interested in trying it out for a versioned data archiving application.

Unfortunately I had an error while calling make, apparently in during the execution of the ninja command (see below).

Apologies in advance if this is an ignorant question.

I'm using Ubuntu 16.04 with Linux version 4.4.0-79-generic. While attempting to build casync I installed and upgraded meson and ninja to deal with earlier errors. The linux-libc-dev package that provide the files mentioned in the error are version 4.4.0-81.104, meson is version 0.41.1, and ninja is version 1.7.2, if that helps.

$ make
test -e build || meson build
ninja -C build
ninja: Entering directory `build'
[1/15] Compiling C object 'src/shared@sta/reflink.c.o'.
FAILED: src/shared@sta/reflink.c.o 
cc  -Isrc/shared@sta -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O0 -g -Wextra -Werror=undef -Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=shadow -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Wno-format-signedness -Werror=overflow -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -include config.h -fPIC -MMD -MQ 'src/shared@sta/reflink.c.o' -MF 'src/shared@sta/reflink.c.o.d' -o 'src/shared@sta/reflink.c.o' -c ../src/reflink.c
In file included from /usr/include/x86_64-linux-gnu/asm/ioctl.h:1:0,
                 from /usr/include/linux/ioctl.h:4,
                 from /usr/include/linux/fs.h:10,
                 from ../src/reflink.c:1:
../src/reflink.c: In function ‘reflink_fd’:
../src/util.h:597:37: error: invalid application of ‘sizeof’ to incomplete type ‘struct file_clone_range’
 #define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
                                     ^
../src/reflink.c:76:35: note: in expansion of macro ‘FICLONERANGE’
         if (ioctl(destination_fd, FICLONERANGE,
                                   ^
../src/reflink.c:78:27: error: unknown field ‘src_fd’ specified in initializer
                           .src_fd = source_fd,
                           ^
../src/reflink.c:78:37: warning: excess elements in struct initializer
                           .src_fd = source_fd,
                                     ^
../src/reflink.c:78:37: note: (near initialization for ‘(anonymous)’)
../src/reflink.c:79:27: error: unknown field ‘src_offset’ specified in initializer
                           .src_offset = source_offset,
                           ^
../src/reflink.c:79:41: warning: excess elements in struct initializer
                           .src_offset = source_offset,
                                         ^
../src/reflink.c:79:41: note: (near initialization for ‘(anonymous)’)
../src/reflink.c:80:27: error: unknown field ‘src_length’ specified in initializer
                           .src_length = size,
                           ^
../src/reflink.c:80:41: warning: excess elements in struct initializer
                           .src_length = size,
                                         ^
../src/reflink.c:80:41: note: (near initialization for ‘(anonymous)’)
../src/reflink.c:81:27: error: unknown field ‘dest_offset’ specified in initializer
                           .dest_offset = destination_offset,
                           ^
../src/reflink.c:81:42: warning: excess elements in struct initializer
                           .dest_offset = destination_offset,
                                          ^
../src/reflink.c:81:42: note: (near initialization for ‘(anonymous)’)
../src/reflink.c:82:19: error: invalid use of undefined type ‘struct file_clone_range’
                   }) < 0)
                   ^
ninja: build stopped: subcommand failed.
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 1

Easy way to --without=everything?

As suggested in the original blog post, I would like to include no metadata, as I only care about the actual names/blobs being stored.

For example, when shipping OS images, file access bits/ACLs and ownership matter, while file modification times hurt.

As far as I can work out, there's no way to ask for no metadata. The default seems to be --with=best:

% casync make -v ~/a.caidx 2>&1 | fgrep 'Using feature'
Using feature flags: 32bit-uids user-names nsec-time symlinks device-nodes fifos sockets flag-hidden flag-system flag-archive flag-append flag-noatime flag-compr flag-nocow flag-dirsync flag-immutable flag-sync flag-nocomp flag-projinherit flag-subvolume flag-subvolume-ro xattrs acl selinux fcaps

However, --without=best gets munged such that things are still present:

% casync make --without=best -v ~/a.caidx 2>&1 | fgrep 'Using feature'
Using feature flags: 16bit-uids usec-time permissions

Can start stripping these away:

% casync make --without=read-only --without=unix --without=best -v ~/a.caidx 2>&1 | fgrep 'Using feature'
Using feature flags: usec-time

Just time left, argh!

% casync make --without=usec-time --without=read-only --without=unix --without=best -v ~/a.caidx 2>&1 | fgrep 'Using feature'
Using feature flags: 2sec-time

...trying to remove usec-time turns on another time option? Argh! Eventually we get there:

% casync make --without=2sec-time --without=usec-time --without=read-only --without=unix --without=best -v ~/a.caidx 2>&1 | fgrep 'Using feature'
Using feature flags: none

How about a --without=everything? Or at least a --without=time that removes all four time options.

RFE: Ability to selectively copy chunk store

I suppose the following is as much of a question as a request for enhancement. Instead of extracting a caidx file from a remote location, I would like to copy it to a local chunk store and extract it from there. In other words, I don't want to copy the entire remote chunk store over, just the index file and the chunks referred to by it.

Is there a way to do this currently with casync, and if not are there plans to add this feature? Thanks in advance.

Cleanup chunk store after removing archive

There is currently no easy way to remove unused chunks from a chunk store (an equivalent to borg delete).

Scenario: a single chunk store is re-used for multiples archives (periodic backups, independent images using de-duplication, ...).
At some point, some archives are no longer required. The .cai?x files are deleted, but the chunks are still present in the chunk store. Some chunks are used by other archives, some aren't. A way to remove chunks not present in existing archives would allow to save space. On continuously used stores (daily backups with a fixed number of images kept), this can avoid wasting significant space.

EDIT: My bad, I suppose this is the (not implemented yet) casync gc mentioned in the Readme.

mtree: sha256 is not shown for last file

Hi,

the casync mtree <file.ctar> or casync mtree <folder> currently does not display the sha256 for the last file:

$ ls -l
insgesamt 8
-rw-r--r-- 1 stefan users 2  9. Apr 12:05 hallo.txt
-rw-r--r-- 1 stefan users 2  9. Apr 12:05 xyz.txt

All files have different checksums:

$ sha256sum *
73cb3858a687a8494ca3323053016282f3dad39d42cf62ca4e79dda2aac7d9ac  hallo.txt
3bb2abb69ebb27fbfe63c7639624c6ec5e331b841a5bc8c3ebc10b9285e90877  xyz.txt

Then the casync mtree command won't display the checksum for xyz.txt:

$ casync mtree /home/stefan/bin2
. type=dir mode=0755 uid=1000 gid=100 uname=stefan gname=users time=1491732563.382943691
hallo.txt type=file mode=0644 size=2 uid=1000 gid=100 uname=stefan gname=users time=1491732305.455201476 sha256digest=73cb3858a687a8494ca3323053016282f3dad39d42cf62ca4e79dda2aac7d9ac
xyz.txt type=file mode=0644 size=2 uid=1000 gid=100 uname=stefan gname=users time=1491732305.455201476

When I add zzz.txt the output of casync mtree is:

$ casync mtree /home/stefan/bin2
. type=dir mode=0755 uid=1000 gid=100 uname=stefan gname=users time=1491732778.156560244
hallo.txt type=file mode=0644 size=2 uid=1000 gid=100 uname=stefan gname=users time=1491732305.455201476 sha256digest=73cb3858a687a8494ca3323053016282f3dad39d42cf62ca4e79dda2aac7d9ac
xyz.txt type=file mode=0644 size=2 uid=1000 gid=100 uname=stefan gname=users time=1491732305.455201476 sha256digest=3bb2abb69ebb27fbfe63c7639624c6ec5e331b841a5bc8c3ebc10b9285e90877
zzz.txt type=file mode=0644 size=2 uid=1000 gid=100 uname=stefan gname=users time=1491732778.156560244

So the last checksum of a file in an archive or folder is not shown - hope this helps :)

test-nbd race condition hitting some automated tests causing a false-positive and a 30 minute hang

Hi,
I happend to find that e.g. on most automated tests in Ubuntu there was a fail on test-nbd like 1
This was independent to architecture and seemed to hit ~90% of the cases.

OTOH when one ran the tests locally I couldn't reproduce in 5/5 cases.
After a while I found that in the minimal environment that the autopkgtests (under kvm) there is a race.
The target that is made available is not yet ready when the subsequent dd tries to access it.

++ /tmp/autopkgtest.c37m28/build.c4y/casync-2/obj-x86_64-linux-gnu/notify-wait /tmp/autopkgtest.c37m28/build.c4y/casync-2/obj-x86_64-linux-gnu/c
  + MKDEV_PID=7357
  + /tmp/autopkgtest.c37m28/build.c4y/casync-2/obj-x86_64-linux-gnu/test-calc-digest sha512-256
  + dd if=/var/tmp/test-casync.rnd/test-node bs=102400 count=80
  0+0 records in
  0+0 records out
  0 bytes copied, 1,8723e-05 s, 0,0 kB/s

Furthermore this not only breaks the test to be bad (checksum doesn't match).
On top it causes the test to become a zombified process and then hang for ~30 minutes until meson gives up on it.

Zs ? 0:00 \_ [test-nbd.sh] <defunct>

A first try with a trivial sleep 5 solved all my cases, but I thought that might be a useless extra wait for fast CI runs.
So I implemented a simple retry with an initial sleep of 0s being a no-op in all non-affected cases.
But providing up to !5 sec race window for cases that are affected - which should be enough.

I'll provide a PR in a few minutes with a suggested fix.

'Failed to run synchronizer' errors when extracting over HTTP

Not sure if i'm just being silly here or what.

I'm experimenting with casync, trying to extract over HTTP a caidx which is basically an Ubuntu server image. Both the server and the client are running Ubuntu 16.04 (Xenial), with casync built from master (this commit, specifically). The server is offering the files via HTTP using a pretty much out-of-the-box nginx set-up.

File system on server:

% ls -Al /srv/casync
total 4124
-rw-r--r--     1 root root 1237504 Nov 27 23:43 fw.caidx
-rw-r--r--     1 root root 1196024 Nov 27 23:39 fw2.caidx
-rw-r--r--     1 root root 1240224 Nov 27 23:52 fw3.caidx
drwxr-xr-x 29324 root root  540672 Nov 27 23:52 default.castr/

I have a similar image already on my client's disk, so i'm trying to seed with that. When i do so, i find that i very consistently get a 'broken pipe' error, seemingly indicating that casync is failing to retrieve the full index file. Here's what it looks like:

Commands run on client:

% sudo mkdir /data/fw
% {
> date
> sudo casync -v --seed=/data/myfw extract http://172.17.1.213/fw.caidx /data/fw
> date
> } 2>&1 | tee casync.log

Output on client:

Tue 28 Nov 00:57:15 CST 2017
Acquiring http://172.17.1.213/fw.caidx...
Seeding ./
Seeded ./
Seeding ./
Seeding bin
...
Seeded var/www
Seeded var
Seeding vmlinuz
Seeded vmlinuz
Seeded ./
Failed to acquire http://172.17.1.213/fw.caidx
Failed to run synchronizer: Broken pipe
Tue 28 Nov 01:00:08 CST 2017

Web-server logs on server:

172.17.66.1 - - [28/Nov/2017:00:58:15 -0600] "GET /fw.caidx HTTP/1.1" 200 493499 "-" "-"

Note that 493499 is not the full size of fw.caidx. (Note also that the error is not actually returned until it finishes the seeding process almost 2 minutes later — that's kind of bothersome.)

I keep running this over and over and keep getting similar results — casync only ever gets between maybe 400 and 700 kB of the index file, and then it gives that broken-pipe error. If i retrieve the index file with curl it works fine, i get the full size shown in the log and it matches on the client.

I thought i would try the same thing but without the seeding bit, and it does seem to get further (in that i have a bunch of files extracted on the client), but now i get a different error:

Commands run on client:

% sudo mkdir /data/fw
% {
> date
> sudo casync -v extract http://172.17.1.213/fw.caidx /data/fw
> date
> } 2>&1 | tee casync.log

Output on client:

Tue 28 Nov 01:06:43 CST 2017
Acquiring http://172.17.1.213/fw.caidx...
Seeding ./
Seeded ./
Acquiring http://172.17.1.213/default.castr/7634/7634a8d3b747c84fa60c779497e95793a346603553af87b208e2abe0a59b620d.cacnk...
Acquiring http://172.17.1.213/default.castr/25fa/25fa6d80a0f122d8f0473dda8bf9a8d8703a875107e299b6f84730e11020928d.cacnk...
Acquiring http://172.17.1.213/default.castr/fd27/fd2741d59d832c5e81afd57122d0c648a5189cd3775d3df321fb6fcff243e37e.cacnk...
Extracting ./
Using feature flags: 32bit-uids user-names nsec-time symlinks device-nodes fifos sockets flag-hidden flag-system flag-archive flag-append flag-noatime flag-compr flag-nocow flag-dirsync flag-immutable flag-sync flag-nocomp flag-projinherit flag-subvolume flag-subvolume-ro xattrs acl selinux fcaps
Excluding files with chattr(1) -d flag: yes
Excluding submounts: no
Digest algorithm: sha512-256
...
Extracting etc/depmod.d/ubuntu.conf
Extracted etc/depmod.d/ubuntu.conf
Extracted etc/depmod.d
Extracting etc/dhcp
Extracting etc/dhcp/ddns-keys
Extracted etc/dhcp/ddns-keys
Failed to run synchronizer: No such process
Tue 28 Nov 01:06:52 CST 2017

The Web-server logs show something like 1000 chunks being fetched. I spot-checked the last few and they all seem to have returned the correct size, so it's not that. I guess don't know what the 'process' it's referring to is.

Any ideas as to how i could troubleshoot further? Thanks!

make libfuse optional again

meson build gives me

Meson encountered an error in file meson.build, line 105, column 8:
Native dependency 'fuse' not found

This used to work in earlier versions.

extracting char devices: Failed to run synchronizer: Operation not supported

I am using the git-master version: 6daefa8

$ sudo /home/alban/bin/casync make --store=/home/alban/tmp/casync-test/store rootfs.caidx rootfs
b3af845d0620bab9b8e83d7f2380e740fe6e9ddc478ffed1622883808502c2e0
$ sudo /home/alban/bin/casync extract --store=/home/alban/tmp/casync-test/store ./rootfs.caidx rootfs2/
Failed to run synchronizer: Operation not supported

strace | grep EOPNOTSUPP gives 2 kinds of errors:

setxattr("/proc/self/fd/9", "system.posix_acl_access", "\2\0\0\0\1\0\7\0\377\377\377\377\4\0\7\0\377\377\377\377 \0\7\0\377\377\377\377", 28, 0) = -1 EOPNOTSUPP (Operation not supported)
ioctl(9, BTRFS_IOC_CLONE_RANGE or FICLONERANGE, {src_fd=11, src_offset=0, src_length=0, dest_offset=0}) = -1 EOPNOTSUPP (Operation not supported)

But the FICLONERANGE one was supposed to be fixed in #20 so I don't know what it is...

The last lines with --verbose give:

Extracting dev
Extracting dev/agpgart
Extracted dev/agpgart
Failed to run synchronizer: Operation not supported

The rootfs directory was generated with:

$ docker2aci docker://ubuntu
$ sudo tar xf library-ubuntu-latest.aci
$ ls -l rootfs/dev/ | head
total 8
crw-rw----. 1 root      44 10, 175 Sep 15 11:53 agpgart
crw-rw----. 1 root rpcuser 14,   4 Sep 15 11:53 audio
crw-rw----. 1 root rpcuser 14,  20 Sep 15 11:53 audio1
crw-rw----. 1 root rpcuser 14,  36 Sep 15 11:53 audio2
crw-rw----. 1 root rpcuser 14,  52 Sep 15 11:53 audio3
crw-rw----. 1 root rpcuser 14,   7 Sep 15 11:53 audioctl
crw-------. 1 root tty      5,   1 Sep 15 11:53 console
lrwxrwxrwx. 1 root root         11 Sep 15 11:53 core -> /proc/kcore
crw-rw----. 1 root rpcuser 14,   3 Sep 15 11:53 dsp

Any idea how to debug this? Could this be a problem with character devices? The error message is not very explicit.

Can this replace zsync?

With zsync, one .zsync file is all that needs to be hosted on the server, in addition to the file to be distributed. Can the same be achieved with casync?

Use case would be AppImageUpdate which is currently using zsync.

Ubuntu ppa

Can we get a ppa for casync as soon as the first release is made?
I'm looking at you, @martinpitt :)

--without selinux needed if casync built with -Dselinux=false

I have built casync without the selinux support and when I tried to run
casync make mydir.caidx mydir it failed with Failed to run synchronizer: Operation not supported because it tries to store selinux labels. Fix is to run the command with --without=selinux but shouldn't it be that if built withoiut selinux then the --without=selinux is implied and not needed? I am happy to look into it and provide a patch, but asking before I dive into it.

casync does not work on fuse mount ?

Hello,
casync list /mnt/
Failed to run synchronizer: Invalid argument

/mnt is fuse block parition ( ntfs3g ) .
qcow image as mount as block device via qemu-nbd, then mount via ntfs3g
/dev/nbd0 on /mnt type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)

Regards,
Nicolas

some tests fail

cloned repo as of some minutes ago. Build host is openSUSE tumbleweed. Needed to install meson, ninj, libacl-devel and fuse-devel, build went okay then, configure showed these "NOs":

Checking for function "renameat2": NO
Checking for function "copy_file_range": NO

(active kernel is 4.4.x)

Running "ninja test" in the build directory, gives failing tests:

test-script.sh and test-fuse.sh fail with Failed to run synchronizer: Operation not supported after logs of Processing / Extracting output.

test-casync fails with this full output
`10/12 test-casync FAIL 4.61 s

--- command ---
/usr/src/casync/build/test-casync
--- stderr ---
Assertion failed: r >= 0
-------`

double-free in stat command

Trying to casync stat a file inside an index crashes for me with a double free:

casync stat /some/foo.caidx some/file/in/index.h
    File: some/file/in/index.h
    Mode: -rw-rw-rw-
FileAttr: ----------
 FATAttr: ---
  Offset: 1606648
    Size: 4986
*** Error in `casync': double free or corruption (!prev): 0x0000562ab6b1f5f0 ***
======= Backtrace: =========
...

Address sanitizer catches this:

~/code/casync% meson -Db_sanitize=address build && cd build && ninja 
...
~/code/casync/build% ./casync make foo.caidx && ./casync stat foo.caidx config.h                                                               
84affa9fb45842a90aa14433a09d0ed917ab567c74bb4d796d958699d465c786
    File: config.h
    Mode: -rw-r--r--
FileAttr: ----------
 FATAttr: ---
  Offset: 2539793
    Time: 2017-09-04 08:34:26.259305693
    Size: 480
    User: faux (1000)
   Group: faux (1000)
=================================================================
==4040==ERROR: AddressSanitizer: attempting double-free on 0x60200000ee90 in thread T0:
    #0 0x7f6df0d17b60 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc6b60)
    #1 0x55b087cc5835 in verb_list ../src/casync-tool.c:2320
    #2 0x55b087ccc72d in dispatch_verb ../src/casync-tool.c:3992
    #3 0x55b087cccb4e in main ../src/casync-tool.c:4025
    #4 0x7f6def20d3f0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x203f0)
    #5 0x55b087cbb5b9 in _start (/home/faux/code/casync/build/casync+0x245b9)

0x60200000ee90 is located 0 bytes inside of 9-byte region [0x60200000ee90,0x60200000ee99)
freed by thread T0 here:
    #0 0x7f6df0d17b60 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc6b60)
    #1 0x55b087cc5165 in verb_list ../src/casync-tool.c:2184
    #2 0x55b087ccc72d in dispatch_verb ../src/casync-tool.c:3992
    #3 0x55b087cccb4e in main ../src/casync-tool.c:4025
    #4 0x7f6def20d3f0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x203f0)

previously allocated by thread T0 here:
    #0 0x7f6df0d18270 in __interceptor_realloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc7270)
    #1 0x55b087d23265 in ca_decoder_current_path ../src/cadecoder.c:4514
    #2 0x55b087cf9c2a in ca_sync_current_path ../src/casync.c:2899
    #3 0x55b087cc4670 in verb_list ../src/casync-tool.c:2030
    #4 0x55b087ccc72d in dispatch_verb ../src/casync-tool.c:3992
    #5 0x55b087cccb4e in main ../src/casync-tool.c:4025
    #6 0x7f6def20d3f0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x203f0)

SUMMARY: AddressSanitizer: double-free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc6b60) in __interceptor_free
==4040==ABORTING

I'm building v2-8-g22d9651 with clang 3.9.1-ubuntu on amd64 Ubuntu Zesty (17.04). The initial, non-asan crash is from Ubuntu Artful's official build of casync 2.

Skip unused blocks when making images of block devices

I'm not sure if this is already implemented.

Essentially it would be really useful if casync would make use of information that the filesystem has about which blocks of a partition are actually used and which aren't. This allows to save huge amounts of space in the image if the filesystem doesn't contain a lot of data.

Similar to what partimage does.

Empty local store + ssh extra store => "Protocol driver not attached"

I'm attempting to extract content with both a local store and a remote extra store. Thus, usage looks something like:

casync extract \
  --store=/local/path \
  --extra-store=server:/remote/path \
  test-blob.caibx \
  test-blob

If I leave out --store=/local/path and instead pass --store=server:/remote/path, then we do in fact connect to the server. With the remote repository only provided as an "extra" read-only store, however, the client never connects, and the following error is emitted:

Failed to run synchronizer: Protocol driver not attached

A squashfs experiment

Hello

I just did a little experimenting with casync and squashfs, to check the potential.

So I used the ArchLinux netboot squashfs as the base.

$ unsquashfs airootfs.sfs
Parallel unsquashfs: Using 4 processors
53900 inodes (56523 blocks) to write
[======] 56523/56523 100%

created 45748 files
created 3642 directories
created 5827 symlinks
created 0 devices
$ du -hs squashfs-root/
1,2G	squashfs-root/

Then I created 2 near indenticaly squashfs files from that folder:

$ mksquashfs squashfs-root/ foo.squashfs -comp xz
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on foo.squashfs, block size 131072.
[======] 50696/50696 100%

Exportable Squashfs 4.0 filesystem, xz compressed, data block size 131072
	compressed data, compressed metadata, compressed fragments, compressed xattrs
	duplicates are removed
Filesystem size 384621.17 Kbytes (375.61 Mbytes)
	35.17% of uncompressed filesystem size (1093687.08 Kbytes)
Inode table size 419016 bytes (409.20 Kbytes)
	21.86% of uncompressed inode table size (1917191 bytes)
Directory table size 498974 bytes (487.28 Kbytes)
	38.32% of uncompressed directory table size (1302032 bytes)
Number of duplicate files found 3835
Number of inodes 55217
Number of files 45748
Number of fragments 3469
Number of symbolic links  5827
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 3642
Number of ids (unique uids + gids) 1
Number of uids 1
	kristian (1000)
Number of gids 1
	kristian (1000)
$ dd if=/dev/urandom of=squashfs-root/foo bs=1M count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB, 10 MiB) copied, 0.121452 s, 86.3 MB/s
$ rm squashfs-root/etc/*.conf
$ mksquashfs squashfs-root/ foo2.squashfs -comp xz
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on foo2.squashfs, block size 131072.
[======] 50741/50741 100%

Exportable Squashfs 4.0 filesystem, xz compressed, data block size 131072
	compressed data, compressed metadata, compressed fragments, compressed xattrs
	duplicates are removed
Filesystem size 394833.51 Kbytes (385.58 Mbytes)
	35.77% of uncompressed filesystem size (1103835.71 Kbytes)
Inode table size 419028 bytes (409.21 Kbytes)
	21.87% of uncompressed inode table size (1916421 bytes)
Directory table size 498894 bytes (487.20 Kbytes)
	38.33% of uncompressed directory table size (1301745 bytes)
Number of duplicate files found 3830
Number of inodes 55183
Number of files 45714
Number of fragments 3469
Number of symbolic links  5827
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 3642
Number of ids (unique uids + gids) 1
Number of uids 1
	kristian (1000)
Number of gids 1
	kristian (1000)

So now I have:

$ du -h foo*
386M	foo2.squashfs
376M	foo.squashfs

Now lets create some casync archive (??):

$ casync make --chunk-size=131072 foo.caibx foo.squashfs
9417639da34e16fb4fc11ff332bf7facd080240116129d716463c08d18c99f2a
$ du -hs default.castr/
393M	default.castr/
$ casync make --chunk-size=131072 foo2.caibx foo2.squashfs
f1e3f13669f2c49864c537da04ada35112b15cc2ce1f4ba08b98acb2a1b8483f
$ du -hs default.castr/
625M	default.castr/

So it is reusing: (foo.squashfs+foo2.squashfs-total) = 376+386-625=137 MB worth of chunks or in other words, the client can save 35% traffic (137/386*100).

35% doesen't seems that high, considering the very minimal changes to the filesystem.
Do you think this can be improved?

-- Kristian

Tests fail on arch Linux

in test-script.sh the following command fails (I removed the -q flag to find out the difference)

+ diff /var/tmp/test-casync.9890/test.digest /var/tmp/test-casync.9890/test.extract-caidx.digest
1c1
< 95763f29590ff8718edf4a0f499c4d18e5bf05d19ff4255f85f81b1e886af14c
---
> 01e203e9c0fd406309db5cfc2e809b8a9cf67a7b9056bf55b9dd47664a38c4c4

So that's the following line:

diff -q $SCRATCH_DIR/test.digest $SCRATCH_DIR/test.caidx.digest

Full log:

https://gist.github.com/arianvp/38863afa6040d8246c331e0b7496b97a

All the other tests succeed

provide more detail on failure during extraction

I get this when trying to run an extract of a rather large set of ISOs (some 30gb).

Failed to run synchronizer: Operation not permitted

Given the number of syscalls, I'd rather not trouble shoot with strace :)

Additionally, it might be nice if it could continue trying to extract further files (which might succeed) even though this one particular file failed.

casync is FTBFS on Fedora Rawhide

../src/canbd.c: In function 'ca_block_device_establish_friendly_name':
../src/canbd.c:179:13: error: implicit declaration of function 'writev'; did you mean 'write'? [-Werror=implicit-function-declaration]
         n = writev(d->friendly_name_fd, (struct iovec[]) {
             ^~~~~~
             write
../src/canbd.c:179:13: warning: nested extern declaration of 'writev' [-Wnested-externs]

RFE: Ability to build caidx from catar

For installation performance (streaming one file being considerably faster than a multitude of little ones), I was intending to generate a .catar as part of my build process, archiving it to a .caidx for regeneration of historical builds.

However, it doesn't appear to be possible to build a .caidx directly from a .catar without an interim unpack or FUSE-mounting step:

$ casync make test.caidx root.catar
Input is a regular file or block device, but attempted to make a directory archive. Refusing.
$ casync make --what=archive-index test.caidx --what=archive root.catar
Input is a regular file or block device, but attempted to make a directory archive. Refusing.

Does this mean I'm obliged to generate a .caidx at build time and then build a .catar from that, if intending to have both as build products?

Casync and NTFS filesytem

Hello,
Is it possible to use casync with ntfs filesystem throught ntfs3g for example, we need all casync features to synchronise windows filesystem
Regards,
Nicolas

Please provide a changelog

So I as packager and the users know what has changed and what we need to change in our workflow. Thanks!

Next step for Content Defined Chunking

Hi,
In 2012 I also developed a method of some segmentation.
The basic idea is to combine multiple functions-predicates in the moving window, in order to obtain a better size segments.
Behind all this there is some math, but rather simple and boring.

Later the intention was to patent some applications of this approach. But I refused and now it is completely free of patents.

Below links to slides, unfortunately only in Russian.
But there are enough graphs and formulas, to understand about the idea.

Let me know if you are interested, I will translate materials to English.

The result = https://image.slidesharecdn.com/random-161106145116/95/-18-638.jpg
The entire presentation = https://www.slideshare.net/leoyuriev/ss-68259503

UPDATE: Some translation by Google = https://translate.google.com/translate?act=url&ie=UTF8&sl=ru&tl=en&u=http://www.highload.ru/2016/abstracts/2263.html

Regards.

extract and use a local store as a cache

The documentation just says:

--extra-store=: Additional chunk store to look for chunks in

But it does not say how casync decides the priority between the main store (--store= or $CASYNC_STORE) and the extra stores.

My use case is to extract the data from a remote (http://172.17.0.2/rootfs.caidx) and use the remote store as necessary (--store=http://172.17.0.2/store/) but with a local cache (--extra-store=/var/cache/casync/store/) common to all my images. I want to populate the local cache with the missing chunks whenever I run the casync extract command.

So when I run casync extract a second time, it does not need to download big files from the remote store a second time. But it does not seem to update the local store with the missing chunks...

Is there a combination of options to achieve that?

Bus error on sparc64

Tests are failing on sparc64 due to a bus error:

Processed casync/test-files
+ diff -q /var/tmp/test-casync.20172/original-seek.digest /var/tmp/test-casync.20172/extract-seek-catar.digest
+ diff -q /var/tmp/test-casync.20172/original-seek.digest /var/tmp/test-casync.20172/extract-seek-caidx.digest
+ diff -q /var/tmp/test-casync.20172/original-seek.digest /var/tmp/test-casync.20172/extract-seek-catar-direct.digest
+ diff -q /var/tmp/test-casync.20172/original-seek.digest /var/tmp/test-casync.20172/extract-seek-caidx-direct.digest
+ diff -q /var/tmp/test-casync.20172/original-seek.mtree /var/tmp/test-casync.20172/extract-seek-catar.mtree
+ diff -q /var/tmp/test-casync.20172/original-seek.mtree /var/tmp/test-casync.20172/extract-seek-caidx.mtree
+ CASYNC_SSH_PATH=/<<BUILDDIR>>/casync-1+65/test/pseudo-ssh
+ export CASYNC_SSH_PATH
+ CASYNC_REMOTE_PATH=/<<BUILDDIR>>/casync-1+65/obj-sparc64-linux-gnu/casync
+ export CASYNC_REMOTE_PATH
+ /<<BUILDDIR>>/casync-1+65/obj-sparc64-linux-gnu/casync -v --without=privileged --digest=sha256 list localhost:/var/tmp/test-casync.20172/test.caidx
Selected chunk sizes: min=16384..avg=65536..max=262144
-�Using feature flags: nsec-time permissions symlinks fifos sockets flag-hidden flag-archive flag-noatime flag-compr flag-nocow flag-dirsync flag-sync flag-nocomp flag-projinherit xattrs
Excluding files with chattr(1) -d flag: yes
Excluding submounts: no
Digest algorithm: sha256
/<<BUILDDIR>>/casync-1+65/obj-sparc64-linux-gnu/test-script.sh: line 138: 58494 Bus error               "/<<BUILDDIR>>/casync-1+65/obj-sparc64-linux-gnu"/casync $PARAMS list localhost:$SCRATCH_DIR/test.caidx > $SCRATCH_DIR/test-remote.caidx.list

Full log here:
https://buildd.debian.org/status/fetch.php?pkg=casync&arch=sparc64&ver=1%2B65-1&stamp=1500566201&raw=0

(Yes, you can now apt-get install casync on your debian system :)

doc: s3 support - sync, backup, mount

Reading the repo readme wiki, it is not clear if the following can be achieved.

  1. casync a local disk/fs to aws s3 bucket, as chunks and index.
  2. later casync another backup to s3, sending only diff/different chunks ?
  3. mount over https a remote s3 casync as a local filesystem ?

It seems all the components might be there.

test-script.sh fails 1/11: Failed to run synchronizer: Operation not supported

I'm testing current casync git master on current Debian unstable. Building is fine and it generally works, but ninja -C build test fails: one test:

 1/11 test-script.sh                          FAIL    40.53 s
[...]
+ /home/martin/upstream/casync/build/casync -v --without=privileged extract /var/tmp/test-casync.25039/test.caidx --seed=/var/tmp/test-casync.25039/extract-caidx /
var/tmp/test-casync.25039/extract-caidx2
[...]
Can't reproduce name table for GOODBYE record, ignoring.
Extracting casync/.git/logs/refs/remotes
Extracting casync/.git/logs/refs/remotes/origin
Extracting casync/.git/logs/refs/remotes/origin/HEAD
Extracted casync/.git/logs/refs/remotes/origin/HEAD
Extracted casync/.git/logs/refs/remotes/origin
Extracted casync/.git/logs/refs/remotes
Extracted casync/.git/logs/refs
Extracted casync/.git/logs
Extracting casync/.git/objects
Extracting casync/.git/objects/info
Extracted casync/.git/objects/info
Extracting casync/.git/objects/pack
Extracting casync/.git/objects/pack/pack-7fd33197e2a8fce8f83843897392f59b4933d3fb.idx
Extracted casync/.git/objects/pack/pack-7fd33197e2a8fce8f83843897392f59b4933d3fb.idx
Failed to run synchronizer: Operation not supported

mtree: invalid keyword (for sha256)

from casync mtree myhost.caidx:
one of the type=file entries has a sha512256digest=b6d59d2d0a0d29fa315bcfcc05e7885e1d29acab6b72d5ce01777364c3aa0980

That should be sha256digest=. And while some BSD versions don't support it yet, go-mtree does support a sha512digest= keyword.

documentation: flag-noatime unclear

With the negative phrasing, it's not clear whether I have to use --with=flag-noatime or --without=flag-noatime in order to disable access time:

       --with=<flag-noatime>
              Store disable access time file flag

"Store disable access time" is also not clear.

"noatime" is an attribute of mounts and not of files, so it's not clear what it does.

What do I have to use to disable atime, mtime and ctime information in the serialization?

errors with -Werror=nonnull

Compilation with -Werror=nonnull gives this error:

[   12s] [17/66] cc  -Isrc/shared@sta -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=gnu99 -Wextra -Werror=undef -Werror=format=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Werror=old-style-definition -Werror=pointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=shadow -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Werror=sign-compare -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -include config.h -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -fPIC -MMD -MQ 'src/shared@sta/caremote.c.o' -MF 'src/shared@sta/caremote.c.o.d' -o 'src/shared@sta/caremote.c.o' -c ../src/caremote.c
[   12s] FAILED: src/shared@sta/caremote.c.o 
[   12s] cc  -Isrc/shared@sta -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=gnu99 -Wextra -Werror=undef -Werror=format=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Werror=old-style-definition -Werror=pointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=shadow -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Werror=sign-compare -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -include config.h -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -fPIC -MMD -MQ 'src/shared@sta/caremote.c.o' -MF 'src/shared@sta/caremote.c.o.d' -o 'src/shared@sta/caremote.c.o' -c ../src/caremote.c
[   12s] In file included from ../src/caformat-util.h:7:0,
[   12s]                  from ../src/caremote.c:8:
[   12s] ../src/caremote.c: In function ‘ca_remote_forget_chunk’:
[   12s] ../src/util.h:471:13: error: argument 1 null where non-null expected [-Werror=nonnull]
[   12s]          if (strncmp(s, prefix, l) == 0)
[   12s]              ^~~~~~~~~~~~~~~~~~~~~
[   12s] In file included from ../src/util.h:12:0,
[   12s]                  from ../src/caformat-util.h:7,
[   12s]                  from ../src/caremote.c:8:
[   12s] /usr/include/string.h:139:12: note: in a call to function ‘strncmp’ declared here
[   12s]  extern int strncmp (const char *__s1, const char *__s2, size_t __n)
[   12s]             ^~~~~~~
[   12s] cc1: some warnings being treated as errors
[   13s] [18/66] cc  -Isrc/shared@sta -Isrc -I../src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=gnu99 -Wextra -Werror=undef -Werror=format=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Werror=old-style-definition -Werror=pointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=shadow -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Werror=sign-compare -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -include config.h -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -fPIC -MMD -MQ 'src/shared@sta/casync.c.o' -MF 'src/shared@sta/casync.c.o.d' -o 'src/shared@sta/casync.c.o' -c ../src/casync.c
[   13s] ninja: build stopped: subcommand failed.

Unable to mount remote archives

Hallo, I am trying out casync for the first time, both on Debian Testing and Fedora 27, by compiling from sources (from master).

Maybe I am missing something obvious, but on both systems, when I try the following:

./casync make ~/build.catar /home/matteo/Projects/proj/__build__/
mkdir -p mnt && ./casync mount localhost:/home/matteo/build.catar mnt

I always get:

Mounted: mnt
The following feature flags are not exposed in the mounted file system: user-names flag-subvolume flag-subvolume-ro acl selinux fcaps
Failed to seek for stat to /: Operation not supported
Failed to seek for stat to /: Operation not supported
Failed to seek for stat to /: Operation not supported
[last line repeated several times]

Trying to mount the catar locally succeeds without problems. The same happens when using HTTP as a transport, with python -m SimpleHTTPServer as a provider.

Any help would be appreciated.

Strategy for pruning

He explain it very well, we need some tool which can delete unused chunks (== not referred by any archive).

What I didn't find in the blog post is a strategy for pruning chunks - specifically one that would work well for CDNs and mirror operators. Reasonable strategies could be devised without any extra effort of course (e.g. ctime/atime based), but perhaps the format could accommodate more elaborate algorithms?
https://lwn.net/Articles/726027/

«casync make» deadlocks when using «host:foo.caidx» pseudo-URL

When using a home-directory relative SSH pseudo-URL, as in casync make host:foo.caidx $srcdir, casync appears to deadlock. According to strace, the local process blocks in ppoll, while the remote process is indefinitely blocked on read. Using the equivalent destination, host:/home/$user/foo.caidx will work.

Test timeout on mips64el

   dh_auto_test -a
        ninja test
[0/1] Running all tests.
 1/14 test-script.sh                          OK      633.39 s
 2/14 test-script-sha256.sh                   OK      636.46 s
 3/14 test-nbd.sh                             OK      177.02 s
 4/14 test-fuse.sh                            OK      305.71 s
 5/14 test-cachunk                            OK       6.05 s
 6/14 test-cachunker                          OK       2.25 s
 7/14 test-cachunker-histogram                OK       2.57 s
 8/14 test-cadigest                           OK      10.35 s
 9/14 test-caencoder                          OK       0.62 s
10/14 test-camakebst                          OK      19.00 s
11/14 test-caorigin                           OK       0.12 s
12/14 test-casync                             TIMEOUT 120.20 s
13/14 test-cautil                             OK       0.11 s
14/14 test-util                               OK       0.11 s

OK:        13
FAIL:       1
SKIP:       0
TIMEOUT:    1


The output from the failed tests:

12/14 test-casync                             TIMEOUT 120.20 s

Full log at
https://buildd.debian.org/status/fetch.php?pkg=casync&arch=mips64el&ver=1%2B65-1&stamp=1500580132&raw=0

test-casync runs faster than test-camakebst on my amd4 machine so maybe there is a real problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.