Skip to content

Commit

Permalink
fixed uninitialized memory issues; updated makefile for more natural …
Browse files Browse the repository at this point in the history
…target names
  • Loading branch information
jpswinski committed Sep 29, 2022
1 parent 0380342 commit 82018f5
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/memory_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Build sliderule
run: |
make development-config
make config-development
make
sudo make install
chmod +x scripts/systests/memtest.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/self_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- name: Build sliderule
run: |
make development-config
make config-development
make
sudo make install
Expand Down
31 changes: 17 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ all: default-build
default-build: ## default build of sliderule
make -j4 -C $(BUILD)

config: release-config ## configure make for default build
config: config-release ## configure make for default build

release-config: prep ## configure make for release version of sliderule binary
config-release: prep ## configure make for release version of sliderule binary
cd $(BUILD); cmake -DCMAKE_BUILD_TYPE=Release $(ROOT)

debug-config: prep ## configure make for release version of sliderule binary
config-debug: prep ## configure make for release version of sliderule binary
cd $(BUILD); cmake -DCMAKE_BUILD_TYPE=Debug $(ROOT)

DEVCFG = -DUSE_AWS_PACKAGE=ON
Expand All @@ -34,10 +34,10 @@ DEVCFG += -DUSE_LEGACY_PACKAGE=ON
DEVCFG += -DUSE_NETSVC_PACKAGE=ON
DEVCFG += -DUSE_PISTACHE_PACKAGE=ON

development-config: prep ## configure make for development version of sliderule binary
config-development: prep ## configure make for development version of sliderule binary
cd $(BUILD); cmake -DCMAKE_BUILD_TYPE=Release $(DEVCFG) $(ROOT)

development-config-debug: prep ## configure make for debug version of sliderule binary
config-development-debug: prep ## configure make for debug version of sliderule binary
cd $(BUILD); cmake -DCMAKE_BUILD_TYPE=Debug $(DEVCFG) -DENABLE_TRACING=ON $(ROOT)

install: ## install sliderule to system
Expand All @@ -62,46 +62,49 @@ PYTHONCFG += -DH5CORO_MAXIMUM_NAME_SIZE=192
PYTHONCFG += -DICESAT2_PLUGIN_LIBPATH=/usr/local/etc/sliderule/icesat2.so
PYTHONCFG += -DICESAT2_PLUGIN_INCPATH=/usr/local/include/sliderule

python-config: prep ## configure make for python bindings
config-python: prep ## configure make for python bindings
cd $(BUILD); cmake -DCMAKE_BUILD_TYPE=Release $(PYTHONCFG) $(ROOT)

########################
# Shared Library Targets
########################

library-config: prep ## configure make for shared library libsliderule.so
config-library: prep ## configure make for shared library libsliderule.so
cd $(BUILD); cmake -DCMAKE_BUILD_TYPE=Release -DSHARED_LIBRARY=ON $(ROOT)

########################
# Atlas Plugin Targets
########################

atlas-config: prep ## configure make for atlas plugin
config-atlas: prep ## configure make for atlas plugin
cd $(ATLAS_BUILD); cmake -DCMAKE_BUILD_TYPE=Release $(ROOT)/plugins/atlas

atlas: ## build atlas plugin
make -j4 -C $(ATLAS_BUILD)

atlas-install: ## install altas plugin to system
install-atlas: ## install altas plugin to system
make -C $(ATLAS_BUILD) install

atlas-uninstall: ## uninstall most recent install of atlas plugin from system
uninstall-atlas: ## uninstall most recent install of atlas plugin from system
xargs rm < $(ATLAS_BUILD)/install_manifest.txt

########################
# Icesat2 Plugin Targets
########################

icesat2-config: prep ## configure make for icesat2 plugin
config-icesat2: prep ## configure make for icesat2 plugin
cd $(ICESAT2_BUILD); cmake -DCMAKE_BUILD_TYPE=Release $(ROOT)/plugins/icesat2

config-debug-icesat2: prep ## configure make for icesat2 plugin
cd $(ICESAT2_BUILD); cmake -DCMAKE_BUILD_TYPE=Debug $(ROOT)/plugins/icesat2

icesat2: ## build icesat2 plugin
make -j4 -C $(ICESAT2_BUILD)

icesat2-install: ## install icesat2 plugin to system
install-icesat2: ## install icesat2 plugin to system
make -C $(ICESAT2_BUILD) install

