Date: Friday, April 29, 2022 @ 10:10:53 Author: eworm Revision: 1191779
upgpkg: incron 0.5.12-5: fix escaping target in GetSafePath() Added: incron/trunk/0001-GetSafePath.patch Modified: incron/trunk/PKGBUILD ------------------------+ 0001-GetSafePath.patch | 74 +++++++++++++++++++++++++++++++++++++++++++++++ PKGBUILD | 7 +++- 2 files changed, 80 insertions(+), 1 deletion(-) Added: 0001-GetSafePath.patch =================================================================== --- 0001-GetSafePath.patch (rev 0) +++ 0001-GetSafePath.patch 2022-04-29 10:10:53 UTC (rev 1191779) @@ -0,0 +1,74 @@ +From 47263e66497eaff3a83873080fa4b76bd5f6ad7d Mon Sep 17 00:00:00 2001 +From: Christian Hesse <[email protected]> +Date: Fri, 29 Apr 2022 00:00:09 +0200 +Subject: [PATCH 1/2] simplify code + +No need for a lot of if-else... Just add a backslash if required, then +append the character. +--- + incrontab.cpp | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/incrontab.cpp b/incrontab.cpp +index 5255163..613aad4 100644 +--- a/incrontab.cpp ++++ b/incrontab.cpp +@@ -168,15 +168,11 @@ std::string IncronTabEntry::GetSafePath(const std::string& rPath) + + SIZE len = rPath.length(); + for (SIZE i = 0; i < len; i++) { +- if (rPath[i] == ' ') { +- stream << "\\ "; +- } +- else if (rPath[i] == '\\') { +- stream << "\\\\"; +- } +- else { +- stream << rPath[i]; ++ if (rPath[i] == ' ' || ++ rPath[i] == '\\') { ++ stream << "\\"; + } ++ stream << rPath[i]; + } + + return stream.str(); +-- +2.36.0 + + +From 35f4298d574151deadbdeb7ccc7785bf36504d3d Mon Sep 17 00:00:00 2001 +From: Christian Hesse <[email protected]> +Date: Fri, 29 Apr 2022 00:02:18 +0200 +Subject: [PATCH 2/2] also escape single & double quotes, parenthesis and angle + brackets + +This fixes... + +incrond[1714]: cannot exec process: Resource temporarily unavailable + +... with bad file name due to messing escaping. +--- + incrontab.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/incrontab.cpp b/incrontab.cpp +index 613aad4..8b951da 100644 +--- a/incrontab.cpp ++++ b/incrontab.cpp +@@ -169,6 +169,12 @@ std::string IncronTabEntry::GetSafePath(const std::string& rPath) + SIZE len = rPath.length(); + for (SIZE i = 0; i < len; i++) { + if (rPath[i] == ' ' || ++ rPath[i] == '\'' || ++ rPath[i] == '"' || ++ rPath[i] == '(' || ++ rPath[i] == ')' || ++ rPath[i] == '<' || ++ rPath[i] == '>' || + rPath[i] == '\\') { + stream << "\\"; + } +-- +2.36.0 + Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-04-29 10:04:53 UTC (rev 1191778) +++ PKGBUILD 2022-04-29 10:10:53 UTC (rev 1191779) @@ -4,7 +4,7 @@ pkgname=incron pkgver=0.5.12 -pkgrel=4 +pkgrel=5 _commit=f45c2f5ac4baea99b48e99a713d1f4ec1854aa76 pkgdesc="Like the regular cron but is driven by filesystem events instead of time periods" arch=('x86_64') @@ -15,10 +15,12 @@ options=('emptydirs') #source=("$pkgname-$pkgver.tar.gz::https://github.com/ar-/incron/archive/$pkgver.tar.gz" source=("git+https://github.com/ar-/incron.git#commit=${_commit}" + '0001-GetSafePath.patch' "incron.sysusers" "incron.tmpfiles" "incrond.service") sha256sums=('SKIP' + '4a939f4af82c8d972478f2703aea6e524af8f7bf8bd1d8cf516ef78ff5e6713b' 'e5da0a3af368c286fa2b180015c9efc5aef5018c271a16620b8c30bfe6f9ccc2' '422c4a715da4037550d2f97de28f47f91d0b58983c188c6cf1d1233370e048a4' '5ff72411c704dd38823892d7fd13992509c3d906bfe0b4a5cafbe382e4e01c24') @@ -26,6 +28,9 @@ prepare() { cd "${srcdir}"/$pkgname sed -i 's|$(DESTDIR)$(PREFIX)/sbin/|$(DESTDIR)$(PREFIX)/bin/|g' Makefile + + # https://github.com/ar-/incron/pull/91 + patch -Np1 < ../0001-GetSafePath.patch } build() {
