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

Fix the issue2187 #2216

Closed
wants to merge 1 commit into from
Closed

Fix the issue2187 #2216

wants to merge 1 commit into from

Conversation

xauthulei
Copy link
Contributor

@xauthulei xauthulei commented Dec 8, 2020

I am try to address the issue 2187, @bmpotter , Could you review this, thanks

Signed-off-by: leileihu <leileihu@cn.ibm.com>
@@ -511,7 +511,7 @@ all_main() {

cloudLogin

if [[ -n $DIR ]]; then pushd; fi # if they want the files somewhere else, make that our current dir
if [[ -n $DIR && -d $DIR ]]; then pushd $DIR; fi # if they want the files somewhere else, make that our current dir
Copy link
Member

Choose a reason for hiding this comment

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

This isn't quite right. The effect of && -d $DIR is that if the user specified -f <dir> flag (which sets DIR) but the <dir> specified didn't exist or was a file, it would silently not use it (confusing the user).

You have 2 choices:

  1. Just remove && -d $DIR from all of the lines you added it to. This will cause pushd to display an error msg if the directory is not valid.
  2. Or do number 1 and add a check in checkPrereqsAndInput that the directory specified is valid, and display an error msg and return exit code 1 if not.

The fact that you didn't catch this problem makes me think you didn't test your code thoroughly enough before submitting the PR. Please test both the good path and the error cases. Thx.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, it should be reasonable. Thanks.

@xauthulei xauthulei mentioned this pull request Jan 11, 2021
@xauthulei
Copy link
Contributor Author

@bmpotter , Because my local repo is deleted unintentionally, I can't commit my changes in this PR. I created a new PR #2234. Sorry for this inconvenience。

@xauthulei xauthulei closed this Jan 11, 2021
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.

None yet

2 participants