Skip to content

build: ensure no permission errors thrown in packages-dist script #17566

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

Conversation

devversion
Copy link
Member

Bazel by default makes output files or tree artifacts readonly. This
means that the packages-dist script fails in case release output
has been built previously. This has only an effect in non-windows
environments.

We can reasonably fix this by making the folder/files writable
before trying to delete them. This is similar to what Bazel
internally does when deleting outputs of previous builds.

see:
https://github.com/bazelbuild/bazel/blob/07924e8260a447b69b18e8248203e1089b46962a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java#L1251

@devversion devversion added pr: merge safe target: patch This PR is targeted for the next patch release labels Nov 1, 2019
@devversion devversion requested a review from a team as a code owner November 1, 2019 11:35
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 1, 2019
# Make all directories in the previous package output writable. Bazel by default
# makes tree artifacts and file outputs readonly. This causes permission errors
# when deleting the folder. To avoid these errors, we make all files writable.
chmod -R u+w ${pkg_dir}
Copy link
Member Author

@devversion devversion Nov 1, 2019

Choose a reason for hiding this comment

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

I know that this also makes files writable, but it would make things unnecessarily more platform dependent if we rely on find to filter out directories. Nothing wrong with also making the files writable before deletion.

Technically files don't need to be writable for deletion since we have the x bit set in the folder permissions.

@devversion devversion force-pushed the build/avoid-permission-error-build-packages-dist branch from db947b3 to 462f3ae Compare November 1, 2019 16:21
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Nov 1, 2019
Bazel by default makes output files or tree artifacts readonly. This
means that the packages-dist script fails in case release output
has been built previously. This has only an effect in non-windows
environments.

We can reasonably fix this by making the folder/files writable
before trying to delete them. This is similar to what Bazel
internally does when deleting outputs of previous builds.

see:
https://github.com/bazelbuild/bazel/blob/07924e8260a447b69b18e8248203e1089b46962a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java#L1251
@devversion devversion force-pushed the build/avoid-permission-error-build-packages-dist branch from 462f3ae to 2e6eb22 Compare November 1, 2019 16:41
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

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

LGTM

@mmalerba mmalerba merged commit 8422580 into angular:master Nov 4, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants