Conversation
arogge
left a comment
There was a problem hiding this comment.
still needs some work, some of the read() and write() calls are still not checked thoroughly.
But good progress anyway!
core/src/console/console.cc
Outdated
| while (items && list_index < items_list_size) { | ||
| name = (char*)items->list[list_index]; | ||
| list_index++; | ||
|
|
There was a problem hiding this comment.
The lines following this do a malloc(), followed by a strcpy() and then return the allocated string.
Isn't that exactly what strdup() does?
core/src/stored/btape.cc
Outdated
| // macros that check for the return value of read() and write() | ||
| // to avoid warnings about unused results. | ||
| #define READ(FD, BUF, COUNT) \ | ||
| if (read(FD, BUF, COUNT) < 0) { \ | ||
| BErrNo be; \ | ||
| Emsg1(M_FATAL, 0, _("read failed: %s\n"), be.bstrerror()); \ | ||
| } | ||
|
|
||
| #define WRITE(FD, BUF, COUNT) \ | ||
| if (write(FD, BUF, COUNT) < 0) { \ | ||
| BErrNo be; \ | ||
| Emsg1(M_FATAL, 0, _("write failed: %s\n"), be.bstrerror()); \ | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
I think it is a lot easier to do have inline functions than a macro.
Otherwise you'd need to wrap into do { .. } while(0); so it won't behave strangely.
| } | ||
|
|
||
| children = json_object_object_get(obj, "children"); | ||
| json_object_object_get_ex(obj, "children", &children); |
There was a problem hiding this comment.
return code is bool and should probably be checked. The docs doesn't state what children will be set to on error, so we should probably assume it can be undefined and not rely on comparing with NULL only.
core/src/lib/crypto_openssl.cc
Outdated
| int status; | ||
| int status = 0; | ||
|
|
||
| # if (OPENSSL_VERSION_NUMBER <= 0x10000000L) |
There was a problem hiding this comment.
You cannot remove that for OpenSSL 1.0.0. Otherwise locking won't work and threading will break.
However, you can probably remove it for OpenSSL 1.1.0, but please make really sure none of the removed calls is required (we have broken that in the past already).
| install(TARGETS python-dir DESTINATION ${plugindir}) | ||
| target_link_libraries(python-dir ${Python2_LIBRARIES} bareos) | ||
| target_include_directories(python-dir PUBLIC SYSTEM ${Python2_INCLUDE_DIRS}) | ||
| target_include_directories(python-dir SYSTEM PUBLIC ${Python2_INCLUDE_DIRS}) |
There was a problem hiding this comment.
while this will silence the warning for strict-aliasing, we should probably also set -fno-strict-aliasing as a compile option so the compiler will not generate broken code.
4ac2d5a to
a3c7bd0
Compare
| *af = AF_INET6; | ||
| } else { | ||
| strncpy(new_host, host, host_len); | ||
| strncpy(new_host, host, strlen(new_host)); |
There was a problem hiding this comment.
if new_host points to newly allocated memory, that has been zero initialized, strlen(new_host) will evalutate to 0, which will lead to not copying host at all.
core/src/lib/crypto_cache.cc
Outdated
| Dmsg1(000, "Write hdr error: ERR=%s\n", be.bstrerror()); | ||
| goto bail_out; | ||
| } | ||
| != sizeof(crypto_cache_hdr)) {} |
| _("[file_size=n(GB)|nb_file=3|skip_zero|skip_random|skip_raw|skip_block]" | ||
| " " | ||
| "report drive speed")}, |
There was a problem hiding this comment.
| _("[file_size=n(GB)|nb_file=3|skip_zero|skip_random|skip_raw|skip_block]" | |
| " " | |
| "report drive speed")}, | |
| _("[file_size=n(GB)|nb_file=3|skip_zero|skip_random|skip_raw|skip_block]" | |
| " report drive speed")}, |
1ddd4e1 to
01390cd
Compare
|
The old Debian 9.0 and Univention 4.4 systems complain about unused functions and the unknown attribute |
|
Then we should probably disable droplet in i386, as it is definitely broken (or we would have to fix a lot of format-strings) |
01390cd to
8592330
Compare
|
|
||
| static void InitSignalHandler() | ||
| { | ||
| #if !HAVE_WIN32 |
There was a problem hiding this comment.
| #if !HAVE_WIN32 | |
| #if !defined(HAVE_WIN32) |
a2c16af to
84ce4d0
Compare
838ec7a to
3f3c219
Compare
core/src/lib/crypto_cache.cc
Outdated
| Dmsg1(000, "Write hdr error: ERR=%s\n", be.bstrerror()); | ||
| goto bail_out; | ||
| } | ||
| != sizeof(crypto_cache_hdr)) {} |
1e365c7 to
d893c06
Compare
... as it is in all other places to avoid a warning.
Apparently Solaris can produce strings up to 299 bytes for this, so we increase the size of the buffer to 300 bytes.
LMDB utilizes some kind of old-style variable-length-array. This leads to stringop-overflow warnings, which we can ignore as the out-of-bounds access is intentional (and not really out-of-bounds).
This patch removes the openssl thread callbacks when building with OpenSSL 1.1.0 or newer. However, references to the callbacks are kept, so if any of them was required, compiling would fail.
this is a no-op anyway and will yield a compiler warning, so we disable it.
This patch replaces "%F %T" with the equivalent (and more portable) long variant "%Y-%m-%d %H:%M:%S", so that Windows build will show progress, too.
When initializing BareosWinFilePacket* we now use placement new so the struct values are nicely initialized by our constructor instead of forced zero initialization like before.
Previously for win32 'I' was used, but this is not required anymore and will produce a warning on mingw32.
Previously LINK_LIBRARIES for sd_reservation was overspecified which lead to an issue with ODR (symbols from SD and Dir could have been used).
The macro PLATFORM is already used in pyconfig.h on Windows builds, so we rename our macro to BAREOS_PLATFORM to avoid clashing.
The configuration parser had set the undocumented and unused environment variable BAREOS_CFGDIR, which could potentially have been used in scripts and programs generating configuration snippets. However, as this was never documented and is not used by Bareos itself, we remove it and with it the need for setenv() and/or putenv().
Python should autodetect 32-bit and 64-bit Windows, but this is broken when building with GCC[1]. The previous workaround we had in place defined MS_WIN32 or MS_WIN64 depending on what we're building. As MS_WIN32 is always defined, we should only define MS_WIN64 in case we're building 64-bit Windows. [1] https://bugs.python.org/issue4709
As we currently have no warning left, we reduce the quality gates to be strict.
As droplet is now part of the bareos repo.
As we currently have no warning left, we reduce the quality gates to be strict.
d893c06 to
910adfb
Compare
Thank you for contributing to the Bareos Project!
Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
General
Source code quality
bareos-check-sources --since-mergedoes not report any problemsgit statusshould not report modifications in the source tree after building and testing