Comments (8)
I was facing the same issue today. I was just about commiting a fish version of the oe-init-build-env
and oe-setup-builddir
scripts to their mailing list, before a came across this project, which seems more reasonable to me, as rewriting bash scripts for fish can be tenacious and expensive.
Anyway, I had a look at the sources, especially at this part:
command = 'eval $1 && ({}; alias) >&{}'.format(
env_reader,
pipe_w
)
args = [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])]
@edc Could you please explain what passing 'bass'
as a parameter to bash here does?
I guess changing these lines to the following would solve the issue for us:
command = 'eval $0 && ({}; alias) >&{}'.format(
env_reader,
pipe_w
)
args = [BASH, '-c', command, ' '.join(sys.argv[1:])]
from bass.
Funny enough, when I type
fish ~/.local.share/omf.pkg/bass/functions/bass.fish source a.sh
the output is empty as well like bash would do. That's something beyond my paygrade ;)
from bass.
This is very interesting. I looked into it, and this seems hard to fix because we intentionally set $1
etc to mimic running the script:
$ cat a.sh
echo $1
$ bass ./a.sh abc
abc
from bass.
wontfix is a disappointing label :(
The difference is that your command is bass ./a.sh
and mine is bass source a.sh
. So you could distinguish it.
from bass.
The difference is that your command is bass ./a.sh and mine is bass source a.sh. So you could distinguish it.
ping @edc
from bass.
@edc Could you please explain what passing 'bass' as a parameter to bash here does?
I guess changing these lines to the following would solve the issue for us:
command = 'eval $0 && ({}; alias) >&{}'.format( env_reader, pipe_w ) args = [BASH, '-c', command, ' '.join(sys.argv[1:])]
Scripts that access the value of $0
expect to find a path to an interpreter or a path to themselves, a space-delimited list of words will thus likely be something they are not prepared to handle.
from bass.
Thanks @zavorka. I can confirm that your PR is working with the openembedded init script.
from bass.
According to the -c
section of bash manual:
Read and execute commands from the first non-option argument command_string, then exit. If there are arguments after the command_string, the first argument is assigned to $0 and any remaining arguments are assigned to the positional parameters. The assignment to $0 sets the name of the shell, which is used in warning and error messages.
I think [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])]
is the appropriate way to invoke it, though we should probably replace bass
with something more appropriate because clearly it is not just "used in warning and error messages".
from bass.
Related Issues (20)
- How does bass import function from bash and why nvm need sourced every time ? HOT 2
- Annoying virtualenv conflict HOT 1
- Newlines sourced as \\n string literals
- append_path: command not found
- Quotes disappear from arguments when running script through bass HOT 3
- No module named 'json' HOT 3
- bass -d "source someshell.sh" not exactly stay the same every time
- Sourcing large number of exports is very slow, or hangs indefinitely HOT 10
- Command 'python' not found HOT 5
- "Variables may not be used as commands" HOT 2
- variables cannot be bracketed HOT 1
- "Bass internal error!" when status code is not 0 HOT 5
- Sourcing bash alias with question mark triggers `No matches for wildcard` error HOT 3
- cannot read file system information bug HOT 1
- Test scripts: using double `dirname` does not work if command line is `./test_dollar_on_output.fish` HOT 1
- Alias with $* does not get correctly converted HOT 1
- Significantly slower to source paths to a different directory HOT 4
- Bass and ssh-agent aren't interacting well on Linux HOT 3
- Can bass convert script files? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bass.