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

Shebang in postBuild #11

Open
rgaiacs opened this issue Dec 12, 2024 · 6 comments
Open

Shebang in postBuild #11

rgaiacs opened this issue Dec 12, 2024 · 6 comments

Comments

@rgaiacs
Copy link

rgaiacs commented Dec 12, 2024

As pointed out in schochastics/MH_netVizR#2, https://mybinder.org and repo2docker is having problem with the shebang in postBuild, i.e.

#!/usr/bin/env bash -v 

@schochastics asked

The postBuild is actually created via quarto use binder so is this a bug in quarto too?

I think is a small bug in quarto but need further investigation.

When one uses

#!/usr/bin/env bash -v 

it's telling the computer to

  1. Load the default environment variables, including PATH
  2. Run bash -v.

Depending of the value for PATH and the system, the -v option could create problems. For example, imagine that

  1. your PATH is /home/juvyan/bin:/usr/bin
  2. /home/juvyan/bin/bash exists
  3. /home/juvyan/bin/bash does not implement -v

The script will fail.

But the error message

Step 67/72 : RUN ./postBuild
 ---> Running in 333a5c1b85f6
/usr/bin/env: ‘bash -v’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines

indicates that #!/usr/bin/env is looking for a file named bash -v.

I will further investigate and report back here.

@rgaiacs
Copy link
Author

rgaiacs commented Dec 12, 2024

I noticed that

Step 35/49 : ENV PATH=${HOME}/.local/bin:${REPO_DIR}/.local/bin:${PATH}
 ---> Running in 75a7b0afd32e
 ---> Removed intermediate container 75a7b0afd32e
 ---> 0f268f8d1d8f

@chainsawriot
Copy link
Contributor

First this cb720f6

And then the older quarto (e.g. 1.4.551 for oolong) is actually doing the right thing.

@chainsawriot
Copy link
Contributor

quarto-dev/quarto-cli@d5925ae

I think it's kind of fixed in 1.7.3

@schochastics
Copy link
Member

should we leave the .fix_postBuilt() for now or implement something that checks for quarto versions? Not sure I understand everything right now but it seems that the current workaround should be fine?

@rgaiacs
Copy link
Author

rgaiacs commented Dec 12, 2024

@chainsawriot Thanks! Can usemh require Quarto >= 1.7.3?

I will add a check in Methods Hub to raise a earlier error if postBuild uses the wrong shebang.

@chainsawriot
Copy link
Contributor

We can put this in DESCRIPTION, but that's not a check. If a check is really needed, we can do that with quarto::quarto_version(). But it's a little bit too draconian.

We can keep .fix_postBuild(), at least for now. It increases our supported quarto versions.

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

3 participants