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

maybe should check the result of filepath.Glob() and return an error #265

Merged
merged 6 commits into from
May 17, 2023

Conversation

LooJee
Copy link
Contributor

@LooJee LooJee commented Mar 8, 2023

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

Description:

filepath.Glob() won't return an error while files don't exist, maybe here should have an error. Because the expandFiles() will return an empty []*File, and the error is nil. Then the yaml.Files at cmd/runner.go/Run() will be an empty slice, then the statsMgr never receive a done signal.

How do you solve it?

Special notes for your reviewer, ex. impact of this fix, design document, etc:

@LooJee LooJee changed the title Fix jie configfile check maybe should check the result of filepath.Glob() and return an error Mar 8, 2023
@LooJee
Copy link
Contributor Author

LooJee commented Mar 8, 2023

I've seen the refactor pr, maybe I should close mine?

Comment on lines 409 to 412
if len(fileNames) == 0 && err == nil {
err = fmt.Errorf("file: %s doesn't exist", *f.Path)
}
if err != nil {
Copy link
Contributor

@veezhang veezhang May 11, 2023

Choose a reason for hiding this comment

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

How about?

if err != nil {
	return err
}
if len(fileNames) == 0 {
	return &os.PathError{Op: "open", Path: *f.Path, Err: fs.ErrNotExist}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it will be much better, I will resolve it promptly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@veezhang I have improved it, please check it again.

Copy link
Contributor

Choose a reason for hiding this comment

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

@LooJee Good job!
Sorry, I find the ci is use go1.13, so maybe you should use os.ErrNotExist instead of fs.ErrNotExist.

Copy link
Contributor

@veezhang veezhang left a comment

Choose a reason for hiding this comment

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

LGTM

@veezhang veezhang merged commit 4eeb7d0 into vesoft-inc:master May 17, 2023
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 this pull request may close these issues.

2 participants