Skip to content
New issue

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

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

Already on GitHub? # to your account

nc_open_mem fails #394

Closed
DennisHeimbigner opened this issue Apr 7, 2017 · 5 comments · Fixed by #400
Closed

nc_open_mem fails #394

DennisHeimbigner opened this issue Apr 7, 2017 · 5 comments · Fixed by #400

Comments

@DennisHeimbigner
Copy link
Collaborator

re esupport: YID-571993

Full Name: Michael Uleysky
Email Address: uleysky@poi.dvo.ru
Organization: POI FEB RAS
Package Version: 4.4.1.1
Operating System: Linux
Hardware:
Description of problem: nc_open_mem() returns the error "No such file or directory". Strace shows what netcdf try to open(2) the first argument of nc_open_mem call. I am attaching a very simple c program that reproduce this bug. The file ref_nctest_classic.nc is taken from the distribution directory (nctest/ref_nctest_classic.nc).

Full Name: Michael Uleysky
Email Address: uleysky@poi.dvo.ru
Organization: POI FEB RAS
Package Version: 4.4.1.1
Operating System: Linux
Hardware:
Description of problem: nc_open_mem() returns the error "No such file or directory". Strace shows what netcdf try to open(2) the first argument of nc_open_mem call. I am attaching a very simple c program that reproduce this bug. The file ref_nctest_classic.nc is taken from the distribution directory (nctest/ref_nctest_classic.nc).

======= testnc.c============
#include <netcdf.h>
#include <netcdf_mem.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mman.h>

int main()
{
int fd;
struct stat st;
int ret;
void* data;
int ncid;

fd=open("ref_nctest_classic.nc",O_RDONLY);
if(fd==-1) return 1;
ret=fstat(fd,&st);
if(ret!=0) return 1;
data=mmap(0,st.st_size,PROT_READ,MAP_SHARED,fd,0);
if(data==0) return 1;

ret=nc_open_mem("test",0,st.st_size,data,&ncid);
if(ret!=NC_NOERR) {printf("%s\n",nc_strerror(ret)); return 1;}
return 0;
}

@thehesiod
Copy link
Contributor

any work-arounds found?

@dopplershift
Copy link
Member

attn: @WardF Having this work would be a great win on our end.

@thehesiod
Copy link
Contributor

btw I fixed this in #400

@WardF
Copy link
Member

WardF commented Apr 28, 2017

I am headed back from EGU in the am. I have no internet at the hotel, effectively, so will take care if this this weekend if not sooner.

@dopplershift
Copy link
Member

Well don't do that on our account--I'll be happy so long as it makes 4.4.2.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants