TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The Audacity of Piping Curl to Bash

63 pointsby Un1cornover 2 years ago

21 comments

simionesover 2 years ago
This seems almost like a misunderstanding of what is the role of an installer, especially for something like oh my zsh. The author is complaining that it takes over their zsh configuration, when in fact that is obviously the whole point of the installer.<p>An installer isn&#x27;t simply there to copy a program to your system. It&#x27;s there to copy files to your system and then modify your system so that it is ready to use the new program to the deepest level that makes sense. You&#x27;re not supposed to need to do any other configuration of your system for this program after the installer finishes in order to properly use it. This includes things like associating file types with this program, changing system settings to make it default in various places (hopefully with some kind of flag, to be fair), discovering and associating hardware or any other step like that.<p>Note that piping curl to bash or running bash on the output of curl&#x2F;wget is a minor point quickly glossed over in the article, which is actually complaining much more about using custom installation scripts that do &quot;too much&quot;.
评论 #33832656 未加载
评论 #33833033 未加载
评论 #33834175 未加载
mustache_kimonoover 2 years ago
&gt; If my package manager had an Oh My Zsh package<p>This is the author missing the point. The reason `curl | bash` is common is because devs don&#x27;t like packaging for every distro under the sun, and MacOS, and FreeBSD, and... If you really think `curl | bash` is the problem, then you should be lining up to package the stuff you use for your distro. Instead, it is always someone else&#x27;s problem.<p>Package managers are great... for the user. For everyone else, a polyglot system, with arcane technical policies, and even more arcane human policies is... not ideal.
评论 #33834608 未加载
评论 #33833887 未加载
评论 #33832590 未加载
评论 #33832736 未加载
评论 #33832996 未加载
Sakosover 2 years ago
&gt; I would have just expected it to install it in the proper location (hopefully not in my home directory) and leave the rest of the configuration to me<p>While I don&#x27;t advocate for piping curl to bash, this is exactly what I expect an installer to do. It should provide sane defaults that don&#x27;t require me to fiddle around with manpages or other documentation and config files before I can even use the thing. I&#x27;d say that&#x27;s even the standard for most software. Now, I might compromise on the installer telling me what command I need to enter to get a default configuration&#x2F;setup integrated instead of doing it automatically, but I have too much shit to do to waste it on configuring the nth thing I&#x27;ve installed this week.<p>I think what&#x27;s missing is some standardization around what an installer is allowed to do and flags to tell it when to make certain changes as well as explicit logging for what exactly was changed or added where, but that&#x27;s not going to be solved if everybody has their own bespoke bash script for installation.
评论 #33832525 未加载
评论 #33834933 未加载
hprotagonistover 2 years ago
<p><pre><code> curl ... | bash </code></pre> is the moral equivalent of<p><pre><code> {npm, pip, nuget, ...} install </code></pre> and i really don&#x27;t understand the folderol around that. In both cases, you can alter the command slightly to instead download the payload without executing it and inspect it first, if you wish. In both cases, you&#x27;re ultimately going to either audit and then execute or just execute code from Somewhere Else.<p>This is true for distro package managers too, though you could argue that sometimes but not always (ppas, community&#x2F;, whatever) a distro package manager is an extra layer of insulation between you and nasty stuff.
评论 #33833132 未加载
评论 #33833054 未加载
sjmulderover 2 years ago
Another downside of these scripts is that they tend to make changes to your user or machine configuration, something which is tolerated from Windows installers but a big no-no for me. E.g. I believe Cargo edits .profile to add its path and Teams makes itself start at login (!).<p>For reasons such as these, but also things like telemetry configuration defaults and clean uninstalling, I prefer using a package manager. In a way independent package maintainers balance out the power of upstream developers over end users. They embody “you can just change it if you don’t like it” for the regular user.
评论 #33833061 未加载
jerfover 2 years ago
Agree with author. For me, in addition to separating the &quot;download script&quot; and &quot;run it&quot; steps, there is also a &quot;read script to figure out just what the heck it is going to do to my system&quot;, with optional &quot;edit script to remove silly things&quot; and &quot;just manually run the three important commands&quot; steps.<p>Unfortunately, there just isn&#x27;t a way to square the circle of &quot;this has to work for everybody&quot; and &quot; this shouldn&#x27;t take 300 lines to ensure a directory exists&quot;.
gorjusborgover 2 years ago
I post this every time this topic comes up.<p>Piping from the internet into your shell is a bad idea.<p><a href="https:&#x2F;&#x2F;www.idontplaydarts.com&#x2F;2016&#x2F;04&#x2F;detecting-curl-pipe-bash-server-side&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.idontplaydarts.com&#x2F;2016&#x2F;04&#x2F;detecting-curl-pipe-b...</a>
评论 #33832972 未加载
评论 #33839151 未加载
评论 #33833294 未加载
umviover 2 years ago
&gt; For the love of god, why do I still have programs on Linux that don’t use xdg directories?<p>Because a lot of devs have never heard of it? I&#x27;m a linux app dev of &lt;10 years and I&#x27;ve never heard of xdg until this post. I just assumed dotfiles in the home directory were still the de facto standard...
评论 #33836907 未加载
superkuhover 2 years ago
Not just applications. Entire programming languages like Rust depend on this to install the compiler (rustup, since rustc changes too fast for anything but the most rolling of distros to keep up).
评论 #33832648 未加载
评论 #33832653 未加载
geocrasherover 2 years ago
My issue with piping curl to bash is that so many of these installers are pure junk.<p>Case in point: I work in web hosting. Yesterday a customer came to me asking for root access to the node so they could run an installer for something. No. But they had already tried running it as their user. And everything in their user account was gone. Why?<p>Because the installer expected to run as root, and its variables couldn&#x27;t be defined properly and so when it went to clean up after itself, it did<p><pre><code> rm -rf ~&#x2F;$variable&#x2F; </code></pre> and since the variable was unassigned, that became<p><pre><code> rm -rf ~&#x2F; </code></pre> I might not have it exactly right, but that&#x27;s what the effect was. Piping curl to bash is asking a lot of somebody who doesn&#x27;t know what they&#x27;re doing, and should raise the hackles of somebody who does. At the very least, download and view the script yourself before running it.
Joker_vDover 2 years ago
&gt; why do I still have programs on Linux that don’t use xdg directories?<p>Because there are Linux developers who never heard of XDG and just put their stuff wherever. And since ignoring XDG doesn&#x27;t makes your application completely unusable, they have pretty much zero incentive to learn about it. Crazy world, isn&#x27;t it?
评论 #33833522 未加载
ragingrobotover 2 years ago
Quite a few applications do this.<p>For something like the mentioned oh-my-zsh, it can be safely assumed the user is not a novice in most cases. Having to install in this manner may in fact deter the user, as they&#x27;d be suspicious. A well written README would be the better route.
评论 #33833185 未加载
评论 #33831249 未加载
ArchDover 2 years ago
When I want to be careful about running these setup scripts, especially just for trying out new software, I run them in a docker container to limit whatever damage the scripts can cause. When the script is complicated, I tend to use docker instead of trying to understand the script and then run it on the &#x27;real&#x27; system.<p>Then when I really like the software and want to install it on the &#x27;real&#x27; system, if there&#x27;s much benefit in doing so, I spend more time and effort understanding the script. More often than not, I end up not doing this because there is no compelling need to install the software on the &#x27;real&#x27; system.
manv1over 2 years ago
Really, the risk here is that the install is going to do something unfortunate, like delete everything in your filesystem because you have a space in your home directory name or cause problems because your .profile didn&#x27;t end with a CR and it blindly appended it&#x27;s own stuff to it.<p>I&#x27;m not sure how package managers prevent this sort of issue, but in general running shell scripts as root (and it probably needs to run as root) is a bad thing.
评论 #33834550 未加载
halayliover 2 years ago
The title and the content don&#x27;t match. The omzsh installer behavior is orthogonal to piping it from curl to bash.<p>On the other hand, It&#x27;s often the case that your machine is running scripts that have been fetched online via apt and the like and it&#x27;s definitely something to consider especially with all the hacks that have been happening in the last few years and the undisclosed vulnerabilities available in the wild.
Brian_K_Whiteover 2 years ago
Reading all the comments not understaning the problem is a great way to feel old. It&#x27;s definitely a new generation, only in the bad way where instead of meaning new energy, imagination, and progrrss, it just means forgot or never learned important concepts and principles.<p>You do not take liberties with someone else&#x27;s system, there is no need to do it and no excuse for it. You can have a reference example &quot;make install&quot; in your build system that serves as a reference for the packagers without you having to worry about all the 80 different distros. And it better also have a &quot;make uninstall&quot;.<p>Respecting the possibility that a config file or even the bins and libs might already exist as part of the &quot;make install&quot;, are just part of the job like writing the software itself, not some unreasonable extra burden.<p>If you&#x27;re that much of a baby then I do not want your &#x27;free&#x27; gift software and nor should anyone else. What other corners are you cutting everywhere else in the software? What other gross lack of integrity do you think is ok?<p>Maybe this is more the result of turning every random application into it&#x27;s own cpntainer. It&#x27;s fine to have an app installer configure the entire system to suit itself when the entire system is just the container to house the app.
评论 #33833930 未加载
NuSkoolerover 2 years ago
Package managers are <i>sometimes</i> great for the user, and as mentioned, a pain for the developer in many cases. To cover even &quot;basic&quot; bases, the developer has to manage many package managers. Ouch.<p>From the user side, the package manager often doesn&#x27;t do what I want, either. I could install Node (as an example) via `apt` or `yum`, and end up with a Node installed in a root location. Now I&#x27;m in a mess. Or I could use a install script, or even yet another 3rd party solution such as `npm` to do what I actually want: Node installed for <i>me</i>. ...of course, I just mentioned a whole other can of worms: All the &quot;other&quot; package managers out there.<p>TL;DR: KISS often is the best solution.
uuddlrlrbabaover 2 years ago
Dive into the details of what &quot;clean&quot; packaging entails, how much practices differs between distributions, how many distributions there are, how each dependency also needs to be packaged and maintained across upgrades...<p>And you&#x27;ll quickly see why projects say fsck it -- we support installation via curl | bash. go and package it yourself it you want to.<p>It really highlights the need for a broadly adopted &quot;homebrew for linux&quot; type package manager that could safely manage software without conflicting with OS packages.
评论 #33832790 未加载
评论 #33833003 未加载
nimbiusover 2 years ago
piping curl to bash is a heresy, an abomination that cannot be tolerated. it is an affront to my intellect and sensibility. it is an ethical turpitude and degeneracy that cannot be understated in its depravity.<p>It reduces the user to nothing more than an endured, pseudotrutworthy ball of lard in the developers formal equation of installation. As it is an installation however it beseeches the administrator, the root, the owner and the light of this system that it may achieve its purpose and in doing so is a blasphemy. it supplants my GNUlike will and in its stead enforces the hopes and dreams of nothing more than a transient, a visitor.<p>For the last time: The ground your code touches is holy and hallowed. the rites of Posix and the decree of the Unix philosophy at the sides of the throne you approach alone implores you not to speak unless spoken to, unless absolutely in the favor of the god of this land. To sudo curl|&#x2F;bin&#x2F;bash is to commit an unspeakable treason in the divine presence, a sin unforgiveable before the light of the PTY and the TTY. To take the sudo sword of the emperor alone and wield it as you see fit is damnable contempt indeed.
评论 #33839472 未加载
评论 #33833760 未加载
daitangioover 2 years ago
bash installer are neat, fast and dirty. They shines inside a Dockerfile, because enable to install not-yet-packaged software.<p>To avoid regret their launch, I enabled sudo to ask me a password, to avoid some sudo malicious command in the wild destroying my box or wiping my nas drives...who knows? :)
musk_micropenisover 2 years ago
The entire point of Oh My Zsh is to get a specialty crafted instance of Zsh, so of course it overwrites your.zshrc.