Skip to content

fix(workspace): ignore unreadable directories when listing Dockerfiles#1764

Merged
mergify[bot] merged 2 commits intoaws:mainlinefrom
bvtujo:ignore-unreadable-directories
Dec 18, 2020
Merged

fix(workspace): ignore unreadable directories when listing Dockerfiles#1764
mergify[bot] merged 2 commits intoaws:mainlinefrom
bvtujo:ignore-unreadable-directories

Conversation

@bvtujo
Copy link
Copy Markdown
Contributor

@bvtujo bvtujo commented Dec 18, 2020

This is a quick change to skip over directories with invalid permissions when reading dockerfiles. If a directory doesn't have appropriate permissions, it's not essential that we read it--customers can always specify paths directly.

This also fixes an issue introduced by the newest version of Survey (#1754) where the new OnInterrupt field was not populated, causing segfaults whenever ctrl+c was pressed at a prompt.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@bvtujo bvtujo force-pushed the ignore-unreadable-directories branch from 19916a3 to 80b9b3e Compare December 18, 2020 20:31
Copy link
Copy Markdown
Contributor

@huanjani huanjani left a comment

Choose a reason for hiding this comment

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

Thanks for jumping on this!

Copy link
Copy Markdown
Contributor

@iamhopaul123 iamhopaul123 left a comment

Choose a reason for hiding this comment

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

Thank you for the quick fix on this!

var err error
if validator == nil {
err = p(prompt, &result, stdio(), icons())
err = p(prompt, &result, stdio(), icons(), noInterrupt())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch!

if err != nil {
return nil, fmt.Errorf("read directory: %w", err)
// swallow errors for unreadable directories
continue
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to update unit tests for this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are currently no unit tests reliant on it, apparently. I'll add one in my next PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It turns out that afero does not check permissions when opening files. See spf13/afero#150 for others complaining about this.

@mergify mergify Bot merged commit b5d2a3c into aws:mainline Dec 18, 2020
@bvtujo bvtujo deleted the ignore-unreadable-directories branch December 18, 2020 22:17
mergify Bot pushed a commit that referenced this pull request Dec 21, 2020
<!-- Provide summary of changes -->

<!-- Issue number, if available. E.g. "Fixes #31", "Addresses #42, 77" -->
The newest survey release reverts a commit which was introduced in the previous release, which added unstable behavior for all users of survey. 

This commit bumps to the latest version and reverts changes introduced in #1764 to handle the instability.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
thrau pushed a commit to localstack/copilot-cli-local that referenced this pull request Dec 9, 2022
aws#1764)

<!-- Provide summary of changes -->
This is a quick change to skip over directories with invalid permissions when reading dockerfiles. If a directory doesn't have appropriate permissions, it's not essential that we read it--customers can always specify paths directly. 

This also fixes an issue introduced by the newest version of Survey (aws#1754) where the new OnInterrupt field was not populated, causing segfaults whenever ctrl+c was pressed at a prompt. 


<!-- Issue number, if available. E.g. "Fixes aws#31", "Addresses aws#42, 77" -->

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
thrau pushed a commit to localstack/copilot-cli-local that referenced this pull request Dec 9, 2022
<!-- Provide summary of changes -->

<!-- Issue number, if available. E.g. "Fixes aws#31", "Addresses aws#42, 77" -->
The newest survey release reverts a commit which was introduced in the previous release, which added unstable behavior for all users of survey. 

This commit bumps to the latest version and reverts changes introduced in aws#1764 to handle the instability.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
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.

4 participants