From e3d5639137c9b447d6f4c8ec453bd97a7c14e170 Mon Sep 17 00:00:00 2001 From: Andrew Savchenko Date: Wed, 11 Feb 2015 03:39:28 +0000 Subject: [PATCH] Initial version ported from bircoph overlay. Nice lsyncd replacement. Have fun! Signed-off-by: Andrew Savchenko Package-Manager: portage-2.2.15/cvs/Linux i686 Manifest-Sign-Key: 0x565953B95372756C --- app-admin/clsync/Manifest | 26 +++- app-admin/clsync/clsync-0.4.ebuild | 113 ++++++++++++++ .../clsync/files/clsync-0.4-direct_mode.patch | 61 ++++++++ app-admin/clsync/files/clsync-0.4-gio.patch | 32 ++++ .../files/clsync-0.4-handler_path.patch | 30 ++++ .../clsync/files/clsync-0.4-hl_locks.patch | 37 +++++ .../clsync/files/clsync-0.4-unset_env.patch | 43 ++++++ .../files/clsync-0.4-unshare-configure.patch | 38 +++++ .../files/clsync-0.4-unshare-ifdef.patch | 34 +++++ .../clsync/files/clsync-0.4-unused-deps.patch | 140 ++++++++++++++++++ .../clsync/files/clsync-0.4-version.patch | 19 +++ app-admin/clsync/files/clsync.conf | 18 +++ app-admin/clsync/files/clsync.confd | 20 +++ app-admin/clsync/files/clsync.initd | 18 +++ app-admin/clsync/metadata.xml | 27 ++++ 15 files changed, 653 insertions(+), 3 deletions(-) create mode 100644 app-admin/clsync/clsync-0.4.ebuild create mode 100644 app-admin/clsync/files/clsync-0.4-direct_mode.patch create mode 100644 app-admin/clsync/files/clsync-0.4-gio.patch create mode 100644 app-admin/clsync/files/clsync-0.4-handler_path.patch create mode 100644 app-admin/clsync/files/clsync-0.4-hl_locks.patch create mode 100644 app-admin/clsync/files/clsync-0.4-unset_env.patch create mode 100644 app-admin/clsync/files/clsync-0.4-unshare-configure.patch create mode 100644 app-admin/clsync/files/clsync-0.4-unshare-ifdef.patch create mode 100644 app-admin/clsync/files/clsync-0.4-unused-deps.patch create mode 100644 app-admin/clsync/files/clsync-0.4-version.patch create mode 100644 app-admin/clsync/files/clsync.conf create mode 100644 app-admin/clsync/files/clsync.confd create mode 100644 app-admin/clsync/files/clsync.initd create mode 100644 app-admin/clsync/metadata.xml diff --git a/app-admin/clsync/Manifest b/app-admin/clsync/Manifest index d9e9f3ef7c7c..5b7c19c19879 100644 --- a/app-admin/clsync/Manifest +++ b/app-admin/clsync/Manifest @@ -1,3 +1,6 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + AUX clsync-0.4-direct_mode.patch 1782 SHA256 fc429bc6b830c76233d083b5ed882f4c9dbdee14de3bfbdf944c606a07e1cfc3 SHA512 99e4074343ff2d69811af0fcbc8481e016c3c8d685d4775bce3075939527a04d14573c745e5ee000f991ff74391a4355b63c15f7ac4f692d411d50a29f119cc9 WHIRLPOOL 9606eff1cfb55126345a2502c6222074111dfaa7557cf946926d130da1bbfc27e6265bfe0bf367264ec81f840f55a27ecb2cb8ca73ccaf313a065e5052026707 AUX clsync-0.4-gio.patch 1254 SHA256 2bc5cc03cd456ed09879e77e963e17bedb05d3deaff77f4d18bdc67c521773f1 SHA512 888f0941dcfd8843007afee889c005c613d731750882b0acbadceb08b514f177b9b75f992827050a40247002c8d29d7fcf4e75eabafe6eb54fc1d05e30893ffd WHIRLPOOL 5df5185fd97bb4d77297e40e1722b4ddfbb27c444c6a506939ee9a3075be0200aeca3c0f08f62e9650a04583cd55f1d05c106a77b7f2eb2e9af3621f9597d4f2 AUX clsync-0.4-handler_path.patch 822 SHA256 fcd4f9ff6308e18984dd4a97bda2d3bd9c9de8bd37a9ef758d6e0ba2485c70c6 SHA512 de4a7fa17e158f5527a4b28e90414ee8513a140fed2f62815578e9e97550662c0cc7d36d3debd366c7543cb879763443dc839356640647d82f6709c954c4f0ad WHIRLPOOL 9f18153267d70f4964e8d7a14b87e3a21056874254874452a9895bc3613515f5f9d059b5c10bb8d7ffd0077e5eb00c8fcbd52059807dc65553875d59e05d3777 @@ -9,8 +12,25 @@ AUX clsync-0.4-unused-deps.patch 4281 SHA256 a9dc293dfdec61ea44d55e309115a2eb324 AUX clsync-0.4-version.patch 694 SHA256 8b899b74f59dc6acb134ab4b2254e222c8d148ed827054c1e263625a73405c9d SHA512 9a08ecf5c062827d8e02b4822a879115d394d36d6c81bc138dee4b65519c6a2e333445e953965057d8b32ad3bca6ced8a699f59d798d31bb022c4b9129d8b681 WHIRLPOOL fd214257b4a2fd24120a4620df55edd78010f5db507493b3e0c1bd06f91e97e2b3caffdbabad4c4b0d1cc7c3f02d9d290805c4d6e10edf5e44d081ae1b837e1b AUX clsync.conf 589 SHA256 1a8689b86cf9475ef72ef42a623a1bb1ae55abff31578dcfdf3537331c681815 SHA512 46d8d786378eed0bfa46195e45f764015258ba55b35a5acf2685967e9fbd1fc7656c6aeba26b06889fa2f7c62cb11ecb84b10b856356ea3c0d463eaa4980c33d WHIRLPOOL cd9a0800b75eab476d7feec079f23538295dca5067f979ce4280c3188b9a24adf7c78e0c2ec5e2e8cadd71d11be181d873bc462d9fe321ada85e4e11690272db AUX clsync.confd 645 SHA256 ae7e9cacf618f9a32a4a1580580a901831aaaa0abb9de9e0379fbcc6a7359b0d SHA512 75dcc49d51f6da94d42eb501f1ad2868f163405dd7aa933f4c8078ec18f5b54eb6c66ff796ee744f7751699162627af843edbe5de5adf99c23712cedaebaddc5 WHIRLPOOL 06289c7645430d10b242983daa9cd2d4c2f327b34ede308012354947c64c654a7864586743ae6de7c02770a8b1c22de04b63404a6431b317b328ac6ac1e121ce -AUX clsync.initd 573 SHA256 1f3306dfeb4c8d8260551ed0edebe842452de2a2b7e85d07aa0fe46b88f10414 SHA512 c944388d5e61cfba73d462d457dbdcfef42c4bfc6f9ba814eea592dd630d64309e8e2b4af1cb621a41151613f28ab4508cc7d26d44def0b5a01938742cfbdd2e WHIRLPOOL c824fd5ed8e45afcd5df737dfea7645fc3460e42c5ab0512c4c462fc646f789e81597fb460126412f2347e0cb9468339b1874a697b65a40a3ff278625241f460 +AUX clsync.initd 671 SHA256 1efaac7d85e4f22e3b346af1451cac8574549743df7460feb664d4e57d818234 SHA512 61e8ca7f1e04cb2ff4d3e374c9419112bc05e6ffa77b40505f5a5ad7e215d8d5c2961795b804afd19ec153945bc004bf0611cb15e1ffae44746c6877805d967a WHIRLPOOL c605b0cb37e4bfac4fbb652d560515df9890d872e10616d2b039898d382abbcc8a5c6185f8556ac32d7d9e77198cc15d53490e33403a14fa5b9a6b656b912a29 DIST clsync-0.4.tar.gz 253396 SHA256 6f0ce7a5f61fbb50db53b787b62cf5347870f3be315acb02c4aee6b76206d19e SHA512 9b17f5f8f0bfc48531f3d8cb4f1c1edd3116e0b7d140e8ab2465dd1c590521c9857202ed3f36466f13fb3309abb9232fb4acbe25b5652914a816fac498f74a48 WHIRLPOOL 18ae12df2d7e0403b21c5d4ab7352cd81446729d94fb300a799b98dad9f88aeaa98deb2ba5f52858d3b6ba7406d777e53e97dae5c3a4802a229511db9c8a3482 -EBUILD clsync-0.4.ebuild 3280 SHA256 3ffdaad7f1b8f077065ea08ed974196e9172284c11e6a0e9fe48c4ca44c02e50 SHA512 82811e438a3a68ea99c62b8a997c03af2073de708007ac382209144e46cf85aefb07c774d94b7d4c4676442d3afce96851cfaf04745f0479992327d3d8c78210 WHIRLPOOL 52f1144f896f9d56c447a448edfb2908334b73f1fdb2199b403ecb4955af58e9fbe75008755a331ec2b4d9d44ac878a0bc454ac7227149f91bd14c7649604b78 -MISC ChangeLog 678 SHA256 378ba611cea2dbda7bc053bfa3f8ed18eb67fa2f460e5650db52a4df00ef49d7 SHA512 603cd44fa93c392de159578fc3aacbabd88b6c6c6ace926e8d81920ab3bbfc6af0ccdb12cf27fbe838d74ab20e0a02c39f5421cbfcb89c84dcc410ec14085ecd WHIRLPOOL e0bc5bc52364310372d3f60ed05724daec4f425c13c5871e9d7c097f60f60ba489c678424637978c5e259b4f1c1c3d15b76535cc01ea338a2123f72d442fae4b +EBUILD clsync-0.4.ebuild 3377 SHA256 5faa09012d163d4a25e27c3c8b50d2e5ebbf551dfdc9fe809c24f289edf4a9dd SHA512 abcca419225b6c446555abf99b86760c716397842d7c02d9ecaa22774edd03b9f2739c6b5325d3646914264fad4e44e4047fafabfd8e0f17a43aff8bd3813b68 WHIRLPOOL c96c4196b7935013a1291c3a952f8d8fcd6618a06bfcaa2f4cf1b7bddcc9e0a65ab370d0a79f371bb6da60c8c47e692a1428c89cd93a7f63670d246d7d6202f3 +MISC ChangeLog 767 SHA256 27efaf9b27065358c2c7c3a9b0a05a42878c80dfe46f0e29e02113538b5960ef SHA512 623d87b0fe6aec6ec9adc3e4c0c4b50a1093e99b9b6bddd3289afc3250d71e445fff4a98ed08d29b3b86b5637b1b40ce46403a396043374b2f1b680d5df60174 WHIRLPOOL 4fef9820eadcd44d78de738148690fd54cf77d07b6b307b96ca4e2f2ead7dc2012ea96a5859f4f461dfa6f95e61c8b4aec600e415ad5ec97949f7ab07997e5fa MISC metadata.xml 1572 SHA256 6d90b9c0f0b37dffda05a9b5ca6d02f05ce0362eb8bf8fbe19e90c3f77570940 SHA512 5be148bc1f8b1ca76e2b5713bf5a9ecfc88c4c101620fbbf1cb4efcbe7b33a923038ea0c2d5b2d66689552a04b865c4b0625887baa98a80d64f486208143ce67 WHIRLPOOL e1cd84b85b5ac476407930f14217cfed16f67d3aeb221e61dffa94c688b69ada4f29f7a7e9f4f2b610f8730c10d700bff9148d6b871ca9d98e76eaa0c5de68c8 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2 + +iQIcBAEBCAAGBQJU2s7tAAoJEPZTWjO6HuSN6FYP/1Re+RHhoAZXdJ1kEatu6Kfw +rmcy8A0qJk2S12Jszy+E1m2JCy4kEr9e5yc9+xsAOcG5nyCQWsbHg7TxrfLP9gao +DqiE0M+GS36pmtVjnRoh/upJRrnSTwL9b4cQyyopgMgFp59s8ea7gPuL1ZixkQ5N +6poAQQTLurpzV0Mw6lPkMLbubQyXByExP8wz/Fzeuq2X6svSOxXYVB9wcwD5mk8r +9S6FiZuTqA6Rhfahdn6ZXdQbLFgkzMRg/r7/b+o0Bpi8whmEekmbXYqq3cdT9rZy +7JkHQ/V+0IpJTAbH29y8lL+sdezySN4h555sTFqBCQjrak0C+lAdX1DzPQjlPq6i +2+L5Cc81Ru2jFYPaQDiQ7bW8pL8xNzEYDWXN4OD1SQMZzw7ux2/hg3qRmMkNw8JJ +S/Ij03ThTVUUVJ4QfcI7rUb1GBgx7Smx4sm9I/p0C73VBPzEiGLB+XeKKC0rxJYo +aDOzTdxlrUWjs+KrlJA3i5cycW5XqFBV8zpZ/hGXkOWXz+iVnbkoeEt/nFs9SjUS +TAHjlRec9p5IRw6pi68NIT/PcmVIN4nn2AuIRKN8SJYx989+wLMbuJj0lgeF8MWk +Cz8IxPU8YO7imG1z8yJJxSolXa9S0yI38j4Ojl679eiTtsE097fIQ7aBLhLCFjza +nI6GvRJ9yxbVr1rPPbbE +=W/gP +-----END PGP SIGNATURE----- diff --git a/app-admin/clsync/clsync-0.4.ebuild b/app-admin/clsync/clsync-0.4.ebuild new file mode 100644 index 000000000000..80f559ceedf0 --- /dev/null +++ b/app-admin/clsync/clsync-0.4.ebuild @@ -0,0 +1,113 @@ +# 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.ebuild,v 1.1 2015/02/11 03:39:24 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" + 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-direct_mode.patch b/app-admin/clsync/files/clsync-0.4-direct_mode.patch new file mode 100644 index 000000000000..2a9c06e96322 --- /dev/null +++ b/app-admin/clsync/files/clsync-0.4-direct_mode.patch @@ -0,0 +1,61 @@ +commit 1fe2a05438de390dc12a653bc50ddf591fa79733 +Author: Dmitry Yu Okunev +Date: Wed Jan 28 11:39:09 2015 +0300 + + Fixed the path '' in direct mode. + + '' -> '.' + + Thanks for bugreport to: Andrew A Savchenko + +diff --git a/sync.c b/sync.c +index b6d3341..490ea39 100644 +--- a/sync.c ++++ b/sync.c +@@ -1959,6 +1959,25 @@ int fileischanged(ctx_t *ctx_p, indexes_t *indexes_p, const char *path_rel, stat + return 1; + } + ++static inline int sync_indexes_fpath2ei_addfixed(ctx_t *ctx_p, indexes_t *indexes_p, const char *fpath, eventinfo_t *evinfo) { ++ static const char fpath_dot[] = "."; ++ const char *fpath_fixed; ++ ++ fpath_fixed = fpath; ++ switch (ctx_p->flags[MODE]) { ++ case MODE_DIRECT: ++ ++ // If fpath is empty (that means CWD) then assign it to "." ++ if (!*fpath) ++ fpath_fixed = fpath_dot; ++ break; ++ default: ++ break; ++ } ++ ++ return indexes_fpath2ei_add(indexes_p, strdup(fpath_fixed), evinfo); ++} ++ + int sync_prequeue_loadmark + ( + int monitored, +@@ -2145,7 +2164,8 @@ int sync_prequeue_loadmark + ); + + if (isnew) +- indexes_fpath2ei_add(indexes_p, strdup(path_rel), evinfo); ++ // Fix the path (if required) and call indexes_fpath2ei_add() to remeber the new object to be synced ++ sync_indexes_fpath2ei_addfixed(ctx_p, indexes_p, path_rel, evinfo); + + return 0; + } +@@ -2288,7 +2308,9 @@ void _sync_idle_dosync_collectedevents(gpointer fpath_gp, gpointer evinfo_gp, gp + + if (isnew) { + debug(4, "Collecting \"%s\"", fpath); +- indexes_fpath2ei_add(indexes_p, strdup(fpath), evinfo_idx); ++ ++ // Fix the path (if required) and call indexes_fpath2ei_add() to remeber the new object to be synced ++ sync_indexes_fpath2ei_addfixed(ctx_p, indexes_p, fpath, evinfo_idx); + } else + free(fpath); + diff --git a/app-admin/clsync/files/clsync-0.4-gio.patch b/app-admin/clsync/files/clsync-0.4-gio.patch new file mode 100644 index 000000000000..cdcbbc2ebc8c --- /dev/null +++ b/app-admin/clsync/files/clsync-0.4-gio.patch @@ -0,0 +1,32 @@ +commit 4eea85337a3358baae0b4f0626d63a9626778a01 +Author: Andrew Savchenko +Date: Wed Jan 28 02:50:36 2015 +0300 + + Add GIO to the list of allowed file monitors. + + This allows to compile clsync ONLY with GIO support. + +diff --git a/configure.ac b/configure.ac +index f497c67..a3f0324 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -262,7 +262,7 @@ dnl tre check + # ;; + #esac + +-dnl kqueue/inotify/bsm ++dnl kqueue/inotify/gio/bsm + + AC_ARG_WITH(kqueue, + AS_HELP_STRING(--with-kqueue, +@@ -476,7 +476,9 @@ AM_CONDITIONAL([HAVE_SECCOMP], [test "x$HAVE_SECCOMP" != "x"]) + AM_CONDITIONAL([HAVE_TRE], [test "x$HAVE_TRE" != "x"]) + AM_CONDITIONAL([HAVE_LIBCGROUP], [test "x$HAVE_LIBCGROUP" != "x"]) + +-AS_IF([test "$HAVE_KQUEUE" = '' -a "$HAVE_INOTIFY" = '' -a "$HAVE_FANOTIFY" = '' -a "$HAVE_BSM" = '' ], [AC_MSG_FAILURE([kqueue, inotify and bsm are not supported on this system])]) ++AS_IF([test "$HAVE_KQUEUE" = '' -a "$HAVE_INOTIFY" = '' -a "$HAVE_FANOTIFY" = '' -a "$HAVE_BSM" = '' -a "$HAVE_GIO" = ''], ++[AC_MSG_FAILURE([At least one monitoring engine must be enabled! ++Available (depending on system): inotify, kqueue, gio, bsm])]) + + LIBS="${GLIB_LIBS} ${LIBS}" + AM_CPPFLAGS="${GLIB_CFLAGS}" diff --git a/app-admin/clsync/files/clsync-0.4-handler_path.patch b/app-admin/clsync/files/clsync-0.4-handler_path.patch new file mode 100644 index 000000000000..5a61544149fe --- /dev/null +++ b/app-admin/clsync/files/clsync-0.4-handler_path.patch @@ -0,0 +1,30 @@ +commit a747384216597df71c99453dc5161100e1b41181 +Author: Dmitry Yu Okunev +Date: Wed Jan 28 11:46:57 2015 +0300 + + Fixed setting sync-handler without absoulte path + + For example "-Secho" + +diff --git a/main.c b/main.c +index 53e71ae..792f1e4 100644 +--- a/main.c ++++ b/main.c +@@ -2526,12 +2526,16 @@ int main(int _argc, char *_argv[]) { + + if (ctx_p->handlerfpath != NULL) { + char *rhandlerfpath = realpath(ctx_p->handlerfpath, NULL); ++/* + if (rhandlerfpath == NULL) { + error("Got error while realpath() on \"%s\" [#0].", ctx_p->handlerfpath); + ret = errno; + } + debug(5, "rhandlerfpath == \"%s\"", rhandlerfpath); +- ctx_p->handlerfpath = rhandlerfpath; ++ ctx_p->handlerfpath = rhandlerfpath;*/ ++ ++ if (rhandlerfpath != NULL) ++ ctx_p->handlerfpath = rhandlerfpath; + + } + diff --git a/app-admin/clsync/files/clsync-0.4-hl_locks.patch b/app-admin/clsync/files/clsync-0.4-hl_locks.patch new file mode 100644 index 000000000000..f0279353a01b --- /dev/null +++ b/app-admin/clsync/files/clsync-0.4-hl_locks.patch @@ -0,0 +1,37 @@ +commit 76c75f8180a7e7592da927e8b4c8f5f067470d05 +Author: Dmitry Yu Okunev +Date: Wed Jan 28 12:19:11 2015 +0300 + + [hl_locks] A try to fix a segfault on one core PC + + Thanks for the bugreport to: Andrew A Savchenko + +diff --git a/privileged.c b/privileged.c +index fafd5b7..668a536 100644 +--- a/privileged.c ++++ b/privileged.c +@@ -1680,11 +1680,6 @@ int privileged_init(ctx_t *ctx_p) + #endif + + #ifdef CAPABILITIES_SUPPORT +-# ifdef HL_LOCKS +- if (ncpus == 1) +- hl_shutdown(HLLOCK_HANDLER); +-# endif +- + if (ctx_p->flags[SPLITTING] == SM_OFF) { + #endif + +@@ -1792,6 +1787,12 @@ int privileged_init(ctx_t *ctx_p) + default: + critical("Invalid ctx_p->flags[SPLITTING]: %i", ctx_p->flags[SPLITTING]); + } ++ ++# ifdef HL_LOCKS ++ if (ncpus == 1) ++ hl_shutdown(HLLOCK_HANDLER); ++# endif ++ + critical_on(!helper_isalive()); + + # ifdef UNSHARE_SUPPORT diff --git a/app-admin/clsync/files/clsync-0.4-unset_env.patch b/app-admin/clsync/files/clsync-0.4-unset_env.patch new file mode 100644 index 000000000000..54a45d2fec37 --- /dev/null +++ b/app-admin/clsync/files/clsync-0.4-unset_env.patch @@ -0,0 +1,43 @@ +commit 596f79fa65af66afdff4cf24b9135935bf511108 +Author: Dmitry Yu Okunev +Date: Wed Jan 28 14:27:51 2015 +0300 + + Fixed a segfault on non-set "HOME" environment variable + +diff --git a/main.c b/main.c +index 792f1e4..176e1f4 100644 +--- a/main.c ++++ b/main.c +@@ -1731,18 +1731,18 @@ int configs_parse(ctx_t *ctx_p, paramsource_t paramsource) { + char **config_path_p = config_paths, *config_path_real = xmalloc(PATH_MAX); + size_t config_path_real_size=PATH_MAX; + +- char *homedir = getenv("HOME"); +- size_t homedir_len = strlen(homedir); ++ char *homedir = getenv("HOME"); ++ size_t homedir_len = (homedir == NULL ? 0 :strlen(homedir)); + +- while(*config_path_p != NULL) { ++ while (*config_path_p != NULL) { + size_t config_path_len = strlen(*config_path_p); + +- if(config_path_len+homedir_len+3 > config_path_real_size) { ++ if (config_path_len+homedir_len+3 > config_path_real_size) { + config_path_real_size = config_path_len+homedir_len+3; + config_path_real = xmalloc(config_path_real_size); + } + +- if(*config_path_p[0] != '/') { ++ if ((*config_path_p[0] != '/') && (homedir_len >= 0)) { + memcpy(config_path_real, homedir, homedir_len); + config_path_real[homedir_len] = '/'; + memcpy(&config_path_real[homedir_len+1], *config_path_p, config_path_len+1); +@@ -1750,7 +1750,7 @@ int configs_parse(ctx_t *ctx_p, paramsource_t paramsource) { + memcpy(config_path_real, *config_path_p, config_path_len+1); + + debug(1, "Trying config-file \"%s\" (case #1)", config_path_real); +- if(!g_key_file_load_from_file(gkf, config_path_real, G_KEY_FILE_NONE, NULL)) { ++ if (!g_key_file_load_from_file(gkf, config_path_real, G_KEY_FILE_NONE, NULL)) { + debug(1, "Cannot open/parse file \"%s\"", config_path_real); + config_path_p++; + continue; diff --git a/app-admin/clsync/files/clsync-0.4-unshare-configure.patch b/app-admin/clsync/files/clsync-0.4-unshare-configure.patch new file mode 100644 index 000000000000..11d8f01d13e7 --- /dev/null +++ b/app-admin/clsync/files/clsync-0.4-unshare-configure.patch @@ -0,0 +1,38 @@ +commit a13f929cfe4a7fad58c7d814a139efff091601e0 +Author: Dmitry Yu Okunev +Date: Tue Jan 27 15:51:18 2015 +0300 + + "unshare()" support is configurable now + +diff --git a/configure.ac b/configure.ac +index f474478..059ade0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -87,6 +87,17 @@ AS_HELP_STRING(--enable-socket-library, + [build libclsync socket library, default: no])) + AM_CONDITIONAL([LIBCLSYNC], [test "x$enable_socket_library" = "xyes"]) + ++dnl --enable-unshare ++AC_ARG_ENABLE(unshare, ++AS_HELP_STRING(--enable-unshare, ++[enable support of unshare(), default: yes]), [], [enable_unshare="yes"]) ++ ++HAVE_UNSHARE=0 ++AS_IF([ test "x$enable_unshare" = "xyes" ], ++[ ++ AC_CHECK_FUNC([unshare], [HAVE_UNSHARE=1], [AC_MSG_FAILURE([Cannot find function unshare()])]) ++]) ++ + dnl --enable-highload-locks + AC_ARG_ENABLE(highload-locks, + AS_HELP_STRING(--enable-highload-locks, +@@ -155,9 +166,6 @@ AC_CHECK_FUNC([getmntent], [HAVE_GETMNTENT=1]) + dnl searching for pivot_root + AC_CHECK_FUNC([pivot_root], [HAVE_PIVOTROOT=1]) + +-dnl searching for unshare +-AC_CHECK_FUNC([unshare], [HAVE_UNSHARE=1]) +- + dnl libcgroup check + AC_ARG_WITH(libcgroup, + AS_HELP_STRING(--with-libcgroup, diff --git a/app-admin/clsync/files/clsync-0.4-unshare-ifdef.patch b/app-admin/clsync/files/clsync-0.4-unshare-ifdef.patch new file mode 100644 index 000000000000..84116dd2ba11 --- /dev/null +++ b/app-admin/clsync/files/clsync-0.4-unshare-ifdef.patch @@ -0,0 +1,34 @@ +commit a437518de6813202ab9cef124a6ca085d3eb555d +Author: Dmitry Yu Okunev +Date: Tue Jan 27 18:56:02 2015 +0300 + + Added missed "#ifdef"-s for unshare() + +diff --git a/privileged.c b/privileged.c +index 4b35514..fafd5b7 100644 +--- a/privileged.c ++++ b/privileged.c +@@ -1747,7 +1747,9 @@ int privileged_init(ctx_t *ctx_p) + + SAFE ( pthread_mutex_lock(pthread_mutex_runner_p), return errno;); + ++# ifdef UNSHARE_SUPPORT + unshare(CLONE_NEWIPC); ++# endif + + switch (ctx_p->flags[SPLITTING]) { + case SM_THREAD: { +@@ -1792,11 +1794,13 @@ int privileged_init(ctx_t *ctx_p) + } + critical_on(!helper_isalive()); + ++# ifdef UNSHARE_SUPPORT + // The rest routines + if (ctx_p->flags[DETACH_NETWORK] == DN_NONPRIVILEGED) { + SAFE ( cap_enable(CAP_TO_MASK(CAP_SYS_ADMIN)), return errno; ); + SAFE ( unshare(CLONE_NEWNET), return errno; ); + } ++# endif + SAFE ( cap_drop(ctx_p, 0), return errno; ); + + debug(4, "Waiting for the privileged thread to get prepared"); diff --git a/app-admin/clsync/files/clsync-0.4-unused-deps.patch b/app-admin/clsync/files/clsync-0.4-unused-deps.patch new file mode 100644 index 000000000000..db547fe6d5c7 --- /dev/null +++ b/app-admin/clsync/files/clsync-0.4-unused-deps.patch @@ -0,0 +1,140 @@ +Adapted commit 756ae28750b514473ae235218d466dc6fa960c30 +Author: Dmitry Yu Okunev +Date: Thu Jan 29 15:17:39 2015 +0300 + + [configure.ac] Removed dependency on libseccomp; renamed "--with-libseccomp" -> "--enable-seccomp", "--with-capabilities" -> "--enable-capabilities" + +--- clsync-0.4/configure.ac.orig 2015-02-11 01:52:54.104682884 +0300 ++++ clsync-0.4/configure.ac 2015-02-11 01:58:07.397580398 +0300 +@@ -145,6 +145,51 @@ + ) + AS_IF([test $paranoid -eq 2], [CPPFLAGS="${CPPFLAGS} -DVERYPARANOID"]) + ++dnl searching for seccomp ++AC_ARG_ENABLE(seccomp, ++ AS_HELP_STRING(--enable-seccomp, ++ [Enable seccomp support be able to forbid extra syscalls; values: no, check, yes; default: check]), ++ , ++ [enable_seccomp=check] ++) ++ ++case "$enable_seccomp" in ++ yes) ++ AC_CHECK_TYPES([struct seccomp_data], [HAVE_SECCOMP=1], [AC_MSG_FAILURE([Cannot find valid linux/seccomp.h])], [[#include ]]) ++ ;; ++ check) ++ AC_CHECK_TYPES([struct seccomp_data], [HAVE_SECCOMP=1], , [[#include ]]) ++ ;; ++esac ++ ++dnl capabilities check ++AC_ARG_ENABLE(capabilities, ++ AS_HELP_STRING(--enable-capabilities, ++ [Enable linux capabilities support; values: no, check, yes; default: check]), ++ , ++ [enable_capabilities=check] ++) ++ ++case "$enable_capabilities" in ++ yes) ++ AC_CHECK_FUNC([capset], ++ [ ++ AC_CHECK_HEADER(sys/capability.h, [HAVE_CAPABILITIES=2], [AC_MSG_FAILURE([Cannot find sys/capability.h])]) ++ ], ++ [ ++ AC_MSG_FAILURE([There is no capabilities support on this system]) ++ ] ++ ) ++ ;; ++ check) ++ AC_CHECK_FUNC([capset], ++ [ ++ AC_CHECK_HEADER(sys/capability.h, [HAVE_CAPABILITIES=2]) ++ ] ++ ) ++ ;; ++esac ++ + # Checks for programs. + AC_PROG_CC_C99 + AC_PROG_INSTALL +@@ -201,34 +246,6 @@ + ;; + esac + +-dnl capabilities check +-AC_ARG_WITH(capabilities, +- AS_HELP_STRING(--with-capabilities, +- [Enable linux capabilities support; values: no, check, yes; default: check]), +- [], +- [with_capabilities=check] +-) +- +-case "$with_capabilities" in +- yes) +- AC_CHECK_FUNC([capset], +- [ +- AC_CHECK_HEADER(sys/capability.h, [HAVE_CAPABILITIES=2], [AC_MSG_FAILURE([Cannot find sys/capability.h])]) +- ], +- [ +- AC_MSG_FAILURE([There is no capabilities support on this system]) +- ] +- ) +- ;; +- check) +- AC_CHECK_FUNC([capset], +- [ +- AC_CHECK_HEADER(sys/capability.h, [HAVE_CAPABILITIES=2]) +- ] +- ) +- ;; +-esac +- + dnl tre check + + #AC_ARG_WITH(tre, +@@ -433,31 +450,6 @@ + + AS_IF([test "$HAVE_INOTIFY" != ""], [AC_CHECK_FUNC([inotify_init1], [], [INOTIFY_OLD=1])]) + +-dnl searching for seccomp +-AC_ARG_WITH(libseccomp, +- AS_HELP_STRING(--with-libseccomp, +- [Enable seccomp support be able to forbid extra syscalls; values: no, check, yes; default: check]), +- [], +- [with_libseccomp=check] +-) +- +-case "$with_libseccomp" in +- yes) +- AC_CHECK_TYPES([scmp_filter_ctx], [], [AC_MSG_FAILURE([Cannot find valid seccomp.h])], [[#include ]]) +- AC_CHECK_DECLS([seccomp_syscall_resolve_name_arch], [], [AC_MSG_FAILURE([Cannot find valid seccomp.h])], [[#include ]]) +- AC_CHECK_TYPES([struct seccomp_data], [HAVE_SECCOMP=1], [AC_MSG_FAILURE([Cannot find valid linux/seccomp.h])], [[#include ]]) +- ;; +- check) +- AC_CHECK_TYPES([scmp_filter_ctx], [ +- AC_CHECK_DECLS([seccomp_syscall_resolve_name_arch], [ +- AC_CHECK_TYPES([struct seccomp_data], [HAVE_SECCOMP=1], [], [[#include ]]) +- ], [], [[#include ]]) +- ], [], [[#include ]]) +- ;; +-esac +-AS_IF([test "$HAVE_CAPABILITIES" != ""], [ +-]) +- + AM_CONDITIONAL([HAVE_KQUEUE], [test "x$HAVE_KQUEUE" != "x"]) + AM_CONDITIONAL([HAVE_INOTIFY], [test "x$HAVE_INOTIFY" != "x"]) + AM_CONDITIONAL([INOTIFY_OLD], [test "x$INOTIFY_OLD" != "x"]) +diff --git a/privileged.c b/privileged.c +index 668a536..0e773cc 100644 +--- a/privileged.c ++++ b/privileged.c +@@ -59,7 +59,7 @@ + #include "privileged.h" + + #ifdef SECCOMP_SUPPORT +-# include // __NR_* ++# include // __NR_* + # include // prctl() + # include // struct sock_filter + # include // SECCOMP_RET_* diff --git a/app-admin/clsync/files/clsync-0.4-version.patch b/app-admin/clsync/files/clsync-0.4-version.patch new file mode 100644 index 000000000000..58eea5edb1b3 --- /dev/null +++ b/app-admin/clsync/files/clsync-0.4-version.patch @@ -0,0 +1,19 @@ +commit e9eeb552896a3ac3f4f1e9d72ecab6a200f3c70c +Author: Andrew Savchenko +Date: Tue Jan 27 21:54:21 2015 +0300 + + update package string + +diff --git a/configure.ac b/configure.ac +index 45f5a23..3e0b3cc 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2,7 +2,7 @@ + # Process this file with autoconf to produce a configure script. + + AC_PREREQ([2.59]) +-AC_INIT([clsync],[0.3],[Dmitry Yu Okunev ],,[https://github.com/xaionaro/clsync]) ++AC_INIT([clsync],[0.4],[Dmitry Yu Okunev ],,[https://github.com/xaionaro/clsync]) + AC_CONFIG_SRCDIR([sync.c]) + AC_CONFIG_MACRO_DIR([m4]) + AM_INIT_AUTOMAKE([1.11 foreign -Wall -Wno-portability]) diff --git a/app-admin/clsync/files/clsync.conf b/app-admin/clsync/files/clsync.conf new file mode 100644 index 000000000000..91f38f17cd5c --- /dev/null +++ b/app-admin/clsync/files/clsync.conf @@ -0,0 +1,18 @@ +# clsync system configuration file +# +# General recommendations: +# 1. Put --dir-lists on tmpfs. +# 2. Use --uid and --gid to drop privileges whenever possible. +# 3. Keeep your clsync rules and sync scripts in /etc/clsync/. + +[default] +# Put your options here, see clsync man pages for a list of valid options. +# Also check examples directory (/usr/share/doc/clsync-*/examples). +# +#watch-dir = /what/dir/to/sync +#sync-handler = /etc/clsync/action.sh +#rules-dir = /etc/clsync/rules +#lists-dir = /tmp/clsync +#threading = safe +#delay-sync = 5 +#delay-collect = 5 diff --git a/app-admin/clsync/files/clsync.confd b/app-admin/clsync/files/clsync.confd new file mode 100644 index 000000000000..389f84e5d4b9 --- /dev/null +++ b/app-admin/clsync/files/clsync.confd @@ -0,0 +1,20 @@ +# /etc/conf.d/clsync: config file for /etc/init.d/clsync + +# config file, default is /etc/clsync/clsync.conf. +# to disable set to /dev/null +#CLSYNC_CONF="/etc/clsync/clsync.conf" + +# clsync options, have precedence over config file, +# see man clsync and $docdir/examples for details +#CLSYNC_OPTS="" + +# Example of direct rsync usage: +#CLSYNC_OPTS="--lists-dir /tmp/clsync --mode rsyncshell +#--watch-dir /source/dir --sync-handler /usr/bin/rsync +#--rules-file /etc/clsync/rules --distination-dir /destination/dir" + +# Change clsync nice level (default is unset) +#CLSYNC_NICE="0" + +# Change clsync ionice level (default is unset) +#CLSYNC_IONICE="2:7" diff --git a/app-admin/clsync/files/clsync.initd b/app-admin/clsync/files/clsync.initd new file mode 100644 index 000000000000..681c254c3aa9 --- /dev/null +++ b/app-admin/clsync/files/clsync.initd @@ -0,0 +1,18 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/clsync/files/clsync.initd,v 1.1 2015/02/11 03:39:24 bircoph Exp $ + +[[ -n "${CLSYNC_CONF}" ]] && conffile="--config-file ${CLSYNC_CONF}" +[[ -n "${CLSYNC_NICE}" ]] && cmd_nice="--nice ${CLSYNC_NICE}" +[[ -n "${CLSYNC_IONICE}" ]] && cmd_ionice="--ionice ${CLSYNC_IONICE}" + +command="/usr/bin/clsync" +pidfile="/var/run/${SVCNAME}.pid" +command_args="--background --output=syslog --pid-file=${pidfile} \ +${conffile} ${CLSYNC_OPTS}" +start_stop_daemon_args="${cmd_nice} ${cmd_ionice}" + +depend() { + use net +} diff --git a/app-admin/clsync/metadata.xml b/app-admin/clsync/metadata.xml new file mode 100644 index 000000000000..9bc1cbedcfc6 --- /dev/null +++ b/app-admin/clsync/metadata.xml @@ -0,0 +1,27 @@ + + + + + bircoph@gentoo.org + Andrew Savchenko + + + Clsync recursively watches for source directory and executes external + program to sync the changes. Clsync is adapted to be used together with rsync. + This utility is much more lightweight than competitors and supports such + features as separate queue for big files, regex file filter, multi-threading + and multicast notifing clsync instances on another nodes to prevent loop + syncing. Clsync can use advanced features for isolation: capabilities, cgroups, + namespaces, seccomp, code hardening. + + + Enable clustering support (allows master-master clsync on multiple hosts). Not fully implemented yet. + Enable AF_UNIX control socket support. + Use cgroups to limit /dev access. + Enable extra security checks. This will hurt performance. + Enable GIO for FS monitoring (glib based alternative to inotify interface, not recommended; if both are compiled, may be selected at runtime). + Allows to use spinlocks for short delays instead of mutexes, but only on SMP systems. + Enable namespaces isolation. + Enable seccomp for system call filtering. + + -- 2.26.2