summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-admin')
-rw-r--r--app-admin/clsync/ChangeLog8
-rw-r--r--app-admin/clsync/clsync-0.4-r1.ebuild115
-rw-r--r--app-admin/clsync/files/clsync-0.4-retries-arg.patch13
-rw-r--r--app-admin/clsync/files/clsync-0.4-strtol.patch179
4 files changed, 314 insertions, 1 deletions
diff --git a/app-admin/clsync/ChangeLog b/app-admin/clsync/ChangeLog
index cccf8ba15038..aa576823ad4c 100644
--- a/app-admin/clsync/ChangeLog
+++ b/app-admin/clsync/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for app-admin/clsync
# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-admin/clsync/ChangeLog,v 1.1 2015/02/11 03:39:24 bircoph Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-admin/clsync/ChangeLog,v 1.2 2015/02/20 18:36:49 bircoph Exp $
+
+*clsync-0.4-r1 (20 Feb 2015)
+
+ 20 Feb 2015; Andrew Savchenko <bircoph@gentoo.org> +clsync-0.4-r1.ebuild,
+ +files/clsync-0.4-retries-arg.patch, +files/clsync-0.4-strtol.patch:
+ Apply upstream fixes to parser bugs.
*clsync-0.4 (11 Feb 2015)
diff --git a/app-admin/clsync/clsync-0.4-r1.ebuild b/app-admin/clsync/clsync-0.4-r1.ebuild
new file mode 100644
index 000000000000..d386b3213fc3
--- /dev/null
+++ b/app-admin/clsync/clsync-0.4-r1.ebuild
@@ -0,0 +1,115 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/clsync/clsync-0.4-r1.ebuild,v 1.1 2015/02/20 18:36:49 bircoph Exp $
+
+EAPI=5
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/xaionaro/${PN}.git"
+else
+ SRC_URI="https://github.com/xaionaro/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+fi
+
+inherit autotools eutils linux-info
+
+DESCRIPTION="Live sync tool based on inotify, written in GNU C"
+HOMEPAGE="https://github.com/xaionaro/clsync http://ut.mephi.ru/oss/clsync"
+LICENSE="GPL-3+"
+SLOT="0"
+IUSE="+caps cluster control-socket cgroups debug doc +examples
+extra-hardened gio hardened +highload-locks +inotify mhash
+namespaces seccomp"
+
+REQUIRED_USE="
+ || ( gio inotify )
+ extra-hardened? ( hardened )
+ mhash? ( cluster )"
+
+RDEPEND="
+ dev-libs/glib:2
+ cgroups? ( dev-libs/libcgroup )
+ mhash? ( app-crypt/mhash )
+"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( ~app-doc/clsync-docs-${PV} )
+"
+
+pkg_pretend() {
+ use namespaces && CONFIG_CHECK="~NAMESPACES ~UTS_NS ~IPC_NS ~USER_NS ~PID_NS ~NET_NS"
+ use seccomp && CONFIG_CHECK+=" ~SECCOMP"
+ check_extra_config
+}
+
+src_prepare() {
+ # upstream fixes for 0.4
+ epatch \
+ "${FILESDIR}/${P}-gio.patch" \
+ "${FILESDIR}/${P}-unshare-configure.patch" \
+ "${FILESDIR}/${P}-unshare-ifdef.patch" \
+ "${FILESDIR}/${P}-version.patch" \
+ "${FILESDIR}/${P}-direct_mode.patch" \
+ "${FILESDIR}/${P}-handler_path.patch" \
+ "${FILESDIR}/${P}-hl_locks.patch" \
+ "${FILESDIR}/${P}-unset_env.patch" \
+ "${FILESDIR}/${P}-unused-deps.patch" \
+ "${FILESDIR}/${P}-retries-arg.patch" \
+ "${FILESDIR}/${P}-strtol.patch"
+ eautoreconf
+}
+
+src_configure() {
+ local harden_level=0
+ use hardened && harden_level=1
+ use extra-hardened && harden_level=2
+
+ econf \
+ --docdir="${EPREFIX}/usr/share/doc/${PF}" \
+ --disable-socket-library \
+ --enable-clsync \
+ --enable-paranoid=${harden_level} \
+ --without-bsm \
+ --without-kqueue \
+ $(use_enable caps capabilities) \
+ $(use_enable cluster) \
+ $(use_enable control-socket socket) \
+ $(use_enable debug) \
+ $(use_enable highload-locks) \
+ $(use_enable namespaces unshare) \
+ $(use_enable seccomp) \
+ $(use_with cgroups libcgroup) \
+ $(use_with gio gio lib) \
+ $(use_with inotify inotify native) \
+ $(use_with mhash)
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+
+ # remove unwanted docs
+ rm "${ED}/usr/share/doc/${PF}/LICENSE" || die "failed to cleanup docs"
+ use examples || rm -r "${ED}/usr/share/doc/${PF}/examples" || die "failed to remove examples"
+
+ newinitd "${FILESDIR}/${PN}.initd" "${PN}"
+ newconfd "${FILESDIR}/${PN}.confd" "${PN}"
+
+ # filter rules and sync scripts are supposed to be here
+ keepdir "${EPREFIX}/etc/${PN}"
+ insinto "/etc/${PN}"
+ newins "${FILESDIR}/${PN}.conf" "${PN}.conf"
+}
+
+pkg_postinst() {
+ einfo "${PN} is just a convenient way to run synchronization tools on live data,"
+ einfo "it doesn't copy data itself, so you need to install software to do actual"
+ einfo "data transfer. Usually net-misc/rsync is a good choise, but ${PN} is"
+ einfo "is flexible enough to use any user tool, see manual page for details."
+ einfo
+ einfo "${PN} init script can be multiplexed, to use symlink init script to"
+ einfo "othername and use conf.d/othername to configure it."
+ einfo
+ einfo "If you're interested in improved security, enable"
+ einfo "USE=\"caps cgroups hardened namespaces seccomp\""
+}
diff --git a/app-admin/clsync/files/clsync-0.4-retries-arg.patch b/app-admin/clsync/files/clsync-0.4-retries-arg.patch
new file mode 100644
index 000000000000..575a53edf486
--- /dev/null
+++ b/app-admin/clsync/files/clsync-0.4-retries-arg.patch
@@ -0,0 +1,13 @@
+diff --git a/main.c b/main.c
+index 176e1f4..48aee6a 100644
+--- a/main.c
++++ b/main.c
+@@ -116,7 +116,7 @@ static const struct option long_options[] =
+ {"cgroup-group-name", required_argument, NULL, CG_GROUPNAME},
+ #endif
+ {"threading", required_argument, NULL, THREADING},
+- {"retries", optional_argument, NULL, RETRIES},
++ {"retries", required_argument, NULL, RETRIES},
+ {"ignore-failures", optional_argument, NULL, IGNOREFAILURES},
+ {"exit-on-sync-skipping",optional_argument, NULL, EXITONSYNCSKIP},
+ {"output", required_argument, NULL, OUTPUT_METHOD},
diff --git a/app-admin/clsync/files/clsync-0.4-strtol.patch b/app-admin/clsync/files/clsync-0.4-strtol.patch
new file mode 100644
index 000000000000..9e95bbb3290b
--- /dev/null
+++ b/app-admin/clsync/files/clsync-0.4-strtol.patch
@@ -0,0 +1,179 @@
+commit 41283d1359b652c728ca37406a33e62e8541bdda
+Author: Andrew Savchenko <bircoph@gmail.com>
+Date: Fri Feb 20 21:04:48 2015 +0300
+
+ parser: check correctness of str to int conversions.
+
+diff --git a/main.c b/main.c
+index 48aee6a..d057489 100644
+--- a/main.c
++++ b/main.c
+@@ -808,15 +808,33 @@ static int synchandler_arg1(char *arg, size_t arg_len, void *_ctx_p) {
+ return synchandler_arg(arg, arg_len, _ctx_p, SHARGS_INITIAL);
+ }
+
+-int parse_customsignals(ctx_t *ctx_p, char *arg) {
++/* strtol wrapper with error checks */
++static inline long xstrtol(const char *str, int *err) {
++ long res;
++ char *endptr;
++
++ res = strtol(str, &endptr, 0);
++ if (errno || *endptr) {
++ error("argument \"%s\" can't be parsed as a number", str);
++ *err = EINVAL;
++ }
++ return res;
++}
++
++static inline int parse_customsignals(ctx_t *ctx_p, char *arg) {
+ char *ptr = arg, *start = arg;
++ int ret = 0;
+ unsigned int signal;
+ do {
+ switch (*ptr) {
+ case 0:
+ case ',':
+ case ':':
+- signal = (unsigned int)atoi(start);
++ signal = (unsigned int)xstrtol(start, &ret);
++ if (ret) {
++ errno = ret;
++ return errno;
++ }
+ if (signal == 0) {
+ // flushing the setting
+ int i = 0;
+@@ -883,7 +901,8 @@ int parse_customsignals(ctx_t *ctx_p, char *arg) {
+ return 0;
+ }
+
+-int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t paramsource) {
++static int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t paramsource) {
++ int ret = 0;
+ #ifdef _DEBUG_FORCE
+ fprintf(stderr, "Force-Debug: parse_parameter(): %i: %i = \"%s\"\n", paramsource, param_id, arg);
+ #endif
+@@ -962,7 +981,7 @@ int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t pa
+ ctx_p->flags[param_id]++;
+
+ if (pwd == NULL) {
+- ctx_p->uid = (unsigned int)atol(arg);
++ ctx_p->uid = (unsigned int)xstrtol(arg, &ret);
+ break;
+ }
+
+@@ -974,7 +993,7 @@ int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t pa
+ ctx_p->flags[param_id]++;
+
+ if (grp == NULL) {
+- ctx_p->gid = (unsigned int)atol(arg);
++ ctx_p->gid = (unsigned int)xstrtol(arg, &ret);
+ break;
+ }
+
+@@ -1028,7 +1047,7 @@ int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t pa
+ ctx_p->flags[param_id]++;
+
+ if (pwd == NULL) {
+- ctx_p->synchandler_uid = (unsigned int)atol(arg);
++ ctx_p->synchandler_uid = (unsigned int)xstrtol(arg, &ret);
+ break;
+ }
+
+@@ -1040,7 +1059,7 @@ int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t pa
+ ctx_p->flags[param_id]++;
+
+ if (grp == NULL) {
+- ctx_p->synchandler_gid = (unsigned int)atol(arg);
++ ctx_p->synchandler_gid = (unsigned int)xstrtol(arg, &ret);
+ break;
+ }
+
+@@ -1233,7 +1252,7 @@ int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t pa
+ ctx_p->pidfile = arg;
+ break;
+ case RETRIES:
+- ctx_p->retries = (unsigned int)atol(arg);
++ ctx_p->retries = (unsigned int)xstrtol(arg, &ret);
+ break;
+ case THREADING: {
+ char *value, *arg_orig = arg;
+@@ -1279,22 +1298,22 @@ int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t pa
+ ctx_p->cluster_mcastipaddr = arg;
+ break;
+ case CLUSTERMCASTIPPORT:
+- ctx_p->cluster_mcastipport = (uint16_t)atoi(arg);
++ ctx_p->cluster_mcastipport = (uint16_t)xstrtol(arg, &ret);
+ break;
+ case CLUSTERTIMEOUT:
+- ctx_p->cluster_timeout = (unsigned int)atol(arg);
++ ctx_p->cluster_timeout = (unsigned int)xstrtol(arg, &ret);
+ break;
+ case CLUSTERNODENAME:
+ ctx_p->cluster_nodename = arg;
+ break;
+ case CLUSTERHDLMIN:
+- ctx_p->cluster_hash_dl_min = (uint16_t)atoi(arg);
++ ctx_p->cluster_hash_dl_min = (uint16_t)xstrtol(arg, &ret);
+ break;
+ case CLUSTERHDLMAX:
+- ctx_p->cluster_hash_dl_max = (uint16_t)atoi(arg);
++ ctx_p->cluster_hash_dl_max = (uint16_t)xstrtol(arg, &ret);
+ break;
+ case CLUSTERSDLMAX:
+- ctx_p->cluster_scan_dl_max = (uint16_t)atoi(arg);
++ ctx_p->cluster_scan_dl_max = (uint16_t)xstrtol(arg, &ret);
+ break;
+ #endif
+ case OUTLISTSDIR:
+@@ -1334,16 +1353,16 @@ int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t pa
+ break;
+ }
+ case SYNCDELAY:
+- ctx_p->syncdelay = (unsigned int)atol(arg);
++ ctx_p->syncdelay = (unsigned int)xstrtol(arg, &ret);
+ break;
+ case DELAY:
+- ctx_p->_queues[QUEUE_NORMAL].collectdelay = (unsigned int)atol(arg);
++ ctx_p->_queues[QUEUE_NORMAL].collectdelay = (unsigned int)xstrtol(arg, &ret);
+ break;
+ case BFILEDELAY:
+- ctx_p->_queues[QUEUE_BIGFILE].collectdelay = (unsigned int)atol(arg);
++ ctx_p->_queues[QUEUE_BIGFILE].collectdelay = (unsigned int)xstrtol(arg, &ret);
+ break;
+ case BFILETHRESHOLD:
+- ctx_p->bfilethreshold = (unsigned long)atol(arg);
++ ctx_p->bfilethreshold = (unsigned long)xstrtol(arg, &ret);
+ break;
+ case CANCEL_SYSCALLS: {
+ char *subopts = arg;
+@@ -1412,10 +1431,10 @@ int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t pa
+ break;
+ }
+ case RSYNCINCLIMIT:
+- ctx_p->rsyncinclimit = (unsigned int)atol(arg);
++ ctx_p->rsyncinclimit = (unsigned int)xstrtol(arg, &ret);
+ break;
+ case SYNCTIMEOUT:
+- ctx_p->synctimeout = (unsigned int)atol(arg);
++ ctx_p->synctimeout = (unsigned int)xstrtol(arg, &ret);
+ break;
+ case PREEXITHOOK:
+ if (strlen(arg)) {
+@@ -1611,13 +1630,13 @@ int parse_parameter(ctx_t *ctx_p, uint16_t param_id, char *arg, paramsource_t pa
+ if (arg == NULL)
+ ctx_p->flags[param_id]++;
+ else
+- ctx_p->flags[param_id] = atoi(arg);
++ ctx_p->flags[param_id] = xstrtol(arg, &ret);
+ #ifdef _DEBUG_FORCE
+ fprintf(stderr, "Force-Debug: flag %i is set to %i\n", param_id&0xff, ctx_p->flags[param_id]);
+ #endif
+ break;
+ }
+- return 0;
++ return ret;
+ }
+
+ int arguments_parse(int argc, char *argv[], struct ctx *ctx_p) {