icesat2-uninstall: ## uninstall most recent install of icesat2 plugin from system
uninstall-icesat2: ## uninstall most recent install of icesat2 plugin from system
xargs rm < $(ICESAT2_BUILD)/install_manifest.txt

########################
Expand All @@ -116,7 +119,7 @@ asan: prep ## build address sanitizer debug version of sliderule binary
cd $(BUILD); export CC=clang; export CXX=clang++; cmake $(CLANG_OPT) $(DEVCFG) -DCMAKE_BUILD_TYPE=Debug -DENABLE_ADDRESS_SANITIZER=ON $(ROOT)
cd $(BUILD); make

ctags: development-config ## generate ctags
ctags: config-development ## generate ctags
cd $(BUILD); cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON $(ROOT)
mv -f $(BUILD)/compile_commands.json $(ROOT)/compile_commands.json

Expand Down
20 changes: 13 additions & 7 deletions packages/aws/S3CurlIODriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,8 @@ static headers_t buildHeaders (const char* bucket, const char* key, CredentialSt
/*----------------------------------------------------------------------------
* initializeRequest
*----------------------------------------------------------------------------*/
static CURL* initializeRequest (const char* bucket, const char* key, const char* region, headers_t headers, write_cb_t write_cb, void* write_parm)
static CURL* initializeRequest (SafeString& url, headers_t headers, write_cb_t write_cb, void* write_parm)
{
/* Build URL String */
SafeString url("https://s3.%s.amazonaws.com/%s/%s", region, bucket, key);

/* Initialize cURL */
CURL* curl = curl_easy_init();
if(curl)
Expand Down Expand Up @@ -413,8 +410,11 @@ int64_t S3CurlIODriver::get (uint8_t* data, int64_t size, uint64_t pos, const ch
.index = 0
};

/* Build URL */
SafeString url("https://s3.%s.amazonaws.com/%s/%s", region, bucket, key);

/* Initialize cURL Request */
CURL* curl = initializeRequest(bucket, key_ptr, region, headers, curlWriteFixed, &info);
CURL* curl = initializeRequest(url, headers, curlWriteFixed, &info);
if(curl)
{
/* Perform Request */
Expand Down Expand Up @@ -475,8 +475,11 @@ int64_t S3CurlIODriver::get (uint8_t** data, const char* bucket, const char* key
/* Setup Streaming Data for Callback */
List<streaming_data_t> rsps_set;

/* Build URL */
SafeString url("https://s3.%s.amazonaws.com/%s/%s", region, bucket, key);

/* Initialize cURL Request */
CURL* curl = initializeRequest(bucket, key_ptr, region, headers, curlWriteStreaming, &rsps_set);
CURL* curl = initializeRequest(url, headers, curlWriteStreaming, &rsps_set);
if(curl)
{
/* Perform Request */
Expand Down Expand Up @@ -562,8 +565,11 @@ int64_t S3CurlIODriver::get (const char* filename, const char* bucket, const cha
data.fd = fopen(filename, "w");
if(data.fd)
{
/* Build URL */
SafeString url("https://s3.%s.amazonaws.com/%s/%s", region, bucket, key);

/* Initialize cURL Request */
CURL* curl = initializeRequest(bucket, key_ptr, region, headers, curlWriteFile, &data);
CURL* curl = initializeRequest(url, headers, curlWriteFile, &data);
if(curl)
{
/* Perform Request */
Expand Down
3 changes: 2 additions & 1 deletion plugins/icesat2/plugin/CumulusIODriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ CumulusIODriver::CumulusIODriver (const Asset* _asset, const char* resource):
const int NUM_ELEMENTS = 5;
char elements[NUM_ELEMENTS][MAX_STR_SIZE];

StringLib::tokenizeLine(resource, MAX_STR_SIZE, '_', NUM_ELEMENTS, elements);
int num_toks = StringLib::tokenizeLine(resource, MAX_STR_SIZE, '_', NUM_ELEMENTS, elements);
if(num_toks < 5) throw RunTimeException(CRITICAL, RTE_ERROR, "Invalid cumulus resource: %s", resource);

const char* product = elements[0];
const char* version = elements[3];
Expand Down
2 changes: 1 addition & 1 deletion targets/binding-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $ conda install zlib openssl
The Python bindings must be built for each target they are used on, and the resulting .so file must either be accessible from the **PYTHONPATH** or be installed into the current Python environment or copied to the same directory as the Python script that is importing it is run from.

To build the bindings:
1. `make python-config`
1. `make config-python`
2. `make`

The results are found in the `build` directory:
Expand Down

0 comments on commit 82018f5

Please sign in to comment.