Dmitry Kalinkin [Thu, 21 Oct 2021 23:34:08 +0000 (19:34 -0400)]
Fix python bindings installation in case of empty DESTDIR
The current behaviour is to install the extension to ./usr/local (if
prefix is /usr/local), so it ends up in the temporary build directory
instead of the intended absolute prefix.
The slash after $(DESTDIR) is needed to make empty DESTDIR mean
installation to / instead of making the prefix to mean a relative
path. We make it triple slash as POSIX reserves double slashes to
possibly have a special treatment by the OS.
The change for travis is needed as "make install" is run as root, and
once the python extension is actually installed, it leaves a
root-owned .egg-info file.
Wolfgang Stöggl [Tue, 13 Jul 2021 18:23:54 +0000 (20:23 +0200)]
Add escapeJSON() to legend entries
Double quotes in legends are currently not escaped, if JSON imgformat
is used for rrdtool graph. This produces invalid JSON files.
See comment in #409 for further details.
Wolfgang Stöggl [Tue, 29 Jun 2021 19:16:53 +0000 (21:16 +0200)]
Update Windows GitHub Actions
- Update ci-workflow.yml and add GitHub Actions for Windows builds
using MSVC and vcpkg. Both, x64 and x86 builds are part of the CI.
The required vcpkg ports are installed and cached using
lukka/run-vcpkg@v7
- Add release-windows.yml, which enables building Windows binaries of
RRDtool. This GitHub action is run automatically upon new tags and
can be triggered manually. The required .exe and .dll files are
copied using collect_rrdtool_vcpkg_files.bat and deployed by
actions/upload-artifact@v2
- Makefile_vcpkg.msc:
Add include\harfbuzz, which is required for building pango. Fixes: pango-coverage.h(28): fatal error C1083:
Cannot open include file: 'hb.h': No such file or directory
Sven Panne [Mon, 22 Mar 2021 11:55:26 +0000 (12:55 +0100)]
Avoid segfault: Don't read and write into the same buffer.
Using CTX->rrd_error as a source *and* destination buffer at the same time
provokes undefined behavior. In real life you get funny error messages
and/or segfaults within vs(n)printf().
Simple solution: Use a temporary copy of the error message while writing
into it.
Wolfgang Stöggl [Sat, 13 Mar 2021 09:06:06 +0000 (10:06 +0100)]
Switch to pkgconf (MSYS2, MinGW-w64)
The MSYS2 project has switched from pkg-config to pkgconf as default.
For details, see: https://github.com/msys2/MSYS2-packages/pull/2197
Both packages work when building RRDtool for Windows using MSYS2.
- Switch to pkgconf instead of pkg-config
- Update the following files:
.github/workflows/ci-workflow.yml
win32/README-MinGW-w64
- This avoids the following warning in the Windows CI-build:
warning: removing 'mingw-w64-x86_64-pkg-config' from target list
because it conflicts with 'mingw-w64-x86_64-pkgconf'
Simon Arlott [Fri, 11 Dec 2020 18:38:42 +0000 (18:38 +0000)]
Use a separate pango fontmap per thread
Reusing the same fontmap from multiple threads is not safe, despite
the attempts to use a mutex to protect it there are other instances
where it behaves unexpectedly if graphs are created from multiple
threads at the same time, e.g.:
(process:76234): Pango-WARNING **: 11:47:25.823: failed to create cairo scaled font, expect ugly output. the offending font is 'DejaVu Sans Mono 8'
(process:76234): Pango-WARNING **: 11:47:25.823: font_face status is: no error has occurred
(process:76234): Pango-WARNING **: 11:47:25.823: scaled_font status is: invalid matrix (not invertible)
(process:76234): Pango-WARNING **: 11:47:25.823: shaping failure, expect ugly output. shape-engine='PangoFcShapeEngine', font='DejaVu Sans Mono 8', text='Apparent temp (?C)'
This error results in boxes instead of characters on the graph. In the
worst case scenario there are memory management errors that cause GLib
to complain or the process to abort.
Calling pango_cairo_font_map_get_default() multiple times from the same
thread will return the same object, so this satisfies the performance
expectations of reusing it within a single thread. Trying to lock a
mutex for even more pango/cairo function calls is likely to decrease
performance when multiple threads are used concurrently.
Wolfgang Stöggl [Sun, 9 Aug 2020 19:20:02 +0000 (21:20 +0200)]
Add -no-undefined automatically for MinGW-w64
The linker flag -no-undefined is required, when building the dll for
Windows using MinGW-w64. Add -no-undefined to librrd_la_LDFLAGS in
Makefile.am in case of MinGW-w64 builds. This way it is not necessary
anymore to add LDFLAGS=-no-undefined to the make command.
Allow to generate a graph as if the current timezone was UTC (e.g set TZ=UTC).
This allows to easily calculate daily average ranging from midgnight to midnight rather than say the last 24 hours.
Niclas Zeising [Sun, 14 Jun 2020 09:31:33 +0000 (11:31 +0200)]
rrd_open: Ignore EINVAL from posix_fallocate()
ZFS on FreeBSD (at least) does not support posix_fallocate(),
returning EINVAL instead. Ignore this error and continue normally.
Without this change, it is not possible to resize rrd files on ZFS.
Wolfgang Stöggl [Mon, 18 Nov 2019 19:11:47 +0000 (20:11 +0100)]
Use LC_NUMERIC=C for tests
The following tests require dot as decimal separator:
graph1, rpn1, create-with-source-4, dcounter1, vformatter1, pdp-calc1
Set LC_NUMERIC=C, which allows these tests to pass also under locales,
where the decimal separator is not a dot by default:
de_DE, es_ES, fr_FR, nl_NL etc.
From Debian lintian checker:
Each manual page should start with a "NAME" section, which lists the
name and a brief description of the page separated by "\-". The "NAME"
section is parsed by lexgrog and used to generate a database that's
queried by commands like apropos and whatis. This tag indicates that
lexgrog was unable to parse the NAME section of this manual page.
For manual pages that document multiple programs, functions, files, or
other things, the part before "\-" should list each separated by a comma
and a space. Each thing listed must not contain spaces; a man page for a
two-part command like "fs listacl" must use something like "fs_listacl"
in the "NAME" section so that it can be parsed by lexgrog.
Refer to the lexgrog(1) manual page, the groff_man(7) manual page, and
the groff_mdoc(7) manual page for details.
Wolfgang Stöggl [Thu, 26 Sep 2019 07:27:47 +0000 (09:27 +0200)]
Sort and remove duplicate entries in ALL_LIBS
- So far, configure showed e.g. the following at the end:
Libraries: -lgobject-2.0 -lpng -lm -ldbi -lglib-2.0 -lpangocairo-1.0
-lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo -lxml2
The variable ALL_LIBS included duplicates resulting from the configure
process and some double spaces.
- Now, ALL_LIBS is sorted and duplicate entries are removed, e.g.:
Libraries: -lcairo -ldbi -lglib-2.0 -lgobject-2.0 -lharfbuzz -lm
-lpango-1.0 -lpangocairo-1.0 -lpng -lxml2
Wolfgang Stöggl [Sun, 8 Sep 2019 13:19:09 +0000 (15:19 +0200)]
Remove duplicate code of find_first_weekday()
So far, the same code of find_first_weekday() was used in rrd_graph.c
and rrd_rpncalc.c
Remove duplicate code from rrd_graph.c and add find_first_weekday()
to rrd_rpncalc.h, which is included from rrd_graph.h
Wolfgang Stöggl [Tue, 10 Sep 2019 10:07:14 +0000 (12:07 +0200)]
Use DefaultPlatformToolset for .vcxproj files
- Use $(DefaultPlatformToolset) for the PlatformToolset
instead of v140. This allows to use the associated PlatformToolset
automatically for each version of Visual Studio:
v140 for VS2015, v141 for VS2017, v142 for VS2019.
However, a developer can easily target projects to a desired,
different PlatformToolset.
- Set ToolsVersion="Current" instead of ToolsVersion="14.0"
- Strings were replaced in .vcxproj files the following way:
git grep -l 'v140' -- '*.vcxproj' | \
xargs sed -i 's/v140/$(DefaultPlatformToolset)/g'
git grep -l '14.0' -- '*.vcxproj' | xargs sed -i 's/14.0/Current/g'
Wolfgang Stöggl [Sat, 7 Sep 2019 20:27:22 +0000 (22:27 +0200)]
Use temp pointer for realloc()
- Fixes the following Cppcheck 1.89 errors:
[src/rrd_cgi.c:295] (error) Common realloc mistake:'varheap'
nulled but not freed upon failure [memleakOnRealloc]
[src/rrd_cgi.c:1138] (error) Common realloc mistake: 'argv'
nulled but not freed upon failure [memleakOnRealloc]
[src/rrd_graph.c:1211] (error) Common realloc mistake: 'steparray'
nulled but not freed upon failure [memleakOnRealloc]
In rrd_client_last and rrd_client_first, the response value is in the
message prior to any additional lines. Unfortunately, the buffer that
contains this data is on the stack for response_read and is no longer valid
by the time the caller sees it.
This change strdups the message line in response_read and subsequently frees
it in response_free.
Wolfgang Stöggl [Mon, 2 Sep 2019 10:20:54 +0000 (12:20 +0200)]
Clean tests/rpn1.out
- There was another leftover in the tests folder after
make clean: rpn1.out
It is a png file created during the test rpn1
- This is a followup commit to PR #1049
Clar Fon [Sun, 25 Aug 2019 23:18:47 +0000 (19:18 -0400)]
Zero wbuf on start.
It turns out that calloc isn't enough, because listen_fds is copied to the socket array on start. This zeroes these fields out when the socket is opened.
Wolfgang Stöggl [Thu, 22 Aug 2019 12:18:35 +0000 (14:18 +0200)]
Fix compiler warning (-Wstringop-truncation)
- Use strncat() the following way in rrd_cgi.c:
strncat(dest, src, dest_size - strlen(dest) - 1);
- Fixes the following gcc compiler warning:
rrd_cgi.c:1407:21: warning: ‘strncat’ output truncated before
terminating nul copying as many bytes from a string as its length
[-Wstringop-truncation]
strncat(line, tmp, tmplen);