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

nc_open fails in Windows with network drives #2060

Closed
abhibaruah opened this issue Aug 9, 2021 · 6 comments · Fixed by #2065
Closed

nc_open fails in Windows with network drives #2060

abhibaruah opened this issue Aug 9, 2021 · 6 comments · Fixed by #2065

Comments

@abhibaruah
Copy link

netcdf version: 4.8.0
hdf5 version: 1.8.12
OS: windows 10
Compiler: VS2019 u7.7

This was caught while running some of our tests on netcdf files hosted in a network drive.
nc_open fails when the file is accessed using the network path. However, if I map the network drive, and then try to access the same file, it works fine.

I could not reproduce the issue with netcdf v4.7.4 + hdf5 1.8.12.

As shown in the repro code below, v4.8.0 errors if the file is accessed by the network path
string FILE_NAME = "\\\\mathworks\\devel\\sandbox\\abaruah\\Features\\NetCDF_New_Features\\temp\\monotonic.nc";

The output of the program below is
Open status: 2
NCID: -858993460
status after close = -33

But if I map the network drive and then try to access the file, it works
string FILE_NAME = "Y:\\abaruah\\Features\\NetCDF_New_Features\\temp\\monotonic.nc";

Open status: 0
NCID: 65536
status after close = 0

#include <stdio.h>
#include <string>
#include <netcdf.h>
#include <iostream>
#include <vector>

using namespace std;

int
main()
{
    int status;
    int ncid;
    string FILE_NAME = "\\\\mathworks\\devel\\sandbox\\abaruah\\Features\\NetCDF_New_Features\\temp\\monotonic.nc";
    //string FILE_NAME = "Y:\\abaruah\\Features\\NetCDF_New_Features\\temp\\monotonic.nc";

    status = nc_open(FILE_NAME.c_str(), NC_NOWRITE, &ncid);
    std::cout << "Open status: " << status << std::endl;
    std::cout << "NCID: " << ncid << std::endl;
    status = nc_close(ncid);
    printf("status after close = %d\n", status);


    return 0;
}
@DennisHeimbigner
Copy link
Collaborator

Frankly, I completely forgot about network drives. I suspect I assumed they
would all be mounted under a drive letter. Which probably serve as a work-around.

@abhibaruah
Copy link
Author

Correct. Mounting the network drive as a drive letter works as a workaround.
But since unmounted network drives worked in previous versions of netcdf, we are concerned if this would break existing customer workflows once we upgrade to v4.8.0.

@DennisHeimbigner
Copy link
Collaborator

I will add a fix for this case.

@DennisHeimbigner
Copy link
Collaborator

I tried to fix this here: #2065

But since I do not have access to network drive, I cannot test it.
When it gets integrated, please let me know if it works.

@DennisHeimbigner
Copy link
Collaborator

This has been integrated into the gihub master. Please test it if you can.

@abhibaruah
Copy link
Author

Thanks a lot. I tried this out. The bug is resolved.

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

Successfully merging a pull request may close this issue.

2 participants