Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use env variable USERPROFILE instead of HOME for windows and mingw. #2405

Merged
merged 3 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ IF(Bz2_FOUND)
set_std_filter(Bz2)
ELSE()
# The reason we use a local version is to support a more comples test case
MESSAGE(WARNING "libbz2 not found using built-in version")
MESSAGE("libbz2 not found using built-in version")
SET(HAVE_LOCAL_BZ2 ON)
SET(HAVE_BZ2 ON)
set(STD_FILTERS "${STD_FILTERS} bz2")
Expand Down
9 changes: 7 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ Release Notes {#RELEASE_NOTES}

This file contains a high-level description of this package's evolution. Releases are in reverse chronological order (most recent first). Note that, as of netcdf 4.2, the `netcdf-c++` and `netcdf-fortran` libraries have been separated into their own libraries.

## 4.9.0 - June 10, 2022
## 4.9.1 - T.B.D.


* [Bug Fix] Use env variable USERPROFILE instead of HOME for windows and mingw. See [Github #2405](https://github.com/Unidata/netcdf-c/pull/2405).
* [Bug Fix] Fix the nc_def_var_fletcher32 code in hdf5 to properly test value of the fletcher32 argument. See [Github #2403](https://github.com/Unidata/netcdf-c/pull/2403).

## 4.9.0 - June 10, 2022

* [Enhancement] Improve filter installation process to avoid use of an extra shell script. See [Github #2348](https://github.com/Unidata/netcdf-c/pull/2348).
* [Bug Fix] Get "make distcheck" to work See [Github #/2343](https://github.com/Unidata/netcdf-c/pull/2343).
* [Bug Fix] Get "make distcheck" to work See [Github #2343](https://github.com/Unidata/netcdf-c/pull/2343).
* [Enhancement] Allow the read/write of JSON-valued Zarr attributes to allow
for domain specific info such as used by GDAL/Zarr. See [Github #2278](https://github.com/Unidata/netcdf-c/pull/2278).
* [Enhancement] Turn on the XArray convention for NCZarr files by default. WARNING, this means that the mode should explicitly specify nczarr" or "zarr" even if "xarray" or "noxarray" is specified. See [Github #2257](https://github.com/Unidata/netcdf-c/pull/2257).
Expand Down
24 changes: 18 additions & 6 deletions libdispatch/ddispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ See LICENSE.txt for license information.
#include "ncs3sdk.h"
#endif

#define MAXPATH 1024



/* Define vectors of zeros and ones for use with various nc_get_varX functions */
/* Note, this form of initialization fails under Cygwin */
size_t NC_coord_zero[NC_MAX_VAR_DIMS] = {0};
Expand Down Expand Up @@ -76,15 +80,23 @@ NCDISPATCH_initialize(void)

/* Capture $HOME */
{
#if defined(_WIN32) && !defined(__MINGW32__)
char* home = getenv("HOME");

#else
char* home = getenv("USERPROFILE");
#endif
if(home == NULL) {
/* use tempdir */
home = globalstate->tempdir;
}
globalstate->home = strdup(home);
/* use cwd */
home = malloc(MAXPATH+1);
NCgetcwd(home,MAXPATH);
} else
home = strdup(home); /* make it always free'able */
assert(home != NULL);
NCpathcanonical(home,&globalstate->home);
nullfree(home);
}

fprintf(stderr,">>> HOME=|%s|\n",globalstate->home); fflush(stderr);

/* Capture $CWD */
{
char cwdbuf[4096];
Expand Down
6 changes: 5 additions & 1 deletion ncdap_test/t_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ fflush(stderr);
#ifndef NOHOME
{
/* Test 1: RC in HOME */
home = getenv("HOME");
#if defined(_WIN32) && !defined(__MINGW32__)
home = getenv("HOME");
#else
home = getenv("USERPROFILE");
#endif
fprintf(stderr,"user:pwd in %s/%s\n",home,RC);
if(!testrc(home,url2)) {
fprintf(stderr,"user:pwd in %s/%s failed\n",home,RC);
Expand Down
8 changes: 8 additions & 0 deletions test_common.in
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ ncgenc04="${top_srcdir}/ncgen/c0_4.cdl"
# Set LC_ALL
if test "x$FP_ISMSVC" = xyes || test "x$FP_ISCYGWIN" = xyes; then export LC_ALL="en_US.utf8"; fi

# Set HOME
if test "x$FP_ISMSVC" = xyes || test "x$FP_MINGW" = xyes; then
if test "x$HOME" = x ; then
HOME=`echo $USERPROFILE |tr '\\\' '/'`
export HOME
fi
fi

# Test for filter availability
avail() {
if test yes = `${execdir}/../ncdump/ncfilteravail $1` ; then return 0 ; else echo "filter $1 not available" ; return 1; fi
Expand Down