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

build script doesn't revalidate base working-directory. #168

Open
jhheider opened this issue Aug 14, 2023 · 2 comments
Open

build script doesn't revalidate base working-directory. #168

jhheider opened this issue Aug 14, 2023 · 2 comments

Comments

@jhheider
Copy link
Contributor

The following fails (go.dev-type):

build:
  working-directory: src
  script:
    - make.bash
    - mkdir -p "{{prefix}}"
    - run: mv src "{{prefix}}"
      working-directory: $SRCROOT

with

+ unset OLDWD
+ OLDWD=/var/folders/8b/n_gmhmk57ks85swq3mrdbrwc0000gp/T/1892f004/src
+ mkdir -p /var/folders/8b/n_gmhmk57ks85swq3mrdbrwc0000gp/T/1892f004
+ cd /var/folders/8b/n_gmhmk57ks85swq3mrdbrwc0000gp/T/1892f004
+ mv src /opt/go.dev/v1.21.0
+ cd /var/folders/8b/n_gmhmk57ks85swq3mrdbrwc0000gp/T/1892f004/src
/var/folders/8b/n_gmhmk57ks85swq3mrdbrwc0000gp/T/1892f004/xyz.tea.build.sh: line 53: cd: /var/folders/8b/n_gmhmk57ks85swq3mrdbrwc0000gp/T/1892f004/src: No such file or directory

Makes sense, but an odd gotcha. Could be prevented with a test -d $foo || mkdir -p $foo, or similar.

@mxcl
Copy link
Member

mxcl commented Aug 27, 2023

hah, interesting. Not really sure what we should do. User literally moved the dir.

In this case we don’t care about the working directory anymore since it is the last step. We should probs at least just support that by not changing back unless there's another step or something like that.

@jhheider
Copy link
Contributor Author

I think the stupidest easy fix is to mkdir -p before any cd. Slightly less stupid involves test -d. Thirdly is something else, probably.

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

No branches or pull requests

2 participants