Thomas Jarosch [Wed, 31 Dec 2025 11:20:28 +0000]
Release libi2ncommon 2.13
Issue a new release due to all the fixes.
No .so version bump needed, ABI stayed the same.
Thomas Jarosch [Wed, 31 Dec 2025 11:14:34 +0000]
Merge branch 'fix-compile-warnings'
This solves compile warnings for C++11 and later. Tested up to C++20.
We did go the extra mile and for now it's still compatible with C++98 / gcc 4.4.
The ABI does not change when using the old compiler (compared the mangled symbols).
Thomas Jarosch [Tue, 30 Dec 2025 09:13:52 +0000]
Fix ignored-qualifiers warning
Original warning:
src/timefunc.hxx:418:30: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
The function 'get_msec' was declared to return 'const long' but the const on
return by value is meaningless (the return value is a prvalue, not an lvalue).
Changed to 'long get_msec()' and also changed implementation to access
value.tv_nsec directly to avoid calling non-const get_nsec from const method.
Thomas Jarosch [Tue, 30 Dec 2025 20:32:14 +0000]
configlib: Remove deprecated std::binary_function inheritance
Original warnings:
configlib/i2n_global_config.hpp:261:15: error: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Werror=deprecated-declarations]
configlib/i2n_global_config.hpp:278:15: error: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Werror=deprecated-declarations]
configlib/i2n_global_config.hpp:299:15: error: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Werror=deprecated-declarations]
configlib/i2n_global_config.hpp:350:18: error: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Werror=deprecated-declarations]
Keep std::binary_function inheritance for GCC < 4.8 only.
GCC 4.8.1 was the first version with feature-complete C++11 support.
Require C++11 when using GCC >= 4.8 to avoid ABI mismatch between the
deprecated std::binary_function and modern C++ standard library.
Applied to:
- DefaultConverter<ValueType>
- DefaultConverter<std::string>
- AutoIntConverter<ValueType>
Also added conditional BOOST_STATIC_ASSERT in Var class to check
binary_function inheritance only for GCC < 4.8.
Thomas Jarosch [Tue, 30 Dec 2025 09:11:43 +0000]
Fix missing initializer for timespec
Original warning:
src/timefunc.cpp:50:30: error: missing initializer for member 'timespec::tv_nsec' [-Werror=missing-field-initializers]
Fixed by initializing both members: struct timespec ts = { 0, 0 };
Thomas Jarosch [Tue, 30 Dec 2025 09:10:07 +0000]
Fix catch-value warning
Original warning:
src/pointer_func.hpp:74:27: error: catching polymorphic type 'class boost::bad_weak_ptr' by value [-Werror=catch-value=]
Changed both catch statements to catch by reference (const&) instead of by value.
Thomas Jarosch [Tue, 30 Dec 2025 09:08:21 +0000]
pipestream: Fix unused parameter warning
Original warning:
src/pipestream.cpp:493:32: error: unused parameter '_ignored_flags' [-Werror=unused-parameter]
Fixed by adding (void)_ignored_flags; cast to suppress the warning.
Thomas Jarosch [Tue, 30 Dec 2025 09:00:54 +0000]
logfunc: Fix deprecated std::auto_ptr for GCC 4.8.1+
Original warning:
src/logfunc.hpp:147:30: error: 'template<class> class std::auto_ptr' is deprecated: use 'std::unique_ptr' instead [-Werror=deprecated-declarations]
Use std::auto_ptr for GCC <= 4.7.x and std::unique_ptr for GCC >= 4.8.1.
GCC 4.8.1 was the first version with feature-complete C++11 support.
This still enables compilation on g++ 4.4.4.
Thomas Jarosch [Tue, 30 Dec 2025 13:44:21 +0000]
test: Add unit tests for chown() with User and Group parameters
Test the sentinel value handling for uid_t and gid_t types that
was fixed in the previous commit.
Added tests:
- TestChownWithInvalidUid: Verify chown fails when User has invalid uid
- TestChownWithValidUidAndInvalidGid: Verify chown succeeds when gid falls back to valid user.Gid
- TestChownWithUserAndGroupObjects: Verify chown works with valid User and Group objects
Thomas Jarosch [Tue, 30 Dec 2025 08:58:00 +0000]
Fix unsigned comparison warnings in chown()
Original warnings:
src/filefunc.cpp:756:12: error: comparison of unsigned expression in '< 0' is always false [-Werror=type-limits]
src/filefunc.cpp:758:12: error: comparison of unsigned expression in '< 0' is always false [-Werror=type-limits]
src/filefunc.cpp:759:12: error: comparison of unsigned expression in '< 0' is always false [-Werror=type-limits]
The uid_t and gid_t types are unsigned, so comparisons like 'uid < 0' are always false.
Changed to use static_cast<uid_t>(-1) and static_cast<gid_t>(-1) to check for sentinel values.
Thomas Jarosch [Tue, 30 Dec 2025 08:54:15 +0000]
Replace deprecated readdir_r() with readdir()
Original warnings:
src/filefunc.cpp:318:21: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated [-Werror=deprecated-declarations]
src/filefunc.cpp:360:21: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated [-Werror=deprecated-declarations]
src/filefunc.cpp:362:27: error: the address of 'dirent::d_name' will never be NULL [-Werror=address]
The readdir_r() function is deprecated in favor of readdir(), which is
thread-safe on Linux with glibc since many years. I checked the glibc 2.17 source code
and it uses a lock internally (and also traced it back to at least 2012).
Also removed the unnecessary NULL check for d_name since it is never NULL per POSIX.
Thomas Jarosch [Wed, 31 Dec 2025 11:09:56 +0000]
Merge branch 'cmake-modernize-boost'
Thomas Jarosch [Wed, 31 Dec 2025 10:36:59 +0000]
Modernize Boost module finding for CMake 3.30+
Add CMP0167 policy to suppress FindBoost deprecation warning on CMake 3.30+
Use modern Boost imported targets (Boost::iostreams, Boost::thread,
Boost::unit_test_framework) when available (CMAKE_VERSION >= 3.30)
Fallback to old-style variables for CMake 3.28.
Split target_link_libraries calls: Boost libraries + non-Boost libraries.
"include_directories" for Boost handled in root CMakeLists.txt.
Fixes: CMake warning about deprecated FindBoost module on CMake 3.30+:
*******************************************
CMake Warning (dev) at CMakeLists.txt:137 (find_package):
Policy CMP0167 is not set: The FindBoost module is removed. Run "cmake
--help-policy CMP0167" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
*******************************************
Thomas Jarosch [Wed, 31 Dec 2025 10:36:53 +0000]
Add missing Boost include directory
Otherwise it defaults to /usr/include. During upgrades,
we want it to pick it up from /opt/boost/include.
Thomas Jarosch [Tue, 30 Dec 2025 20:32:14 +0000]
Fix Boost bind deprecation warning
Original warning:
boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
Use <boost/bind/bind.hpp> with boost::placeholders for Boost 1.46+.
Fall back to <boost/bind.hpp> for Boost 1.44 (no deprecation warning in that version).
Thomas Jarosch [Tue, 30 Dec 2025 08:59:25 +0000]
configfile: Fix passing along the "decoder" in load_ini_config_file()
Original warning:
src/i2n_configfile.cpp:66:25: error: unused parameter 'decoder' [-Werror=unused-parameter]
Thomas Jarosch [Wed, 31 Dec 2025 10:37:07 +0000]
Fix broken error check for iconv_open() result in iso_to_utf8()
The variable 'i2utf8' was misspelled as the function name 'iso_to_utf8'
in the error check. This would cause the error condition to always be false,
preventing proper detection of iconv_open() failures.
Luckily ISO-8859-1 to UTF-8 should always be available.
Thomas Jarosch [Tue, 30 Dec 2025 10:58:20 +0000]
Make TestPidOf1 unit test more robust
The test expects to find PID 1 by searching for "init" or "systemd".
While some LXC container is running:
- PID 1 runs systemd (not traditional init)
- Another process (e.g., PID 41150) may have "init" in its cmdline
This causes pid_of("init") to return PID 41150 instead of PID 1,
and the test would fail because PID 1 is not in the result.
The fix checks if PID 1 is found after the "init" search, and if not,
falls back to searching for "systemd" to find PID 1.
Kejdi Domi [Wed, 16 Oct 2024 13:29:01 +0000]
Replace inet_aton() with inet_pton() to parse IPs correctly (#8825)
inet_aton() modifies IPs in an unwanted manner (1.2 -> 1.0.0.2), so
for proper handling of IPs and for future support of IPv6 addresses,
it was changed to inet_pton() and tested accordingly.
Thomas Jarosch [Thu, 1 Aug 2024 12:48:44 +0000]
Release libi2ncommon 2.12
Issue a new release due to the .so version bump.
Thomas Jarosch [Thu, 1 Aug 2024 12:47:26 +0000]
Set minimum cmake version to 3.28
Probably a lower version would do but it's the
current version we have on the Intra2net system.
Solves one deprecation warning from Cmake.
Thomas Jarosch [Thu, 1 Aug 2024 12:44:55 +0000]
Bump soversion to 8 since ABI of the tmpfstream changed
Christian Herdtweck [Mon, 29 Apr 2024 09:27:25 +0000]
Add CLion dirs to gitignore
Thomas Jarosch [Thu, 1 Aug 2024 12:57:39 +0000]
Merge branch 'timefunc-fixes'
Philipp Gesang [Fri, 26 Apr 2019 15:00:12 +0000]
unit test Time::operator<<
Philipp Gesang [Fri, 26 Apr 2019 13:42:35 +0000]
test robustness against DST transition
Philipp Gesang [Fri, 26 Apr 2019 08:44:02 +0000]
add precautions for old glibc
The glibc 2.17 currently being used on the Intranator lacks two
commits from 2015 which implement correct handling of ISO8601
timezone specifications. This causes timestamp parsing to fail
where the `Z' suffix is used to indicate UTC, so comment out
the respective tests.
Philipp Gesang [Fri, 26 Apr 2019 07:47:30 +0000]
apply UTC offset during timestamp conversion
Glibc strptime(3) does not automatically apply the UTC offset
when present but stores it in the member tm_gmtoff. (Probably
because the standard mandates different, insufficient means
of timezone handling that need to be supported for portability.)
Thus we do that right in the constructor immediately after we
have obtained a valid struct tm.
Philipp Gesang [Fri, 26 Apr 2019 07:40:39 +0000]
fix formatting of timezone in iso timestamps
The `Z' indicates UTC and has no place in timestamps with an
explicit offset.
Philipp Gesang [Thu, 25 Apr 2019 14:20:36 +0000]
explicitly set timezone for tests that depend on it
Some timefunc tests rely on the time zone to be CE[S]T and will
fail otherwise. Not a good thing for a correctness test to do, so
set the zone explicitly in those cases. Example:
$ ./test/test_i2ncommon --run_test=TestTimeFunc/FormatFullTime
Running 1 test case...
*** No errors detected
$ TZ=UTC ./test/test_i2ncommon --run_test=TestTimeFunc/FormatFullTime
Running 1 test case...
/home/philipp/src/i2ncommon/libi2ncommon-git/test/test_timefunc.cpp(480): error: in "TestTimeFunc/FormatFullTime": check "17.10.2011 11:33" == format_full_time(seconds) has failed [17.10.2011 11:33 != 17.10.2011 09:33]
Thomas Jarosch [Mon, 20 May 2024 10:54:29 +0000]
Replace outdated (std::ios_base::)open_mode with openmode
Otherwise we'll get a compile error on C++17.
Thomas Jarosch [Mon, 20 May 2024 10:47:25 +0000]
Include 'algorithm' header for std::sort()
gcc 8.3+ errored out about missing std::sort() when including "timefunc.hxx".
Thomas Jarosch [Mon, 20 May 2024 10:43:46 +0000]
convert_hex_to_binary(): Remove exception specification
gcc complained:
"ISO C++17 does not allow dynamic exception specifications"
Also remove it in ensure_indent_level() static function.
Thomas Jarosch [Mon, 10 Jan 2022 15:26:00 +0000]
Merge branch 'daemon-ext'
Philipp Gesang [Fri, 7 Jan 2022 10:07:19 +0000]
add handling of stdio descriptors
This completes the daemonization API by adding a function that
reassigns the stdio descriptors to /dev/null to prevent the
process from being tied IO wise to the terminal it was started
on.
A ``daemonize_full()`` helper combines all the daemonization
steps into a single call.
Philipp Gesang [Mon, 10 Jan 2022 14:27:12 +0000]
don't leak iconv context on OOM
Philipp Gesang [Wed, 5 Jan 2022 15:38:15 +0000]
add session handling
The ``daemonize()`` API does not establish a new session so
processes that use it end up being controlled by the tty of the
process they were launched under, which too often happens to be
some system console.
Thomas Jarosch [Mon, 29 Nov 2021 13:37:02 +0000]
Merge branch 'html_entities_iso'
Philipp Gesang [Mon, 29 Nov 2021 13:25:01 +0000]
fix typo
Philipp Gesang [Mon, 29 Nov 2021 13:24:10 +0000]
add latin-1 wrapper for html_entities
Still a bit underwhelming as we can't express the encoding
difference in the type system.
Philipp Gesang [Tue, 16 Nov 2021 09:45:28 +0000]
account for deletion marker in /proc/pid/exe
The kernel appends a `` (deleted)`` suffix to the executable path
if the original binary has been unlinked since the process was
started. The ``pid_of()`` API needs to account for this when
matching process names.
Thomas Jarosch [Sat, 23 May 2020 10:33:35 +0000]
Fix 'occurred' typo
Philipp Gesang [Mon, 3 Feb 2020 14:40:37 +0000]
remove unused constants
These have been provided by glibc for ages and are no longer
needed.
Philipp Gesang [Mon, 3 Feb 2020 14:35:38 +0000]
replace obsolete call to ftime(3)
ftime() and timeb.h have been deprecated since POSIX 2008 and
will be removed in future versions of glibc [0]. Replace them
with (probably faster) calls to clock_gettime(2).
[0] https://sourceware.org/ml/libc-announce/2020/msg00001.html
Philipp Gesang [Thu, 25 Apr 2019 13:58:55 +0000]
drop reference to obsolete symbol from unit test
The revert
commit
49ee03b8f8540d2f09ebd416d2f3e09350300573 (origin/master, origin/HEAD)
Author: Christian Herdtweck <christian.herdtweck@intra2net.com>
Date: Thu Apr 18 17:35:21 2019 +0200
Revert "Add another convenience function allowing i18n_noops("foo")+"bar""
failed to revert one use of i18n_noops() from the unit tests
which breaks the build. Fix it by removing the call.
Christian Herdtweck [Thu, 18 Apr 2019 15:35:21 +0000]
Revert "Add another convenience function allowing i18n_noops("foo")+"bar""
Such string-return aliases for i18n functions encourage creation of texts
using concatenation (+). However, such strings might not be translateable
in the future (e.g. into languages with very different word order).
To encourage using i18n_get_string() which is a translation-friendly way
to dynamically assemble strings, we remove this
This reverts commit
0562a0f617437d45d9e344da14980598d7c6c93d.
Thomas Jarosch [Fri, 5 Apr 2019 14:30:01 +0000]
Release libi2ncommon 2.11
No increase in SOVERSION needed as far as I can tell.
Thomas Jarosch [Fri, 5 Apr 2019 14:23:44 +0000]
Merge branch 'timefunc-new'
Philipp Gesang [Fri, 5 Apr 2019 09:48:44 +0000]
document some more timefunc member functions
Philipp Gesang [Fri, 5 Apr 2019 07:08:07 +0000]
add constructor tests for all Time::Clock ids and variants
Go through the supported combinations of clock modes in the
constructor tests.
Philipp Gesang [Fri, 5 Apr 2019 06:51:25 +0000]
stop leaking TZ between unit tests
So apparently boost/unit_test does not restore the original
environment for each test. Do that ourselves then for the TZ
variable which is needed for certain tests.
Also enable UTC in more helpers that leave it unspecified in
formatting. Till now those were relying on the UTC set in a
previous test. Ew!
Philipp Gesang [Thu, 4 Apr 2019 15:23:08 +0000]
document timefunc api
Philipp Gesang [Thu, 4 Apr 2019 15:06:25 +0000]
document clockid_t helper
Philipp Gesang [Thu, 4 Apr 2019 14:35:47 +0000]
remove bogus clock variant check
Spotted by Tom: There are no variants to CLOCK_BOOTTIME so
this would fall back on the default monotonic clock.
Philipp Gesang [Thu, 4 Apr 2019 14:26:09 +0000]
handle strftime() more defensively
Null terminating the result is not necessary under the assumption
that the function works as advertised since we start out with a
zeroed buffer. Thus drop the calculation based on its return
value and null terminate the final byte instead -- after all if
the function should be borked we have no idea where the
terminator should go.
Also error out if it returns zero since the ISO time format cannot
result in the empty string.
Thomas Jarosch [Wed, 27 Mar 2019 15:49:44 +0000]
Fix output unit for Time::operator<<
It's seconds instead of milliseconds.
Thomas Jarosch [Wed, 27 Mar 2019 09:38:41 +0000]
Fix compile warning
timefunc.cpp: In function ‘boost::optional<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > format_min_sec_msec(const timespec&)’:
timefunc.cpp:1000: warning: '0' flag ignored with precision and ‘%d’ gnu_printf format
Also fix small typos.
Philipp Gesang [Mon, 5 Feb 2018 13:49:28 +0000]
add more struct timespec/Time formatters
Add formatters for durations:
* format_sec_msec: ``1s 337ms'', and
* format_min_sec_msec: ``1m3.370s'' (following time(1)).
Also only use string option types when there is actually an error
path under our control (e. g. with snprintf(3)). (NB the
omnipresent to_string() does not propagate formatting errors
upward so the wrappers we have for it return a plain string.)
Philipp Gesang [Thu, 1 Feb 2018 09:50:02 +0000]
take precautions for 32bit time_t/long
Direct handling of time_t or conversions to it from other
representations will cause failures on 32 bit systems. Introduce
an exception ``conversion_error'' to communicate these conditions
from constructors.
Philipp Gesang [Wed, 31 Jan 2018 13:32:59 +0000]
use separate directives for time formatting and scanning
Glibc 2.17 has trouble with length modifiers in format directives
which prevents us from using the same strings both ways. This is
fixed in later versions (by 2.25 definitely, maybe earlier) but
for the time being we have to use different format strings
depending on the action.
Philipp Gesang [Tue, 30 Jan 2018 16:00:07 +0000]
implement division by scalar for Time and container ops
Add division by integer plus related operations over containers.
As per C++ convention the division functions themselves will not
attempt to handle the case when zero is passed as the divisor.
The functions operating on containers will simply return a zero-
initialized Time object if the argument container is empty.
Philipp Gesang [Tue, 30 Jan 2018 14:52:25 +0000]
allow creating Time objects from formatted timestamps
Read ISO-8601 formatted strings to construct timestamps from.
The format strings already defined for formatting timestamps are
reused. Since years can be negative but the sign handling in
glibc is flawed with the %Y specifier, we need to handle negative
year numbers manually.
Philipp Gesang [Tue, 30 Jan 2018 09:24:03 +0000]
extend Time class with string formatters
Add convenience member functions for the existing formatters.
Note that the make_*() group of functions all use
``localtime_r()`` internally so unit tests must be guarded by an
explicit time zone change to UTC.
Philipp Gesang [Tue, 9 Jan 2018 10:52:53 +0000]
add ISO-8601 formatters to timefunc
Adds format_iso8601() to create conforming timestamps from
broken-down time. Includes overload wrappers for time_t and
struct timespec.
Philipp Gesang [Mon, 29 Jan 2018 13:02:18 +0000]
implement basic operations over class Time
This adds members and overloads for
* addition, subtraction / difference, multiplication by
time_t,
* comparison, less-than / greater-than, equality,
* trivial formatting (needed in boost unittest)
operations involving *class Time* objects.
Philipp Gesang [Mon, 29 Jan 2018 10:06:13 +0000]
implement a basic time/clock datastructure
Add a class ``Time'' to the timefunc part of the library. The
goal is to provide a generalist handle around struct timespec to
supersede the current ones that had been built on now deprecated
APIs (e. g. ``timeb.h'').
Philipp Gesang [Tue, 27 Nov 2018 15:30:41 +0000]
stop leaking FILE* objects when hashing
In hash_file(), the input FILE* needs freeing when no error
occurred. Do this as soon as it is not needed anymore.
Philipp Gesang [Tue, 27 Nov 2018 15:14:20 +0000]
make crypto code compile with openssl 1.1.x
From EVP_DigestInit(3):
EVP_MD_CTX_create() and EVP_MD_CTX_destroy() were renamed
to EVP_MD_CTX_new() and EVP_MD_CTX_free() in OpenSSL 1.1.
Philipp Gesang [Tue, 27 Nov 2018 15:06:22 +0000]
drop unused includes from userfunc
Ironically, despite the duplicate include the userfunc routines
never even check errno at all.
Thomas Jarosch [Tue, 2 Oct 2018 12:16:08 +0000]
Merge branch 'redirect-urlauth'
Thomas Jarosch [Fri, 28 Sep 2018 12:43:45 +0000]
Remove default hash algorithm from the new hash functions
Rationale: SHA1 is outdated, we would need to switch
to something like SHA256 nowadays. If the algorithm
is given explicitly, we can grep for the identifier.
When we do the migration from the libgcrypt-intranator API,
it's better to explicitly adapt the call sites.
Túlio Cavalcanti [Tue, 18 Sep 2018 13:12:10 +0000]
RedirectHash class created in restricted_html file
class used to find all redirect urls in a html text and add a query
parameter "urlauth" with a hash as value to them.
Tulio Cavalcanti [Mon, 17 Sep 2018 12:47:26 +0000]
Hashing functions based upon openssl created
The following functions were implemented:
string hash_data(string data, algorithm algo=SHA1); // output: hex encoded hash
string hash_data_raw(string data, algorithm algo=SHA1); // output: raw binary hash
string hash_file(string filename, algorithm algo=SHA1); // hash data in 64kb blocks
Unit test also included.
Thomas Jarosch [Tue, 4 Sep 2018 15:39:05 +0000]
Add openssl-devel to build requirements
Thomas Jarosch [Wed, 15 Aug 2018 15:14:58 +0000]
Revert "restore join_string() symbols in library"
We bump the SOVERSION of the library, so no compat functions needed anymore.
This reverts commit
f3b61bd6816546a39a072a5b8be56d78cf775683.
Thomas Jarosch [Wed, 15 Aug 2018 14:54:30 +0000]
Bump soversion to 7 since the pipestream interface changed
Thomas Jarosch [Tue, 14 Aug 2018 15:24:14 +0000]
Merge branch 'pipeexec'
Thanks Philipp!
Philipp Gesang [Tue, 26 Jun 2018 07:38:56 +0000]
add support for guarding pipestream with NO_NEW_PRIVS
Add an option to the pipestream and related APIs to drop the
right to obtain further privileges before exec()ing the binary
(off by default). This may be used as an additional measure to
guard invocations of untrusted binaries or trusted ones that
operate on untrusted inputs.
Target audience: arnied scheduler, everywhere file(1) or
imagemagick tools are called.
Defects: it will be tricky to properly unit test this.
[0] https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt
Philipp Gesang [Tue, 14 Aug 2018 13:38:50 +0000]
do not indent boost unittest structurals
As per request. Does not contain functional changes.
Philipp Gesang [Mon, 13 Aug 2018 15:25:58 +0000]
pass pipestream flags as bitset
Avoid cluttering the API with long lists of booleans by using
symbolic names instead.
Philipp Gesang [Tue, 17 Apr 2018 09:32:20 +0000]
add option to forward environment to pipestream
Add an argument to all execve-based pipestream APIs to control
whether *environ* should be passed through to the executed
command. Till now this used to depend on whether path lookup was
requested which is rather undesirable.
Unit tests included.
Philipp Gesang [Mon, 12 Feb 2018 14:32:36 +0000]
skip unit tests for handling child errors in pipestream with ancient boost
Philipp Gesang [Mon, 12 Feb 2018 10:52:23 +0000]
distinguish child errors from failing to exec
Use the old pipe/cloexec trick to separate errors from the spawned
program from such that occur before execv[p]e(). Only errors on
the far side of exec() may be handled by the user.
Philipp Gesang [Mon, 12 Feb 2018 09:48:07 +0000]
protect pipe fd with O_CLOEXEC
On the parent, prevent other exec()s than the one in our child
from carrying over the fd. The pipe wrapper may be long lived
for this to become a problem.
Philipp Gesang [Mon, 12 Feb 2018 08:19:53 +0000]
block signals before fork()ing the pipestream child
Block all signals until we are ready to handle them again.
In particular, this saves us checking for close(2) being
interrupted.
Philipp Gesang [Thu, 4 Jan 2018 16:35:48 +0000]
redirect unused fds to /dev/null in pipestream
Closing an fd like stdout and stderr will cause EBADF on access
which may not be handled in a child process. Thus redirect them
to /dev/null if the user requests that their output be ignored.
Philipp Gesang [Wed, 3 Jan 2018 17:08:44 +0000]
allow path lookup for pipestream
Add a flag ``path'' which, if set, causes the specified program
to be executed with execvpe(); also, the environment is passed
on so in this case (to propagate $PATH) so it is up to the caller
to sanitize envp beforehand.
Philipp Gesang [Thu, 4 Jan 2018 08:17:10 +0000]
add printing helper to pipestream status specification
Philipp Gesang [Wed, 3 Jan 2018 16:16:43 +0000]
handle pipe termination separately depending on whether a shell is present
Keep the child's pid around and wait() for it to perish in the
dtor of inpipestream. Return the error from closing the pipe or
terminating the process in the shell-free version. The mechanism
for retrieving the status does not allow to distinguish between
the two, so always prefer the latter.
Philipp Gesang [Wed, 3 Jan 2018 13:50:50 +0000]
add pipestream unit tests for execution failure
Note that on the Intranator as of 6.4.13, the argument
--catch_system_errors=no must be passed to the unit test
executable on account of ancient Boost being oversensitive to
child process termination.
Philipp Gesang [Tue, 2 Jan 2018 16:55:28 +0000]
allow selecting stdout and stderr with inpipestream
Only handle the user-requested fd in the forked command and
discard the other.
Philipp Gesang [Tue, 2 Jan 2018 16:12:47 +0000]
bump release version 2.9 -> 2.10
Philipp Gesang [Tue, 2 Jan 2018 16:10:13 +0000]
add pipestream ctor overload for vectors of string
Add definitions that make passing a vector<string> equivalent to
passing a char**, i. e. take the execve() path.
Philipp Gesang [Tue, 2 Jan 2018 15:13:30 +0000]
add unit test series for pipestream
Setup skeleton unit test file with some simple functionality
tests and include it in a normal run. There haven't been any
pipestream tests so far.
Philipp Gesang [Fri, 9 Feb 2018 13:21:41 +0000]
add shell-free pipestream
Overload the pipestream ctor with a variant that avoids shelling
out with *popen(3)* that is chosen by passing an argument list
in lieu of a command.
Juliana Rodrigueiro [Wed, 8 Aug 2018 12:40:24 +0000]
Implement percent url encoder and decoder
Juliana Rodrigueiro [Wed, 8 Aug 2018 12:13:39 +0000]
Add basic restricted_html structure
Philipp Gesang [Mon, 29 Jan 2018 08:03:38 +0000]
use glibc syscall wrapper for clock_gettime
These are available on any non-ancient system by now so it’s safe
to drop them.
Thomas Jarosch [Wed, 8 Aug 2018 09:31:39 +0000]
Merge branch 'scopetracker-nothrow'
The nothrow() modification of SourceLocation has been dropped
since std::string might throw std::bad_alloc.
Fixing this would require more work for little gain.
Christian Herdtweck [Mon, 6 Aug 2018 10:43:33 +0000]
Wrap Scopetracker constructor/destructor in big try-catch