{"action":"created","issue":{"url":"https://api.github.com/repos/Unidata/netcdf-c/issues/1154","repository_url":"https://api.github.com/repos/Unidata/netcdf-c","labels_url":"https://api.github.com/repos/Unidata/netcdf-c/issues/1154/labels{/name}","comments_url":"https://api.github.com/repos/Unidata/netcdf-c/issues/1154/comments","events_url":"https://api.github.com/repos/Unidata/netcdf-c/issues/1154/events","html_url":"https://github.com/Unidata/netcdf-c/issues/1154","id":364520536,"node_id":"MDU6SXNzdWUzNjQ1MjA1MzY=","number":1154,"title":"in-memory write quit working at commit d62a9e623","user":{"login":"gsjaardema","id":897294,"node_id":"MDQ6VXNlcjg5NzI5NA==","avatar_url":"https://avatars0.githubusercontent.com/u/897294?v=4","gravatar_id":"","url":"https://api.github.com/users/gsjaardema","html_url":"https://github.com/gsjaardema","followers_url":"https://api.github.com/users/gsjaardema/followers","following_url":"https://api.github.com/users/gsjaardema/following{/other_user}","gists_url":"https://api.github.com/users/gsjaardema/gists{/gist_id}","starred_url":"https://api.github.com/users/gsjaardema/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsjaardema/subscriptions","organizations_url":"https://api.github.com/users/gsjaardema/orgs","repos_url":"https://api.github.com/users/gsjaardema/repos","events_url":"https://api.github.com/users/gsjaardema/events{/privacy}","received_events_url":"https://api.github.com/users/gsjaardema/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"DennisHeimbigner","id":905179,"node_id":"MDQ6VXNlcjkwNTE3OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/905179?v=4","gravatar_id":"","url":"https://api.github.com/users/DennisHeimbigner","html_url":"https://github.com/DennisHeimbigner","followers_url":"https://api.github.com/users/DennisHeimbigner/followers","following_url":"https://api.github.com/users/DennisHeimbigner/following{/other_user}","gists_url":"https://api.github.com/users/DennisHeimbigner/gists{/gist_id}","starred_url":"https://api.github.com/users/DennisHeimbigner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DennisHeimbigner/subscriptions","organizations_url":"https://api.github.com/users/DennisHeimbigner/orgs","repos_url":"https://api.github.com/users/DennisHeimbigner/repos","events_url":"https://api.github.com/users/DennisHeimbigner/events{/privacy}","received_events_url":"https://api.github.com/users/DennisHeimbigner/received_events","type":"User","site_admin":false},"assignees":[{"login":"DennisHeimbigner","id":905179,"node_id":"MDQ6VXNlcjkwNTE3OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/905179?v=4","gravatar_id":"","url":"https://api.github.com/users/DennisHeimbigner","html_url":"https://github.com/DennisHeimbigner","followers_url":"https://api.github.com/users/DennisHeimbigner/followers","following_url":"https://api.github.com/users/DennisHeimbigner/following{/other_user}","gists_url":"https://api.github.com/users/DennisHeimbigner/gists{/gist_id}","starred_url":"https://api.github.com/users/DennisHeimbigner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DennisHeimbigner/subscriptions","organizations_url":"https://api.github.com/users/DennisHeimbigner/orgs","repos_url":"https://api.github.com/users/DennisHeimbigner/repos","events_url":"https://api.github.com/users/DennisHeimbigner/events{/privacy}","received_events_url":"https://api.github.com/users/DennisHeimbigner/received_events","type":"User","site_admin":false},{"login":"WardF","id":4324946,"node_id":"MDQ6VXNlcjQzMjQ5NDY=","avatar_url":"https://avatars3.githubusercontent.com/u/4324946?v=4","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":{"url":"https://api.github.com/repos/Unidata/netcdf-c/milestones/11","html_url":"https://github.com/Unidata/netcdf-c/milestone/11","labels_url":"https://api.github.com/repos/Unidata/netcdf-c/milestones/11/labels","id":3065045,"node_id":"MDk6TWlsZXN0b25lMzA2NTA0NQ==","number":11,"title":"4.6.2","description":"NetCDF-C 4.7.0 Release\r\n","creator":{"login":"WardF","id":4324946,"node_id":"MDQ6VXNlcjQzMjQ5NDY=","avatar_url":"https://avatars3.githubusercontent.com/u/4324946?v=4","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},"open_issues":21,"closed_issues":90,"state":"open","created_at":"2018-01-25T23:03:12Z","updated_at":"2018-10-04T22:26:30Z","due_on":null,"closed_at":null},"comments":15,"created_at":"2018-09-27T15:02:47Z","updated_at":"2018-10-09T19:50:35Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"> Please provide as much of the following information as you can, as applicable to the issue being reported.  Naturally, not all information is relevant to every issue, but the more information we have to start, the better!\r\n\r\n### Environment Information\r\n\r\n> Feel free to skip this if the issue is related to documentation, a feature request, or general discussion.\r\n\r\n* What platform are you using? (please provide specific distribution/version in summary)\r\n  * [ x] Linux\r\n  * [ ] Windows\r\n  * [ x] OSX\r\n  * [ ] Other\r\n  * [ ] NA\r\n* 32 and/or 64 bit?\r\n  * [ ] 32-bit\r\n  * [ x] 64-bit\r\n* What build system are you using?\r\n  * [ x] autotools (`configure`)\r\n  * [ x] cmake\r\n* Can you provide a sample netCDF file or `C` code to recreate the issue?\r\n  * [ ] Yes (please attach to this issue, thank you!)\r\n  * [ ] No\r\n  * [ x] Not at this time\r\n\r\n### Summary of Issue\r\nThe in-memory write capability of NetCDF that my application was using broke at commit d62a9e623c7025f168d515cc9a3dd79d4a13dde7 which is \" Fix the NC_INMEMORY code to work in all cases with HDF5 1.10.\"\r\n\r\nI think that the problem occurs down in \r\n```\r\nstatic int\r\nmemio_pad_length(ncio* nciop, off_t length)\r\n{\r\n    NCMEMIO* memio;\r\n    size_t len = (size_t)length;\r\n    if(nciop == NULL || nciop->pvt == NULL) return NC_EINVAL;\r\n    memio = (NCMEMIO*)nciop->pvt;\r\n\r\n    if(!memio->persist)\r\n        return EPERM; /* attempt to write readonly file*/\r\n    if(memio->locked)\r\n\treturn NC_EDISKLESS;\r\n```\r\nThe original file is created via a call to `nc_create()`.  It looks like `memio->persist` is not set, so the file is being treated as readonly.  This is due to the code:\r\n```\r\n    if(fIsSet(ioflags,NC_WRITE) && !fIsSet(ioflags,NC_NOCLOBBER) && memio->diskless)\r\n\tmemio->persist = 1;\r\n```\r\nin `memio_new`.   Basically, `NC_WRITE` is not set.   \r\n\r\nIf I modify my code such that I call `nc_create` with the mode `NC_WRITE`, then the code seems to work correctly again.  \r\n\r\nIt looks like the code now requires that `nc_create` be called with the mode `NC_WRITE` if the in-memory capability is to be used.  I am fine modifying my code to add `NC_WRITE` to the mode when calling `nc_create()`, but I don't think that this is documented or should be required (Unless there is a reason I don't see for creating a file as readonly...)\r\n\r\n\r\n### Steps to reproduce the behavior\r\n"},"comment":{"url":"https://api.github.com/repos/Unidata/netcdf-c/issues/comments/428327236","html_url":"https://github.com/Unidata/netcdf-c/issues/1154#issuecomment-428327236","issue_url":"https://api.github.com/repos/Unidata/netcdf-c/issues/1154","id":428327236,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODMyNzIzNg==","user":{"login":"WardF","id":4324946,"node_id":"MDQ6VXNlcjQzMjQ5NDY=","avatar_url":"https://avatars3.githubusercontent.com/u/4324946?v=4","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":"2018-10-09T19:50:35Z","updated_at":"2018-10-09T19:50:35Z","author_association":"MEMBER","body":"@DennisHeimbigner Which branches are we waiting on? I can prioritize those."}}
{"actor":{"display_login":"WardF"}}