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

Improve FileSystem.listdir() error message #12846

Conversation

ben-albrecht
Copy link
Member

Add argument name to listdir() error message.

Before this PR:

error in listdir(): No such file or directory

After this PR:

error in listdir() with argument './DOES-NOT-EXIST': No such file or directory

errorMsg = "error in listdir() with argument '%s'".format(path);
} catch e {
// Generic error message in case format fails
perror("Error in listdir(): ");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems unlikely that C's errno would still be set properly by the time we've run through format + try/catch code paths in Chapel. Isn't it only valid immediately after the operation that set it? Seems like once we start introducing more complex code here, we should grab errno immediately and then process it within Chapel directly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I chatted with @lydia-duncan, and believe the right solution involves wrapping opendir() with chpl_fs_opendir() that returns a syserr, like we do with other FS calls in runtime/src/chpl-file-utils.c.

@ben-albrecht
Copy link
Member Author

Not sure when I'll have a chance to revisit this, so I'm closing for now.

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

Successfully merging this pull request may close these issues.

2 participants