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

Use build root as workdir for shell_command(workdir="") #18813

Merged
merged 2 commits into from Apr 25, 2023

Conversation

huonw
Copy link
Contributor

@huonw huonw commented Apr 24, 2023

This fixes #18811 by removing the extraneous layer of defaulting of the adhoc tool workdir arguments: it already has default=".", which I think means .value will never be None.

Previously, tests like field.value or "." or if not field.value: ... would use the fallback case for "", and, for shell_command that extra fallback (".") doesn't match the documented behaviour:

  • / or the empty string specifies the build root.

This adjusts the adhoc tool tests to explicitly check the working directory by checking $PWD (previously they were testing the combination of working directory and root output directory, by checking file locations), although no fix was required to adhoc_tool.

@huonw huonw added the category:bugfix Bug fixes for released features label Apr 24, 2023
@huonw huonw added this to the 2.16.x milestone Apr 24, 2023
@huonw huonw merged commit 652de6a into pantsbuild:main Apr 25, 2023
17 checks passed
@huonw huonw deleted the bugfix/18811-workdir-default branch April 25, 2023 10:31
huonw added a commit to huonw/pants that referenced this pull request Apr 25, 2023
…8813)

This fixes pantsbuild#18811 by removing the extraneous layer of defaulting of the
adhoc tool workdir arguments: it already has `default="."`, which I
think means `.value` will never be `None`.

Previously, tests like `field.value or "."` or `if not field.value: ...`
would use the fallback case for `""`, and, for `shell_command` that
extra fallback (`"."`) doesn't match the documented behaviour:

> * `/` or the empty string specifies the build root.

This adjusts the adhoc tool tests to explicitly check the working
directory by checking `$PWD` (previously they were testing the
combination of working directory and root output directory, by checking
file locations), although no fix was required to `adhoc_tool`.
huonw added a commit that referenced this pull request Apr 26, 2023
#18813) (#18832)

This fixes #18811 by removing the extraneous layer of defaulting of the
adhoc tool workdir arguments: it already has `default="."`, which I
think means `.value` will never be `None`.

Previously, tests like `field.value or "."` or `if not field.value: ...`
would use the fallback case for `""`, and, for `shell_command` that
extra fallback (`"."`) doesn't match the documented behaviour:

> * `/` or the empty string specifies the build root.

This adjusts the adhoc tool tests to explicitly check the working
directory by checking `$PWD` (previously they were testing the
combination of working directory and root output directory, by checking
file locations), although no fix was required to `adhoc_tool`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:bugfix Bug fixes for released features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

shell_command workdir="" is documented as "/", but behaves as "."
2 participants