diff --git a/ci/editorconfig.sh b/ci/editorconfig.sh index 661aec1a7..427c45061 100755 --- a/ci/editorconfig.sh +++ b/ci/editorconfig.sh @@ -4,6 +4,7 @@ for f in $(git ls-tree -r HEAD --name-only); do if [ "$f" = "${f%.out}" ] && [ "$f" = "${f%.data}" ] && [ "$f" = "${f%.png}" ] && + [ -f "$f" ] && [ "$(echo "$f" | cut -d / -f1)" != "vendor" ] && [ "$(dirname "$f")" != "src/test/regress/output" ] then diff --git a/src/backend/distributed/Makefile b/src/backend/distributed/Makefile index e3803dbdf..82e11cd11 100644 --- a/src/backend/distributed/Makefile +++ b/src/backend/distributed/Makefile @@ -7,13 +7,6 @@ safestringlib_builddir = $(citus_top_builddir)/vendor/safestringlib/build safestringlib_a = $(safestringlib_builddir)/libsafestring_static.a safestringlib_sources = $(wildcard $(safestringlib_srcdir)/safeclib/*) -# Use cmake3 if it exists, otherwise just use the string "cmake" and let bash -# figure out its exact path later. -# Using "which cmake" instead will make the error very hard to understand if -# you have neither "cmake3" or "cmake" in path. In that case the "CMAKE3" -# variable would be an empty string. -CMAKE3 = $(shell which cmake3 || echo cmake) - MODULE_big = citus EXTENSION = citus @@ -23,7 +16,11 @@ generated_sql_files = $(patsubst %,$(citus_abs_srcdir)/build/%,$(template_sql_fi DATA_built = $(generated_sql_files) # directories with source files -SUBDIRS = . commands connection ddl deparser executor master metadata planner progress relay test transaction utils worker +SUBDIRS = . commands connection ddl deparser executor master metadata planner progress relay safeclib test transaction utils worker + +# Symlinks are not copied over to the build directory if a separete build +# directory is used during configure (such as on CI) +ENSURE_SUBDIRS_EXIST := $(shell mkdir -p $(SUBDIRS)) # That patsubst rule searches all directories listed in SUBDIRS for .c # files, and adds the corresponding .o files to OBJS @@ -50,23 +47,11 @@ utils/citus_version.o: $(CITUS_VERSION_INVALIDATE) SHLIB_LINK += $(filter -lssl -lcrypto -lssleay32 -leay32, $(LIBS)) -override LDFLAGS += $(safestringlib_a) override CPPFLAGS += -I$(libpq_srcdir) -I$(safestringlib_srcdir)/include SQL_DEPDIR=.deps/sql SQL_BUILDDIR=build/sql -$(safestringlib_a): $(safestringlib_sources) - rm -rf $(safestringlib_builddir) - mkdir -p $(safestringlib_builddir) - @# exports of LDFLAGS and CPPFLAGS are to make sure the ones from this - @# Makefile are not used - +cd $(safestringlib_builddir) && \ - export LDFLAGS='' && export CPPFLAGS='' && \ - $(CMAKE3) $(safestringlib_srcdir) && make - -citus.so: $(safestringlib_a) - $(generated_sql_files): $(citus_abs_srcdir)/build/%: % @mkdir -p $(citus_abs_srcdir)/$(SQL_DEPDIR) $(citus_abs_srcdir)/$(SQL_BUILDDIR) cd $(citus_abs_srcdir) && cpp -undef -w -P -MMD -MP -MF$(SQL_DEPDIR)/$(*F).Po -MT$@ $< > $@ diff --git a/src/backend/distributed/safeclib b/src/backend/distributed/safeclib new file mode 120000 index 000000000..c4da5b7ad --- /dev/null +++ b/src/backend/distributed/safeclib @@ -0,0 +1 @@ +../../../vendor/safestringlib/safeclib/ \ No newline at end of file diff --git a/vendor/README.md b/vendor/README.md index e6da4b639..43b27ead1 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -6,5 +6,5 @@ git clone https://github.com/intel/safestringlib rm -rf safestringlib/{.git,unittests} git add safestringlib/ git commit -m "Update safestringlib" -git cherry-pick -x 92d7a40d1de472d23d05967be9b77eda30af85cb +git cherry-pick -x dc2a371d9f8b28ad0e68c5230bb998b4463d8131 ``` diff --git a/vendor/safestringlib/CMakeLists.txt b/vendor/safestringlib/CMakeLists.txt index 41d236591..213d5a8f5 100644 --- a/vendor/safestringlib/CMakeLists.txt +++ b/vendor/safestringlib/CMakeLists.txt @@ -145,14 +145,14 @@ set_target_properties(${PROJECT_NAME}_objlib target_compile_definitions(${PROJECT_NAME}_objlib PRIVATE -DSTDC_HEADERS) -target_compile_options(${PROJECT_NAME}_objlib - PRIVATE -Wall -Wextra -Wsign-compare -Wformat-security) target_compile_options(${PROJECT_NAME}_objlib PRIVATE -Wno-unknown-pragmas -Wno-unused-parameter) if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 7) target_compile_options(${PROJECT_NAME}_objlib PRIVATE -Wno-implicit-fallthrough) endif() +target_compile_options(${PROJECT_NAME}_objlib + PRIVATE -Wall -Wextra -Wsign-compare -Wformat-security) target_compile_options(${PROJECT_NAME}_objlib PRIVATE -Wstack-protector -Winit-self) target_compile_options(${PROJECT_NAME}_objlib @@ -166,10 +166,7 @@ target_compile_options(${PROJECT_NAME}_objlib PRIVATE -fPIE -fPIC) if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 6) target_compile_options(${PROJECT_NAME}_objlib PRIVATE -mmitigate-rop) endif() -if(APPLE) -elseif(UNIX) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack -z relro -z now") -endif() +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack -z relro -z now") option(BUILD_ERROR_ON_WARNING "Fail compilation on warning" OFF) diff --git a/vendor/safestringlib/safeclib/mem_primitives_lib.c b/vendor/safestringlib/safeclib/mem_primitives_lib.c index cc189e5ea..54b596d02 100644 --- a/vendor/safestringlib/safeclib/mem_primitives_lib.c +++ b/vendor/safestringlib/safeclib/mem_primitives_lib.c @@ -31,6 +31,8 @@ #include "mem_primitives_lib.h" +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" /* * mem_primitives_lib.c provides unguarded memory routines * that are used by the safe_mem_library. These routines diff --git a/vendor/safestringlib/safeclib/safeclib_private.h b/vendor/safestringlib/safeclib/safeclib_private.h index 7280e879a..89ee97727 100644 --- a/vendor/safestringlib/safeclib/safeclib_private.h +++ b/vendor/safestringlib/safeclib/safeclib_private.h @@ -32,6 +32,7 @@ #ifndef __SAFECLIB_PRIVATE_H__ #define __SAFECLIB_PRIVATE_H__ +#include "citus_config.h" #ifdef __KERNEL__ /* linux kernel environment */ diff --git a/vendor/safestringlib/safeclib/snprintf_support.c b/vendor/safestringlib/safeclib/snprintf_support.c index 52a0739f8..8b482c1a4 100644 --- a/vendor/safestringlib/safeclib/snprintf_support.c +++ b/vendor/safestringlib/safeclib/snprintf_support.c @@ -54,6 +54,7 @@ #define CHK_FORMAT(X,Y) (((X)==(Y))?1:0) +#pragma GCC diagnostic ignored "-Wmissing-prototypes" unsigned int parse_format(const char *format, char pformatList[], unsigned int maxFormats)