Live data from Hacker News

Xonsh: Python-powered, cross-platform, Unix-gazing shell

xon.sh

21–30 of 97 posts

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#23
post #12

Sounds neat. However, the fact that `ls -l` either subtracts two numbers or calls a shell command, depending on whether there exist valriables 'ls' and 'l' in the Pythom environment, looks like a security nightmare waiting to happen. What if I create a python object 'ls' deep inside a script that does Evil when subtracted from?

It could be worse. It could be a Wolfram shell, in which case 'ls -l' would return 'l(s - 1)'.

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#24
post #12

Sounds neat. However, the fact that `ls -l` either subtracts two numbers or calls a shell command, depending on whether there exist valriables 'ls' and 'l' in the Pythom environment, looks like a security nightmare waiting to happen. What if I create a python object 'ls' deep inside a script that does Evil when subtracted from?

What's stopping a Bash script from doing something similar? You could alias ls to a malicious actor for example.

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#25
post #12

Sounds neat. However, the fact that `ls -l` either subtracts two numbers or calls a shell command, depending on whether there exist valriables 'ls' and 'l' in the Pythom environment, looks like a security nightmare waiting to happen. What if I create a python object 'ls' deep inside a script that does Evil when subtracted from?

You

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#26

Love xonsh!! And gets more and more stable with every release. it's the shell I always wanted. And cross platform to boot. Alias ls -l? aliases['ls'] = "ls -l" Oops no I don't want that any more: del aliases['ls'] Add dir to path: $PATH.append('/foo/bar') Just the awesome python syntax sugar and readbility right in the May I never right a bash script again.

del aliases[‘ls’] seems like a step back from unalias ls.

Only if you're coming from a different shell.

For me, it's easier to remember that aliases acts like a dictionary, so I can treat it like any other dictionary. With "unalias" I have to remember the command. As I rarely use unalias (a few times over a period of years), I typically have to search the web on how to remove an alias.

And if it really bothers you, I'm pretty sure it's trivial to define an unalias function in Xonsh that will act as you expect (without needing parentheses).

It's part of the beauty of Xonsh - many such commands you're used to can be brought into it by writing fairly simple Python code.

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#27
post #6

Sounds amazing. If it ever gets a relatively active plugin ecosystem like zsh or fish, I'd definitely switch. Being able to write shell functions in Python would be very refreshing. If they want bigger adoption, dedicating a bunch of people who do nothing but port zsh and fish plugins would probably go a long way.

Curious: What zsh/fish plugins do you think are missing from xonsh?

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#28

Love xonsh!! And gets more and more stable with every release. it's the shell I always wanted. And cross platform to boot. Alias ls -l? aliases['ls'] = "ls -l" Oops no I don't want that any more: del aliases['ls'] Add dir to path: $PATH.append('/foo/bar') Just the awesome python syntax sugar and readbility right in the May I never right a bash script again.

> May I never right a bash script again.

Bash is not going away any time soon, for better or worse..

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#29
post #24
post #12

Sounds neat. However, the fact that `ls -l` either subtracts two numbers or calls a shell command, depending on whether there exist valriables 'ls' and 'l' in the Pythom environment, looks like a security nightmare waiting to happen. What if I create a python object 'ls' deep inside a script that does Evil when subtracted from?

What's stopping a Bash script from doing something similar? You could alias ls to a malicious actor for example.

Well, aliases are ignored in scripts usually, but you could prepend something to the PATH so your script/exe gets found before built-ins, no? I agree, I don't see that this is a problem unique to Xonsh.
Post reply on HN