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

Falsely alerting missing write permissions cmor.c#L1683 #515

Closed
sol1105 opened this issue Jul 15, 2019 · 2 comments · Fixed by #516
Closed

Falsely alerting missing write permissions cmor.c#L1683 #515

sol1105 opened this issue Jul 15, 2019 · 2 comments · Fixed by #516
Assignees
Labels
Milestone

Comments

@sol1105
Copy link

sol1105 commented Jul 15, 2019

Hello,

cmor/Src/cmor.c

Line 1683 in 7aee13f

strncat(msg, "/tmp.cmor.test", CMOR_MAX_STRING);

in cmor.c line 1683 a test for write permissions is being performed by creating a temporary file in the outpath. However this filename is not unique.

We are using CMOR in parallel for several variables.
Sometimes it occures that CMOR wants to create this test-file for more than one process at the same time and exists, falsely raising this missing write permissions error.

I suggest to add the process_id to the filename of this temporary file or to make it unique in any other possible way to prevent that from happening.
Kind regards,
Martin

@doutriaux1 doutriaux1 added the bug label Jul 15, 2019
@doutriaux1 doutriaux1 added this to the 3.5.0 milestone Jul 15, 2019
@doutriaux1
Copy link
Collaborator

Thanks @sol1105 nice suggestion.

@wachsylon
Copy link
Collaborator

Unfortunately, we have still problems due to lines after the debugged lines.

cmor/Src/cmor.c

Line 1709 in 7aee13f

ierr = mkdir(cmor_current_dataset.outpath, S_IRWXU | S_IRGRP | S_IXGRP |

        ierr = mkdir(cmor_current_dataset.outpath, S_IRWXU | S_IRGRP | S_IXGRP |
                     S_IROTH | S_IXOTH);
        if (ierr != 0) {
            sprintf(msg,
                    "CMOR was unable to create this directory %s\n! "
                    "You do not have write permissions!",
                    cmor_current_dataset.outpath);

If you run CMOR parallel for the same CMOR variable, e.g. for different times, two processes try to create the same directory and one will give an error. Of course, the user could create the root directory for the output which is not a big deal. However, it might be no reason for CMOR to exit. Maybe a test for errno EEXIST of mkdir
if (ierr != 0 && ierr != EEXIST ) {
will solve it.

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

Successfully merging a pull request may close this issue.

4 participants