4 ms·
Eh. Looks OK to me, even with Python probably not being the tersest shell language: https://gist.github.com/anonymous/4203b7c6ffc9cb9ecf34d17cb88ecb5e https://g
by masklinn 10y ago
Eh. Looks OK to me, even with Python probably not being the tersest shell language: https://gist.github.com/anonymous/4203b7c6ffc9cb9ecf34d17cb88ecb5e https://gist.github.com/anonymous/4203b7c6ffc9cb9ecf34d17cb8...
- mbrock 10y agoHmm, I admit that's not too bad. I still disagree with the ideology that any non-trivial script needs to be rewritten in Python. The shell is the standard way of interacting with a *nix system, and for me that's the major benefit of using shell for "system"-ish tasks. I already know how to make a symlink, a pipeline, a chmod, etc, so I don't need to learn a new syntax for that.
- Too 10y agoThe shell script probably also behaves strange if any of $out ${docker-runc} $version, $man, etc contains a space, while the python-script most likely wont.
- mbrock 10y agoNix-generated paths don't contain spaces, so it's unnecessary to quote those variables. Of course, as a developer you have to understand this. The semantics of shell string interpolation are generally not that hard to learn, compared to learning all the nuances of programming in general that can make your program incorrect, so I find it a bit strange how it's considered to make shell completely useless for scripting. Shell scripting has been working pretty well since, like 1975! It's not that bad!
- zokier 10y ago> Nix-generated paths don't contain spaces, so it's unnecessary to quote those variables Which works as long as attacker (or sleepy admin) doesn't happen to create suitably "bad" path > Shell scripting has been working pretty well since, like 1975! It's not that bad! Considering the amount of borked system because spaces/uninitialized variables -stories I've heard over years, I'm not so sure about how well it has been working...
- mbrock 10y agoAttackers who have commit access to your repository can do a lot of bad things quite easily.
- CJefferson 10y agoSomeone should try to automate this process, or at least make a complete bash -> python guide. This is much nicer than I expected, but the functions are scattered around a bit.
- masklinn 10y agoNamespaces are a honking great idea, let's do more of those! Alternatively there's always the option of using something like sh[0] and just shelling out to the existing utilities, if you don't mind the portability loss. [0] https://amoffat.github.io/sh/ https://amoffat.github.io/sh/
- ReidZB 10y agoThere are several strings in your gist that have the f misplaced, e.g. 'f{out}/libexec/docker/docker-proxy' instead of f'{out}/libexec/docker/docker-proxy' Not sure it is materially important to the argument, but I thought it was interesting
- masklinn 10y ago> Not sure it is materially important to the argument Not really, I've also forgotten to convert a few dashes to underscores in f-strings and probably made a few other mistakes along the way. It doesn't detract from the main point: it's a rough estimate of how such a converted script would look. Though it makes me wonder if PyLint already has a lint for strings which start with F and have f-string placeholders.