WTF Bites


  • Java Dev

    @topspin said in WTF Bites:

    @PleegWat said in WTF Bites:

    @topspin said in WTF Bites:

    But doesn't the shebang line mean the whole script is always executed by Perl and not by the shell in the first place?!

    Only if the shebang line is read correctly. If it is not, the kernel will end up using /bin/sh as interpreter as a fallback.

    Oh, interesting. I assumed it would read the perl part correctly and truncate the arguments at some point.
    TIL.

    It was mentioned upthread that some unixes only read the first 32 bytes for the shebang line, which may cause a long path to perl to be truncated.


  • ♿ (Parody)

    @topspin said in WTF Bites:

    @boomzilla Sounds like you got front page material here. 🏆

    Front what now?



  • So there's this dotnet project (yes, I'm running as root, shut up)

    root@host:~# cd StupidProject-src/
    root@host:~/StupidProject-src# ls
    StupidProject.csproj  StupidProject.csproj.user  StupidProject.sln  DBConnector.cs  OtherStuff.cs  Program.cs
    

    And it compiles and runs fine

    root@host:~/StupidProject-src# dotnet build
    Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
    Copyright (C) Microsoft Corporation. All rights reserved.
    
      Restoring packages for /root/StupidProject-src/StupidProject.csproj...
      Generating MSBuild file /root/StupidProject-src/obj/StupidProject.csproj.nuget.g.props.
      Generating MSBuild file /root/StupidProject-src/obj/StupidProject.csproj.nuget.g.targets.
      Restore completed in 652.42 ms for /root/StupidProject-src/StupidProject.csproj.
      StupidProject -> /root/StupidProject-src/bin/Debug/netcoreapp2.1/StupidProject.dll
    
    Build succeeded.
        0 Warning(s)
        0 Error(s)
    
    Time Elapsed 00:00:04.81
    

    now let's try to build it somewhere else

    root@host:~/StupidProject-src# cd ..
    root@host:~# mkdir outputDir
    root@host:~# dotnet build -o ./outputDir/ StupidProject-src/
    Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
    Copyright (C) Microsoft Corporation. All rights reserved.
    
      Restore completed in 107.83 ms for /root/StupidProject-src/StupidProject.csproj.
      StupidProject -> /root/StupidProject-src/outputDir/StupidProject.dll
    
    Build succeeded.
        0 Warning(s)
        0 Error(s)
    
    Time Elapsed 00:00:02.27
    root@host:~# ls outputDir/
    root@host:~#
    

    StupidProject -> /root/StupidProject-src/outputDir/

    Wtf? that's not what I wanted. I clearly specified "./outputDir". That means where I am.

    With an absolute path, it works. OK it's not a big deal but... how does something as basic as that fail?????

    Oh look it's been open two months... that's actually less than I expected. Still, WTF.

    This is likely due to what the shells do on each OS, rather than some specific code we run per OS.

    No it's not. The shells don't touch the "./". You must be switching to that directory yourself.


  • ♿ (Parody)

    @kazitor said in WTF Bites:

    @boomzilla said in WTF Bites:

    Got a screen shot of an excel file from customer. It shows content out to column DNG (:giggity:).

    How did that even fit? Even 1-pixel columns might not be enough…

    :rolleyes:


  • Java Dev

    @ixvedeusi said in WTF Bites:

    @PleegWat said in WTF Bites:

    kernel will end up using /bin/sh

    :wtf: The who now? Seriously? What's the kernel doing, executing shell scripts? Is that how things work in Linux-land?

    It's down in the guts of the exec() family of system calls. The caller specifies a command and an argument list; the kernel needs to determine how that command needs to be called, be that as native x86, native x86_64, .net exe via mono, windows exe via wine, or some interpreter via a shebang line. Or probably some other way I'm forgetting.

    And as I understand the interpreter in the shebang line can itself be a shell script.



  • @anonymous234 Wait, I spoke too soon. Absolute path:

    #dotnet build -o /root/outputDir/ StupidProject-src/
    
    Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
    Copyright (C) Microsoft Corporation. All rights reserved.
    
      Restore completed in 126.75 ms for /root/StupidProject-src/StupidProject.csproj.
    CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/root/StupidProject-src/StupidProject.csproj]
    
    Build FAILED.
    
    CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/root/StupidProject-src/StupidProject.csproj]
        0 Warning(s)
        1 Error(s)
    

    🖕



  • @ixvedeusi Welcome to Linux, enjoy your stay. Yes, the kernel function for "run binary" has a few "format decoders" that are tried to see which works (ELF, a.out, etc). One of them looks for #! and just loads the string after that. So yes, the kernel can execute scripts (and it can be extended to other arbitrary file-interpreter combinations).

    This isn't as crazy as it seems: ELF files also have an "interpreter" field that gets loaded and run instead of it. It generally points to the dynamic linker (/lib/ld-linux.so.2).

    Here's some other fun facts:

    1. There is no "run in a new process" syscall. It's always fork then exec.
    2. There is no "elevate permissions" or "run as root" syscall. Running as root is always done through the setuid bit.

  • Java Dev

    @anonymous234 said in WTF Bites:

    and it can be extended to other arbitrary file-interpreter combinations

    $ echo '#!/bin/cat' > quine
    $ chmod +x ./quine
    $ ./quine
    #!/bin/cat
    

  • Banned

    @anonymous234 said in WTF Bites:

    This isn't as crazy as it seems: ELF files also have an "interpreter" field that gets loaded and run instead of it. It generally points to the dynamic linker (/lib/ld-linux.so.2).

    "Not as crazy as it seems", as in "much less crazy than other things that also happen on Linux". Why the hell is linking shared libraries delegated to external applications, that the executable files have to specify themselves!?


  • Java Dev

    @PleegWat said in WTF Bites:

    @anonymous234 said in WTF Bites:

    and it can be extended to other arbitrary file-interpreter combinations

    $ echo '#!/bin/cat' > quine
    $ chmod +x ./quine
    $ ./quine
    #!/bin/cat
    

    Or, indeed:

    $ cat ./words
    #!/bin/bash
    cat "$@" | while read line
    do
        echo $line | wc -w
    done
    $ cat ./test
    #!/home/pleegwat/words
    this is a test
    this is another
    hello
    $ ./test
    1
    4
    3
    1
    

    Note the test script is interpreted by the words script.


  • Java Dev

    @PleegWat

    And then there's this little tidbit about how the ldd utility works:

    $ ldd /bin/ls
    	linux-vdso.so.1 =>  (0x00007fff59d68000)
    	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fec384c4000)
    	libcap.so.2 => /lib64/libcap.so.2 (0x00007fec382bf000)
    	libacl.so.1 => /lib64/libacl.so.1 (0x00007fec380b5000)
    	libc.so.6 => /lib64/libc.so.6 (0x00007fec37ce8000)
    	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fec37a86000)
    	libdl.so.2 => /lib64/libdl.so.2 (0x00007fec37881000)
    	/lib64/ld-linux-x86-64.so.2 (0x000055f4895ce000)
    	libattr.so.1 => /lib64/libattr.so.1 (0x00007fec3767c000)
    	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fec37460000)
    $ LD_TRACE_LOADED_OBJECTS=1 /bin/ls
    	linux-vdso.so.1 =>  (0x00007ffdc7bfd000)
    	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f868c121000)
    	libcap.so.2 => /lib64/libcap.so.2 (0x00007f868bf1c000)
    	libacl.so.1 => /lib64/libacl.so.1 (0x00007f868bd13000)
    	libc.so.6 => /lib64/libc.so.6 (0x00007f868b946000)
    	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f868b6e4000)
    	libdl.so.2 => /lib64/libdl.so.2 (0x00007f868b4e0000)
    	/lib64/ld-linux-x86-64.so.2 (0x00007f868c348000)
    	libattr.so.1 => /lib64/libattr.so.1 (0x00007f868b2db000)
    	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f868b0bf000)
    

  • 🚽 Regular

    @PleegWat said in WTF Bites:

    $ echo '#!/bin/cat' > quine
    $ chmod +x ./quine
    $ ./quine
    #!/bin/cat
    

    3db440b7-faaa-42f2-99df-7438fb658a94-image.png



  • Finally, a phone that can last more than one day

    07536f89-bfdc-471d-8c98-ace0c455cbd1-image.png


  • Java Dev

    @TimeBandit said in WTF Bites:

    Finally, a phone that can last more than one day

    My year-old S9+ habitually does two.



  • @TimeBandit And somehow they still managed to make the camera stick out.



  • @PleegWat said in WTF Bites:

    My year-old S9+ habitually does two.

    You're not using it to browse WTDWTF 🍹


  • Java Dev

    @TimeBandit Why would I post to a forum on a tiny screen with an even tinier on-screen keyboard when I've got a pair of 24" monitors and a full keyboard and mouse right in front of me?



  • @Gąska Well, leaving the job out of the kernel makes sense. This way you can implement your own dynamic loader with its own rules and Linux will be happy to run it.

    However having to specify the entire path to the loader in the file is pretty stupid.


  • Discourse touched me in a no-no place

    @boomzilla said in WTF Bites:

    @topspin said in WTF Bites:

    @boomzilla Sounds like you got front page material here. 🏆

    Front what now?

    5d91a2aa-065d-45d1-b573-ef9416a30727-image.png
    Obligatory.


  • ♿ (Parody)

    @loopback0 said in WTF Bites:

    @boomzilla said in WTF Bites:

    @topspin said in WTF Bites:

    @boomzilla Sounds like you got front page material here. 🏆

    Front what now?

    5d91a2aa-065d-45d1-b573-ef9416a30727-image.png
    Obligatory.

    Does it run Linux?


  • Considered Harmful

    @TimeBandit Mine lasts four usually.


  • Discourse touched me in a no-no place

    @boomzilla said in WTF Bites:

    @loopback0 said in WTF Bites:

    @boomzilla said in WTF Bites:

    @topspin said in WTF Bites:

    @boomzilla Sounds like you got front page material here. 🏆

    Front what now?

    5d91a2aa-065d-45d1-b573-ef9416a30727-image.png
    Obligatory.

    Does it run Linux?

    Did anything run Linux in 2002?


  • Java Dev

    @loopback0 said in WTF Bites:

    @boomzilla said in WTF Bites:

    @loopback0 said in WTF Bites:

    @boomzilla said in WTF Bites:

    @topspin said in WTF Bites:

    @boomzilla Sounds like you got front page material here. 🏆

    Front what now?

    5d91a2aa-065d-45d1-b573-ef9416a30727-image.png
    Obligatory.

    Does it run Linux?

    Did anything run Linux in 2002?

    I hear they had a command line interface.


  • BINNED

    @PleegWat said in WTF Bites:

    @PleegWat

    And then there's this little tidbit about how the ldd utility works:

    $ ldd /bin/ls
    	linux-vdso.so.1 =>  (0x00007fff59d68000)
    	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fec384c4000)
    	libcap.so.2 => /lib64/libcap.so.2 (0x00007fec382bf000)
    	libacl.so.1 => /lib64/libacl.so.1 (0x00007fec380b5000)
    	libc.so.6 => /lib64/libc.so.6 (0x00007fec37ce8000)
    	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fec37a86000)
    	libdl.so.2 => /lib64/libdl.so.2 (0x00007fec37881000)
    	/lib64/ld-linux-x86-64.so.2 (0x000055f4895ce000)
    	libattr.so.1 => /lib64/libattr.so.1 (0x00007fec3767c000)
    	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fec37460000)
    $ LD_TRACE_LOADED_OBJECTS=1 /bin/ls
    	linux-vdso.so.1 =>  (0x00007ffdc7bfd000)
    	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f868c121000)
    	libcap.so.2 => /lib64/libcap.so.2 (0x00007f868bf1c000)
    	libacl.so.1 => /lib64/libacl.so.1 (0x00007f868bd13000)
    	libc.so.6 => /lib64/libc.so.6 (0x00007f868b946000)
    	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f868b6e4000)
    	libdl.so.2 => /lib64/libdl.so.2 (0x00007f868b4e0000)
    	/lib64/ld-linux-x86-64.so.2 (0x00007f868c348000)
    	libattr.so.1 => /lib64/libattr.so.1 (0x00007f868b2db000)
    	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f868b0bf000)
    

    And wasn’t there some related security vulnerability if you run ldd on statically linked binaries or something like that?

    EDIT: yeah, basically you can get ldd to execute arbitrary code with a custom loader.



  • @PleegWat said in WTF Bites:

    I hear they had a 12 command line interface.

    FTFY

    In typical Open Source fashion, you had multiple choices, and all of them were partly done 🍹



  • @anonymous234 said in WTF Bites:

    a17510c4-29c2-44ea-bee3-1af95865b987-image.png

    Well someone didn't test their shit even once.

    Update: I might have been looking in the wrong place
    00ecd0ee-8611-4dea-9499-19455221f2a8-imatge.png


  • Banned

    @anonymous234 I like how the message suggests you can use vsdbg in other ways if you don't care about helping you develop and test your application.



  • :facepalm:



  • @TimeBandit

    The HOA responded it would not pursue the charge, due to there being no by-laws to support it.

    Which implies that they'd have been just fine going for it if there was an at least marginally related bylaw.



  • @Rhywden said in WTF Bites:

    @TimeBandit

    The HOA responded it would not pursue the charge, due to there being no by-laws to support it.

    Which implies that they'd have been just fine going for it if there was an at least marginally related bylaw.

    Odds that there is now?



  • alignment behind the scenes.jpg




    alignment.jpg


  • Considered Harmful

    @r10pez10 is this loss



  • FFS. The game weights in at roughly 50GB, this was after the update errored (paused?) due to insufficient space on the drive.

    5f221607-14d8-43fe-828c-930b9f728fac-image.png

    If it's downloading the whole damn thing again, couldn't they just delete the old version first? And if it isn't downloading the whole damn thing, what the hell is it doing?


  • Considered Harmful

    @cvi for all the things I hate about Origin, I am appreciative of the fact that you can usually play games while they're downloading, whether for the first time or for updates. This is a consequence.


  • Discourse touched me in a no-no place

    @loopback0 said in WTF Bites:

    @boomzilla said in WTF Bites:

    @topspin said in WTF Bites:

    @boomzilla Sounds like you got front page material here. 🏆

    Front what now?

    5d91a2aa-065d-45d1-b573-ef9416a30727-image.png
    Obligatory.

    I spotted this in the wild while looking into one of the applications that sits under my team.

    839d74f8-6531-4d0f-9e41-a43492dc9ff7-image.png


  • Considered Harmful

    @cvi
    Yep. I installed it yesterday evening. Today it got an update. It said 3.05 GB. Oh fine, get on with it then. Wait no, not fine at all! Apparently it made a copy of every goddamn game file (and also promptly ran out of space... twice, before I moved everything off my poor little 120 GB drive), did some binary patching for freaking 15 minutes and then went back to normal.

    Anyway, played it a bit over 2 hours on my trial (up to much crafting wow), couldn't paint my Irn Man suit orange-blue and off the fuck it went. The environments are pretty, but that's all there is to it. Glorified tech demo. Not my type of things at all.



  • @pie_flavor said in WTF Bites:

    @cvi for all the things I hate about Origin, I am appreciative of the fact that you can usually play games while they're downloading, whether for the first time or for updates. This is a consequence.

    I'd rather wait the 15 extra minutes and avoid having to clear stuff of my drive. If it were a trivial amount (a GB here or there), I wouldn't care. But 40+GB is a bit much. Also, this time around, I didn't get the option to play while updating (I've seen it other times).

    @Applied-Mediocrity said in WTF Bites:

    Anyway, played it a bit over 2 hours on my trial (up to much crafting wow), couldn't paint my Irn Man suit orange-blue and off the fuck it went. The environments are pretty, but that's all there is to it. Glorified tech demo. Not my type of things at all.

    Yeah, I agree. It's pretty. The gameplay isn't bad (in term of the mechanics), just not very interesting -- it's very repetitive. Not very challenging either (maybe if you unlock the higher levels? But those are rather far off).



  • @boomzilla said in WTF Bites:

    @DogsB said in WTF Bites:

    @boomzilla holy fuck where did this file come from? Was it generated?

    Yes, generated. By idiots.

    It's basically a calendar that started on September 1st 2016 and goes to...sometime in the future. Every week day has 4 columns.

    Let me guess... In, Out to Lunch, Back from Lunch, Out.

    That's a nice timesheet system they've got there. 'd be a shame if anything were to happen to it...



  • @brie Hey, that's my timesheet system. Except, sensibly, each day is its own row, not adding more and more columns.



  • I am working on a project where I need to integrate a bunch of components from different departments.

    Because one of the key teams still didn't get to even start, we were delivered a stub implementation (i.e. implements the same interface as the real thing, but just a tiny bit of the actual functionality) for that interface. From a department in India.

    It was returning an error. It took me a couple of days to set up debugger properly (this is the first time I am working with Yocto, and the debug libraries are too big, so I needed remote debugging). Anyway, yesterday I managed to trace it. There is a function

    Result createSocket(LinkType type, const LinkParams *params, Handle *handle)
    

    The third parameter is an output one, and properly documented as such. So you call it like

    Handle handle;
    if (OK == createSocket(type, params, &handle) {
        doSomethingWith(handle); …
    }
    

    However inside the function (three levels deep in a helper) what happens is

    arrayOfHandles[i].theHandle = handle.
    

    arrayOfHandles is a global array, and the theHandle member is declared as Handle *theHandle.

    See, no dereference. No setting either. Instead of pulling a handle out of a hat and storing it in the provided location, it uses that location as a handle. Of course when the next function tries to do something on the socket, it can't be found…

    Anyway, I guess I could have stopped after the word “India”…


  • Discourse touched me in a no-no place

    C:\ had 5.6GB free. Windows says it can clean up 11.5GB of Windows Update stuff. 10.9GB free. Windows now says it can clean up 8.95GB of System Error Reporting files. 12.4GB free.



  • WTF of my day: So, we've had to search for an alternative to WhatsApp for communicating with our pupils and were sold on a similar solution which promised more stringent data protection, encryption and whathaveyou.

    Nevermind that no one on their end seemingly had a thought on how to actually manage more than 10 users (let's just say that creating new users isn't done in the least possible steps) but we also have this, fresh in from today:

    3d79bca1-5212-41f5-aeac-4e42048a3880-image.png

    This is an excerpt from a chat between me and my superior - to the right are my messages.

    You'll note that there are some duplicates. In fact, his message from 11:49 is duplicated about 40 times. And no, it's just not a client issue, I have this duplication on my iPhone, my iPad and the browser client.

    Next, my message from 12:22h? I sent that one at 09:30h. The first one at 12:31h was actually sent at 12:40h, the next one is a duplicate from before and the last one was actually sent at 12:31h.

    Jesus Christ.


  • ♿ (Parody)

    @brie said in WTF Bites:

    @boomzilla said in WTF Bites:

    @DogsB said in WTF Bites:

    @boomzilla holy fuck where did this file come from? Was it generated?

    Yes, generated. By idiots.

    It's basically a calendar that started on September 1st 2016 and goes to...sometime in the future. Every week day has 4 columns.

    Let me guess... In, Out to Lunch, Back from Lunch, Out.

    That's a nice timesheet system they've got there. 'd be a shame if anything were to happen to it...

    No.



  • @HardwareGeek said in WTF Bites:

    @brie Hey, that's my timesheet system. Except, sensibly, each day is its own row, not adding more and more columns.

    I was assuming that rows were employees.

    Really it wouldn't be an outrageously terrible system if two conditions were met: hard copies of everything, and instead of going to infinity and beyond, it should be split up - one month per sheet, twelve sheets (one year) per workbook.



  • @Rhywden said in WTF Bites:

    Jesus Christ.

    Status: Still looking for a replacement.


  • Notification Spam Recipient

    @dcon said in WTF Bites:

    @Rhywden said in WTF Bites:

    Jesus Christ.

    Status: Still looking for a replacement.

    I heard a cow is an excellent substitute.



  • @Tsaukpaetra said in WTF Bites:

    I heard a cow is an excellent substitute.

    To veggie burgers


  • Banned

    @dcon said in WTF Bites:

    @Rhywden said in WTF Bites:

    Jesus Christ.

    Status: Still looking for a replacement.

    https://youtube.com/watch?v=u1xrNaTO1bI



  • @Rhywden So I took a look at some contenders which proclaimed offer self-hosting (data privacy and all that jazz, after all, we can't very well proclaim to replace WhatsApp and promptly hand over data to someone else in turn), namely Matrix.org and XMPP.

    Well, Matrix.org is something where you cannot see anyone else without joining their "federation", at least not in the default settings or any kind of setting I could easily discover. So you joined a chat program but cannot chat to anyone but yourself. Yay. Also, their mobile client for Android and iOS is called "Riot" (very professional!) and has different capability levels. For instance, on the Android client I can upload pictures, videos and files. On iOS? Only pictures and videos. But I can access files if they were uploaded through an Android client.
    I'm not sure why uploading files is such a horrendous problem compared to photos. And, of course, we have the professional level "let's navigate the app to this white screen with no way to navigate back!" options which I found twice throughout the app.

    So, that one's a no-go.

    And then there's XMPP. Well, the first server I installed (Prosody) told me that it was running but did not let anyone connect to it. Ports were open, SSL configured correctly, the logs said: "Okay! Everything is fine!" but the clients said: "Nay."

    Which is where I found one of those XMPP clients to be a massive PITA. Because if you get something wrong (or the server is unreachable or something) you'll be presented with an obnoxious error message. Repeated in 3 second intervals (at least non-blocking, but seriously!) ad infinitum.

    Okay, scratch that one, on to EJabberd. Installed fine, the clients were also able to connect. Soooo. Where are the users? Yeah, turns out that you have to fill your contact list manually or something. Though there may be a way to allow contact queries. But I wasn't able to make heads or tails out of their configuration scheme for the access rights.

    So I may be forced to implement our own chat solution. Thankfully, the user administration and access levels side is already solved, I just need to connect to our local LDAP and get the stuff from there. I'll have a look at databases which have some kind of Pub/Sub scheme in there to facilitate the chat part. Basically that app only needs four pages - one for the contact list, one for the (group) chats, one for settings and a login page.


  • Considered Harmful

    @Rhywden Imagine a school-wide Discord server. Or Slack if you've got that self-hosting boner.


Log in to reply