Shell WTF



  • Just now on my (luckily secondary) production server...

    "Ok, time to update node to 0.12"

    $ ./install-node-update-using-my-homemade-crappy-script.sh
    

    (5 minutes later...)

    ...
    symlinking ../lib/node_modules/npm/bin/npm-cli.js -> /home/project/local/node-v0.12.1/~/local/bin/npm
    updating shebang of /home/project/local/node-v0.12.1/~/local/bin/npm to ~/local/bin/node
    ...
    
    

    "Wait, what's this?"

    /node-v0.12.1/~/local

    "Fuck, let me guess, it didn't parse my home folder. I bet it didn't even install the node as it should have."

    $ node -v
    v0.10.31
    
    $ cd /home/project/local/node-v0.12.1/
    $ ls
    ~                  AUTHORS    BSDmakefile  common.gypi  config.mk  CONTRIBUTING.md  doc              lib      Makefile  node.gyp  README.md  test   vcbuild.bat
    

    "Yup, there it is"

    $ ls ... ~

    "Sigh, I don't have time for this shit. Let me just take care of that and start over..."

    $ rm -rf ~
    

    "..."

    "... Ti dum ti dum ti dum.... what shall I have for lunch today? ..."

    "... boy this is taking long... "

    " ... wait"

    $ rm -rf ~
    ^C
    

    Oh fuck.


  • :belt_onion:

    @cartman82 said:

    "..."

    "... Ti dum ti dum ti dum.... what shall I have for lunch today? ..."

    "... boy this is taking long... "

    " ... wait"

    $ sudo chmod -R 666 / ^C

    Oh fuck.

    This EXACT thought process. I just fixed the command to fit my fuckup.



  • Oh no, that's even worse!


  • :belt_onion:

    @cartman82 said:

    Oh no, that's even worse!

    Eh, my own machine so it wasn't that big of a deal. And I stopped it before it reached /home.

    Still... *shudders*



  • id_rsa gone. Great.


  • :belt_onion:

    @cartman82 said:

    id_rsa gone. Great.

    Ouch! :(


  • area_deu

    I was expecting something about fuel stations.



  • Something something the importance of backing up your data...

    Anyway, do you really need a homemade script to update node? Because that's a huge WTF.



  • @anonymous234 said:

    Something something the importance of backing up your data...

    Anyway, do you really need a homemade script to update node? Because that's a huge WTF.

    I'm building from source, because I want to juggle different versions for different accounts.

    There's probably a better way to do this now, but I've been doing it this way since the 0.8 days and I'm damn too old to change now.



  • And this is why I dislike working with *nix-style OSs. It's basically *nix in a nutshell:

    "You can do everything with this OS. Just open a Terminal..."
    followed by
    "Oh, you typed that wrong? Well. What a shame."


  • :belt_onion:

    @Masaaki_Hosoi said:

    And this is why I dislike working with *nix-style OSs.

    To be fair, Windows will happily delete stuff from CLI as well. Now, the fact that you visit CLI less is another matter.



  • @Onyx said:

    To be fair, Windows will happily delete stuff from CLI as well. Now, the fact that you visit CLI less is another matter.

    Or at least it will try. I did almost delete my hard drive once. Luckily it started with a bunch of folders it didn't have permission to delete, so I stopped it before it started actually deleting anything. Freaked me the hell out though once I realized what it was trying to do (I messed up a CD command in a batch script).

    That said, I rarely ever visit the command line in Windows.



  • Back in the day I once :fa_facebook_square:ucked up by deleting everything from the root folder of my fathers' DOS box.


  • sockdevs

    I wrote .cmd scripts for Windows a couple of weeks ago to work around a PHP bug because production servers running PHP 5.3... yeah.


  • area_deu

    Also, you're an idiot.
    Learn to prefix all your paths that interact with files in the directory you're in with ./.


  • :belt_onion:

    @aliceif said:

    Learn to prefix all your paths that interact with files in the directory you're in with ./.

    :arrow_up: This. And people still ask me why I do this. Once was enough, TYVM.

    And no, that fuckup I posted above wasn't actually a missing ., I was just being stupid :P



  • @cartman82 said:

    I'm building from source, because I want to juggle different versions for different accounts.

    I'd be prepared to argue (in the absence of evidence that you have an actual reason that's, you know, good) that this here is a good-sized :wtf: in and of itself.


  • I survived the hour long Uno hand

    @cartman82 said:

    I want to juggle different versions for different accounts



  • @Masaaki_Hosoi said:

    Or at least it will try. I did almost delete my hard drive once. Luckily it started with a bunch of folders it didn't have permission to delete, so I stopped it before it started actually deleting anything. Freaked me the hell out though once I realized what it was trying to do (I messed up a CD command in a batch script).

    That said, I rarely ever visit the command line in Windows.

    So you dislike working with *nix-style OSs is because it offers something you don't use in a more advanced manner than Windows?

    I assume it's because you think it's required to use the command line in *nix, but that's certainly not true anymore for most distros (unless the hardware is poorly supported by the distro).


  • sockdevs

    @Evo said:

    but that's certainly not true anymore for most distros

    granted, but *nix still has a tendency to treat UI as second class citizen after the CLI....



  • The argument that "the computer does what you tell it to do, so it's your fault!" annoys me so much. Because it means that user interfaces should make no attempts to stop you from making mistakes. And that's, plain and simply, false.

    A user interface has a series of objectives it has to fulfil: be easy for novice users to pick up, be efficient (fast) for advanced users, stop the user from making mistakes whenever possible, and some others I can't remember. I'm not making this list up by the way, it's from an article from one of those "UX expert" guys (can't remember the source, sorry). An interface that makes it easy to make mistakes is objectively worse than one that achieves the same objectives without doing that.

    Of course, you could argue that it's a necessary tradeoff for efficiency, but I haven't seem much evidence for that in the Linux world. For example, a simple "recycle bin"-like functionality that marked files as deleted but without actually deleting them (so you could call "undelete" and recover them) could be easily implemented at filesystem level, and would protect you from bad "rm"s, yet no one has done it.

    (even more annoying is the assumption that only "stupid users" make mistakes. Victim blaming at its finest, aka the stupid rationalization that since the system is perfect it must be their fault, and obviously it could never happen to you.)



  • Wow, good thing you're using Lunix where you can't undo mistakes!!!! FUCK YOU START OVER! Is what your OS is saying to you.



  • @aliceif said:

    Also, you're an idiot.

    Yeah; for picking a shitty UI on a shitty OS.

    Not because his files were accidentally deleted.

    @aliceif said:

    Learn to prefix all your paths that interact with files in the directory you're in with ./.

    Why should he or anybody have to?

    When you have to remember all these little rules like this in your brain, how do you have any space leftover for the actual problem you're actually trying to solve?



  • @Evo said:

    I assume it's because you think it's required to use the command line in *nix, but that's certainly not true anymore for most distros (unless the hardware is poorly supported by the distro).

    Bullshit.

    You create a Linux VM in AWS. You log into it. What do you get?

    You create a Windows VM in AWS. You log into it. What do you get?

    Hint: the Windows VM gives you a full GUI by default. The Linux VM has no GUI installed whatsoever.

    Hell, as far as I know, there's not even a secure way to log in to a Linux server GUI out-of-the-box. Not without using the CLI in advance to wrap the shitty VNC remote control software in some encryption. The thing Windows does-- encrypted-by-default, graphical, remote control-- doesn't even exist in Linux regardless of what packages you have installed.)



  • @anonymous234 said:

    (even more annoying is the assumption that only "stupid users" make mistakes. Victim blaming at its finest, aka the stupid rationalization that since the system is perfect it must be their fault, and obviously it could never happen to you.)

    But that's like basically the entire Linux raison d'etre!


  • sockdevs

    @anonymous234 said:

    The argument that "the computer does what you tell it to do, so it's your fault!" annoys me so much. Because it means that user interfaces should make no attempts to stop you from making mistakes. And that's, plain and simply, false.

    Agreed. However, until computers have intelligence approaching human-like, they'll still be dumb machines that only do what you tell them to do, and not necessarily what you intended :stuck_out_tongue:


  • area_deu

    @blakeyrat said:

    When you have to remember all these little rules like this in your brain, how do you have any space leftover for the actual problem you're actually trying to solve?

    Prefixing ./ (or .\ in DOS/Windows) is the right way to say "Hey, computer, I mean something in this directory! Not something in $PATH, an alias or a shell builtin!".



  • The WTFiness here cries to heaven, seeking revenge.

    And no, it's not your shell. The whole idea and its premise are one big WTF.

    Node-wielding hipsters cannot into package management. Makes me sad a bit.



  • @Steve_The_Cynic said:

    I'd be prepared to argue (in the absence of evidence that you have an actual reason that's, you know, good) that this here is a good-sized in and of itself.

    Multiple node applications, each in its own account, each uses its own version of node (and other software) from ~/local.

    Node is pretty stable, but there ARE breaking changes and I want the ability to upgrade one app to a newer version, while leaving others on stable.

    @Yamikuronue said:

    creationix/nvm

    nvm - Node Version Manager - Simple bash script to manage multiple active node.js versions

    Know about it. Seems pretty low effort + my own scripts are good enough for now (except when the junior starts working on them and fucks them up).

    @Evo said:

    So you dislike working with *nix-style OSs is because it offers something you don't use in a more advanced manner than Windows?

    I assume it's because you think it's required to use the command line in *nix, but that's certainly not true anymore for most distros (unless the hardware is poorly supported by the distro).

    Let's be real, if you're using linux server, you're using CLI.

    @anonymous234 said:

    Of course, you could argue that it's a necessary tradeoff for efficiency, but I haven't seem much evidence for that in the Linux world. For example, a simple "recycle bin"-like functionality that marked files as deleted but without actually deleting them (so you could call "undelete" and recover them) could be easily implemented at filesystem level, and would protect you from bad "rm"s, yet no one has done it.

    Definitely. There's NO excuse for not having a Trash can / Recycle bin like functionality on *nix after all these years.

    @blakeyrat said:

    Wow, good thing you're using Lunix where you can't undo mistakes!!!! FUCK YOU START OVER! Is what your OS is saying to you.

    @blakeyrat said:

    Yeah; for picking a shitty UI on a shitty OS.

    Not because his files were accidentally deleted.

    @blakeyrat said:

    Why should he or anybody have to?

    When you have to remember all these little rules like this in your brain, how do you have any space leftover for the actual problem you're actually trying to solve?

    You mean, you don't think CLI is the best basis for a user interface?

    TELL US MORE ABOUT THESE WILD NEW IDEAS OF YOURS, BLAKEYRAT

    @wft said:

    Node-wielding hipsters cannot into package management. Makes me sad a bit.

    Package management is for stodgy tie-wearing 9-5 working stuffy pants corporate stooges, man.


  • sockdevs

    @wft said:

    Node-wielding hipsters cannot into package management

    Really?
    Debian/Ubuntu: sudo apt-get nodejs npm
    Red Hat/RHEL: sudo yum node npm
    And then, in your app's folder, npm install



  • OP apparently can't.

    And you, my lady, aren't hipster enough.



  • @RaceProUK said:

    Really?Debian/Ubuntu: sudo apt-get nodejs npmRed Hat/RHEL: sudo yum node npmAnd then, in your app's folder, npm install

    And which version do you get? On Centos 5? Centos 6? 7? Debian 7? Debian 8?

    That's fine for screwing around, but I need to control the versions for real development.



  • rpmbuild is your friend.


  • I survived the hour long Uno hand

    @RaceProUK said:

    Debian/Ubuntu: sudo apt-get nodejs npm

    Then cry, as you end up with an outdated version located under the wrong name.


  • sockdevs

    @Yamikuronue said:

    under the wrong name

    Eh, doesn't bother me; can always symlink anyway
    @Yamikuronue said:
    an outdated version

    How many repos have the absolute latest anyway?


  • sockdevs

    @cartman82 said:

    That's fine for screwing around, but I need to control the versions for real development.

    It should be possible to specify exact versions ;)



  • Nope.


  • sockdevs

    @cartman82 said:

    Nope.

    Yep:
    apt will have a similar ability :stuck_out_tongue:



  • Life is so much easier when your software doesn't depend on any specific version of its platform.



  • So stop using it if it's shit and you lose your work! Fucking idiot.



  • @blakeyrat said:

    So stop using it if it's shit and you lose your work! Fucking idiot.

    But mum, if I use GUI, all the other kids will stop thinking I'm coooooolll....

    @RaceProUK said:

    apt will have a similar ability

    Hmm, let's see, on my debian 8...

    $ apt-cache madison nodejs
        nodejs | 0.10.29~dfsg-1.1 | http://ftp.us.debian.org/debian/ jessie/main amd64 Packages
        nodejs | 0.10.29~dfsg-1.1 | http://ftp.us.debian.org/debian/ jessie/main Sources
    

    Wow, I have a choice between node 0.10.29 and 0.10.29.

    Ok, maybe that's just Debian being assholes, how about CentOS 6?

    # yum --showduplicates list nodejs | expand
    Loaded plugins: fastestmirror
    Determining fastest mirrors
     * base: ftp.plusline.de
     * epel: mirrors.n-ix.net
     * extras: centos.datente.com
     * updates: ftp.plusline.de
    Available Packages
    nodejs.i686                           0.10.33-1.el6                         epel
    nodejs.x86_64                         0.10.33-1.el6                         epel
    
    

    Ok, I suppose I can live with the latest stable that differs by few minor versions between servers. Let's just install that on CentOS 5 and be done with it...

    # yum --showduplicates list nodejs | expand
    Error: No matching Packages to list
    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
     * base: mirror.hostkenti.com.tr
     * centosplus: mirror.hostkenti.com.tr
     * epel: mirror.dgn.net.tr
     * extras: mirror.hostkenti.com.tr
     * updates: mirror.vit.com.tr
    Excluding Packages from CentOS-5 - Base
    Finished
    Excluding Packages from CentOS-5 - Plus
    Finished
    Reducing CentOS-5 - Plus to included packages only
    Finished
    Excluding Packages from CentOS-5 - Updates
    Finished
    

    I think I'll stick with building from source, thank you very much.



  • Wouldn't it be nice if someone made node packages for your choice of package managers?

    Oh wait...



  • @blakeyrat said:

    Why should he or anybody have to?
    Because you too can create a directory named %HOME% in Windows Explorer, and before your third cup of coffee del /s /q %HOME% and destroy part of your user profile.

    The problem with Linux is that it's ~, which can be easy to forget is special.

    @blakeyrat said:

    You create a Linux VM in AWS. You log into it. What do you get?
    You create a Windows VM in AWS. You log into it. What do you get?

    Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-48-generic x86_64)
    
     * Documentation:  https://help.ubuntu.com/
    Last login: Fri Apr  3 01:46:29 2015 from pool-173-66-110-227.washdc.fios.verizon.net
    root@elrond:~#
    
    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.
    
    C:\WINDOWS\SYSTEM32>
    

    Who the hell doesn't use Server Core?



  • @powerlord said:

    Wouldn't it be nice if someone made node packages for your choice of package managers?

    Oh wait...

    Hmm, so...

    Downsides

    • Trusting a private organization not to mess with node sources before building them
    • Trusting this small-ish company to keep this service running whenever I need it
    • Waiting for latest versions / patches to become available
    • Having to add their private keys / repositories by executing downloaded bash script blindly on production servers
    • After all that, still not being able to have multiple node versions on one machine

    Upsides

    • .... ?

    Why are we even discussing this? If I wanted to get rid of my own scripts, I'd rather move to @Yamikuronue's solution then going binary.

    A bunch of my admin headaches over the years were solved by building critical pieces of infrastructure from sources. In production, apt-get and yum are great for libraries and utilities. But if your software relies on it (as in, specific version features and configuration quirks), build it and configure it yourself. That's at least been my experience so far.



  • @cartman82 said:

    But if your software relies on it (as in, specific version features and configuration quirks), build it and configure it yourself. That's at least been my experience so far.

    The alternative is to have a paid contract with someone else to do just that. But your company already has that with you, and if you already know how to do it, well...



  • @cartman82 said:

    But mum, if I use GUI, all the other kids will stop thinking I'm coooooolll....

    Well at least you're showing some self-awareness.



  • @TwelveBaud said:

    Because you too can create a directory named %HOME% in Windows Explorer, and before your third cup of coffee del /s /q %HOME% and destroy part of your user profile.

    On Windows, you wouldn't have to do any of this shit because you could just double-click a .msi file and hit "next".

    Except you probably do, because Node is probably written by a team of fuckwits who didn't bother porting it to the most popular OS in the world.

    @TwelveBaud said:

    Who the hell doesn't use Server Core?

    Never used, don't want.


  • :belt_onion:

    @cartman82 said:

    On Centos 5? Centos 6? 7?

    0.0.1? :trollface:

    @RaceProUK said:

    How many repos have the absolute latest anyway?

    Arch fanboy entering the thread in 3... 2...


  • sockdevs

    @Onyx said:

    @RaceProUK said:
    How many repos have the absolute latest anyway?

    Arch fanboy entering the thread in 3... 2...

    Definitely not me; I'm a Windows girl :smile:


  • :belt_onion:

    I have many windows!

    Most of them are terminals...


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.