{"action":"created","issue":{"url":"https://api.github.com/repos/Unidata/netcdf-c/issues/131","labels_url":"https://api.github.com/repos/Unidata/netcdf-c/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/Unidata/netcdf-c/issues/131/comments","events_url":"https://api.github.com/repos/Unidata/netcdf-c/issues/131/events","html_url":"https://github.com/Unidata/netcdf-c/issues/131","id":110105977,"number":131,"title":"nc_set_fill doesn't work?","user":{"login":"jswhit","id":579593,"avatar_url":"https://avatars.githubusercontent.com/u/579593?v=3","gravatar_id":"","url":"https://api.github.com/users/jswhit","html_url":"https://github.com/jswhit","followers_url":"https://api.github.com/users/jswhit/followers","following_url":"https://api.github.com/users/jswhit/following{/other_user}","gists_url":"https://api.github.com/users/jswhit/gists{/gist_id}","starred_url":"https://api.github.com/users/jswhit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jswhit/subscriptions","organizations_url":"https://api.github.com/users/jswhit/orgs","repos_url":"https://api.github.com/users/jswhit/repos","events_url":"https://api.github.com/users/jswhit/events{/privacy}","received_events_url":"https://api.github.com/users/jswhit/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Unidata/netcdf-c/labels/area/general","name":"area/general","color":"fad8c7"},{"url":"https://api.github.com/repos/Unidata/netcdf-c/labels/status/reviewing","name":"status/reviewing","color":"bfdadc"}],"state":"open","locked":false,"assignee":{"login":"WardF","id":4324946,"avatar_url":"https://avatars.githubusercontent.com/u/4324946?v=3","gravatar_id":"","url":"https://api.github.com/users/WardF","html_url":"https://github.com/WardF","followers_url":"https://api.github.com/users/WardF/followers","following_url":"https://api.github.com/users/WardF/following{/other_user}","gists_url":"https://api.github.com/users/WardF/gists{/gist_id}","starred_url":"https://api.github.com/users/WardF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WardF/subscriptions","organizations_url":"https://api.github.com/users/WardF/orgs","repos_url":"https://api.github.com/users/WardF/repos","events_url":"https://api.github.com/users/WardF/events{/privacy}","received_events_url":"https://api.github.com/users/WardF/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-10-06T21:33:36Z","updated_at":"2015-10-06T22:08:53Z","closed_at":null,"body":"Turning off variable pre-filling doesn't seem to work.  Here's an example:\r\n\r\n    #include <stdlib.h>\r\n    #include <stdio.h>\r\n    #include <netcdf.h>\r\n    static int total_err = 0, err = 0;\r\n    #define NDIMS 1\r\n    #define FILE_NAME \"test.nc\"\r\n    #define DIM_LEN 2\r\n    #define VAR_NAME \"var\"\r\n    #define DIM_NAME \"dim\"\r\n    /* This macro prints an error message with line number */\r\n    #define ERR do { \\\r\n            fflush(stdout); /* Make sure our stdout is synced with stderr. */ \\\r\n            err++; \\\r\n            fprintf(stderr, \"Sorry! Unexpected result, %s, line: %d\\n\", \\\r\n                                __FILE__, __LINE__);                                \\\r\n            return 2;                                                   \\\r\n    } while (0)\r\n\r\n    int main()\r\n    {\r\n      int dimids[NDIMS];\r\n      int varid, ncid;\r\n      int no_fill, old_fill_mode;\r\n\r\n      /* Create a file and set the fill mode */\r\n      if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;\r\n      if (nc_set_fill(ncid, NC_NOFILL, &old_fill_mode)) ERR;\r\n      if (nc_def_dim(ncid, DIM_NAME, DIM_LEN, &dimids[0])) ERR;\r\n      if (nc_def_var(ncid, VAR_NAME, NC_USHORT, NDIMS, dimids,\r\n            &varid)) ERR;\r\n      /* if (nc_def_var_fill(ncid, varid, 1, NULL)) ERR; */\r\n      if (nc_close(ncid)) ERR;\r\n\r\n      /* Open the file and check the fill mode */\r\n      if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;\r\n      if (nc_inq_var_fill(ncid, varid, &no_fill, NULL)) ERR;\r\n      if (!no_fill) ERR;\r\n      if (nc_close(ncid)) ERR;\r\n    };\r\n\r\nRunning this program produces:\r\n\r\n    Sorry! Unexpected result, test_fill.c, line: 40\r\n\r\nIf I comment out the ``nc_set_fill`` call and uncomment the ``nc_def_var_fill`` call, it works."},"comment":{"url":"https://api.github.com/repos/Unidata/netcdf-c/issues/comments/146016707","html_url":"https://github.com/Unidata/netcdf-c/issues/131#issuecomment-146016707","issue_url":"https://api.github.com/repos/Unidata/netcdf-c/issues/131","id":146016707,"user":{"login":"WardF","id":4324946,"avatar_url":"https://avatars.githubusercontent.com/u/4324946?v=3","gravatar_id":"","url":"https://api.github.com/users/WardF","html_url":"https://github.com/WardF","followers_url":"https://api.github.com/users/WardF/followers","following_url":"https://api.github.com/users/WardF/following{/other_user}","gists_url":"https://api.github.com/users/WardF/gists{/gist_id}","starred_url":"https://api.github.com/users/WardF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WardF/subscriptions","organizations_url":"https://api.github.com/users/WardF/orgs","repos_url":"https://api.github.com/users/WardF/repos","events_url":"https://api.github.com/users/WardF/events{/privacy}","received_events_url":"https://api.github.com/users/WardF/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T22:08:53Z","updated_at":"2015-10-06T22:08:53Z","body":"This does appear to be a bug; the file is written out properly at least.  I'll continue to debug this and see what I can sort out; I'll also try to figure out when this bug was introduced.  More updates as the issue warrants."}}