WTF Bites


  • BINNED

    As mentioned over :arrows: I'm currently dabbling with apps for the TV and the insanity that "web devs" produce.
    The size of the final (compressed) artifact:

    topspin@macbook:~/webos_app$ ll
    -rw-r--r--@ 1 topspin  staff   375K  3 Apr 15:44 youtube.leanback.v4_0.3.1_all.ipk
    

    The unpacked archive mostly contains two "compiled" js files totaling about 1MB:

    root@LGwebOSTV:/media/developer/apps/usr/palm/applications/youtube.leanback.v4# ls -lh . webOSUserScripts
    .:
    total 704
    -rwxrwxrwx    1 1001     121         1.1K Apr 16 13:24 appinfo.json
    -rwxrwxrwx    1 1001     121          838 Jan 27 16:37 icon.png
    -rwxrwxrwx    1 1001     121         2.9K Jan 27 16:37 icon.svg
    -rwxrwxrwx    1 1001     121           87 Jan 27 16:37 index.html
    -rwxrwxrwx    1 1001     121       354.6K Jan 27 16:37 index.js
    -rwxrwxrwx    1 1001     121       321.2K Jan 27 16:37 index.js.map
    -rwxrwxrwx    1 1001     121         1.2K Jan 27 16:37 largeIcon.png
    drwxrwxrwx    2 1001     121         4.0K Jan 27 16:37 webOSUserScripts
    
    webOSUserScripts:
    total 1264
    -rwxrwxrwx    1 1001     121       621.4K Apr 16 22:50 userScript.js
    -rwxrwxrwx    1 1001     121       637.1K Jan 27 16:37 userScript.js.map
    

    The source from which it all of this is built is about 100K.

    Now let's try to build from source:

    topspin@macbook:~/webos_apps/devel/youtube-webos$ npm install
    
    > youtube-webos@0.3.1 prepare
    > husky install
    
    husky - Git hooks installed
    
    added 957 packages, and audited 958 packages in 12s
    
    64 packages are looking for funding
      run `npm fund` for details
    
    16 vulnerabilities (6 moderate, 9 high, 1 critical)
    
    To address issues that do not require attention, run:
      npm audit fix
    
    Some issues need review, and may require choosing
    a different dependency.
    
    Run `npm audit` for details.
    
    topspin@macbook:~/webos_apps/devel/youtube-webos$ du -hd 1
     16K	./.husky
     12K	./tools
    264K	./screenshots
    172M	./node_modules
     12K	./.github
    712K	./.git
    8,0K	./.vscode
     16K	./assets
    136K	./src
    174M	.
    

    Holy fucking fuck. What is all this shit? :wtf:
    200 MB, 16 (known) vulnerabilities, all for what's basically a user script around youtube to apply a filter list.


  • Discourse touched me in a no-no place



  • @topspin Is it a typescript project? That' alone is 61 MB. And google's SDK libraries total to another 50 MB or so. Plus all the transitive dependencies and heaven forfend you have to have two different versions of a big library because there're incompatible version specs...basically npm sucks.


  • BINNED

    @Benjamin-Hall said in WTF Bites:

    @topspin Is it a typescript project? That' alone is 61 MB.

    No, I don't think so.
    It's really just a thin wrapper around youtube to include sponsorblock.

    And google's SDK libraries total to another 50 MB or so. Plus all the transitive dependencies and heaven forfend you have to have two different versions of a big library because there're incompatible version specs...basically npm sucks.

    Yeah, I guess it's all leftpad and its transitive dependencies, because leftpad is apparently Turing complete. 🐠



  • @topspin The way to check is to cd into node_modules and run du -hd 1 | sort -h.

    My main node project has the following as the biggest dependencies:

    1.1M ./mysql2
    1.1M ./ts-node
    1.2M ./gray-matter
    1.2M ./marked-toc
    1.4M ./globule
    1.5M ./firebase-admin
    1.8M ./node-forge
    2.3M ./@types
    2.4M ./@grpc
    2.8M ./template
    3.8M ./tslint
    4.9M ./lodash
    4.9M ./mocha
    5.1M ./moment
    6.5M ./@google-cloud
    6.5M ./protobufjs
    11M ./google-gax
    13M ./@firebase
    61M ./typescript

    Of which

    • Typescript (dev only)
    • firebase-admin
    • marked-toc (dev only)
    • mysql2
    • mocha (dev only)
    • and ts-node (dev only)

    are top-level dependencies. The remaining 95.3 MB (165 MB total) are transitive dependencies.


  • BINNED

    @Benjamin-Hall huh, interesting results

    5,6M	./webpack
    7,0M	./@babel
    9,5M	./core-js-pure
     11M	./rxjs
     20M	./prettier
     73M	./@webosose
    

    Last one is "webOS Open Source Edition", i.e. the OS. Which kind of makes sense, but then also doesn't. Maybe less of a WTF than I thought, but I still don't see why it needs that to build the site. 🤷♂

    ETA: it’s still 950 packages with 16 vulns, so there’s that.


  • Discourse touched me in a no-no place

    @topspin said in WTF Bites:

    I'm currently dabbling with apps for the TV and the insanity that "web devs" produce.

    I assume you've rooted your TV rather than using the developer mode which seems to only last 50 hours?

    edit: I discovered the RootMyTV site and now it's rooted with the webOS Homebrew Channel


  • BINNED

    @loopback0 said in WTF Bites:

    @topspin said in WTF Bites:

    I'm currently dabbling with apps for the TV and the insanity that "web devs" produce.

    I assume you've rooted your TV rather than using the developer mode which seems to only last 50 hours?

    Yes I did.
    Now that I have an app and an SDK I just got curious enough to play around.

    So far I’ve used the “babby’s first app” template to build an app with a button that turns off the screen. Wanted to integrate that into YouTube, but haven’t got it working yet.


  • Discourse touched me in a no-no place

    @topspin for now I just wanted the Youtube app with adblock. The Youtube app for TV is still less annoying than desktop or mobile with ads but it's getting worse.
    I didn't even realise homebrew apps or rooting was a thing for WebOS until your post so thanks.


  • BINNED

    @loopback0 said in WTF Bites:

    @topspin for now I just wanted the Youtube app with adblock. The Youtube app for TV is still less annoying than desktop or mobile with ads but it's getting worse.
    I didn't even realise homebrew apps or rooting was a thing for WebOS until your post so thanks.

    I haven’t really looked into the other apps yet. “Fuck ads” is a really strong motivator, I got to say. (Rooting is really simple though, just visit the website and confirm.)

    The “home brew” alternative app store (and additional repos you can configure) has a few other apps, some of which might be interesting (retro arch, some streaming stuff), but the number of apps is actually pretty small.


  • Discourse touched me in a no-no place

    @topspin said in WTF Bites:

    (retro arch, some streaming stuff)

    Doom, natch.
    I haven't tried it as I can't imagine it not sucking with either a TV remote or the LG app.


  • BINNED

    @loopback0 said in WTF Bites:

    @topspin said in WTF Bites:

    (retro arch, some streaming stuff)

    Doom, natch.
    I haven't tried it as I can't imagine it not sucking with either a TV remote or the LG app.

    The remote would be dumb. Maybe a Bluetooth controller works though.


  • Considered Harmful

    @aitap empty set? Checks... ✅

    I can't not get no, vacuous satisfaction, nono nono nono

    I don't try... I don't try... I don't try!



  • Assertion `inputw > 0 && std::uint32_t(inputw) == width' failed.
    Input: 516 x 384, expected: 517 x 384

    OK ...
    $ rm scaled.png
    $ convert original.png -resize 517x384 scaled.png

    (rerun application)

    ...
    Assertion `inputw > 0 && std::uint32_t(inputw) == width' failed.
    Input: 516 x 384, expected: 517 x 384

    :wtf:

    $ file scaled.png
    scaled.png: PNG image data, 516 x 384, 8-bit/color RGB, non-interlaced

    :sideways_owl:

    $ rm scaled.png
    $ convert original.png -resize 517x384 scaled.png
    $ file scaled.png
    scaled.png: PNG image data, 516 x 384, 8-bit/color RGB, non-interlaced

    💢



  • @cvi The off-by-one thread is :arrows:
    :arrows:


  • Notification Spam Recipient

    @cvi Have you tried 518x384?


  • BINNED

    @cvi said in WTF Bites:

    expected: 517 x 384

    butwhy.png



  • @Vault_Dweller said in WTF Bites:

    @cvi Have you tried 518x384?

    $ convert original.png -resize 518x384 test.png
    $ file test.png
    test.png: PNG image data, 516 x 384, 8-bit/color RGB, non-interlaced

    I suspect convert (ImageMagick) is trying to be "smart" (for rather suspicious values of "smart"). I hate it when tools try to be smart.

    @topspin said in WTF Bites:

    butwhy.png

    One quarter (integer division with truncation) of the original image. It's for use in a mipmap hierarchy, so dimensions are based off the base level's size. Original image wasn't created by me, so who knows how ${whoever} came up with those dimensions. I guess I could rescale that one, but :kneeling_warthog:. And I'd rather like the various tools I use to do what i tell them to.



  • @cvi said in WTF Bites:

    I suspect convert (ImageMagick) is trying to be "smart"

    That's exactly what's happening, it's trying to preserve aspect ratio. You have to shout at it so that it wouldn't try anything: -resize 517x384!



  • @aitap said in WTF Bites:

    -resize 517x384!

    TIL. 👍

    I still think that ImageMagick is being retarded with this. If I cared about aspect ratio that much, I'd have given it a resolution that maintained aspect ratio... 🤷



  • @cvi said in WTF Bites:

    If I cared about aspect ratio that much, I'd have given it a resolution that maintained aspect ratio

    The primary use-case it was designed for is creating thumbnails. Which is precisely the case where you want to scale down to whatever fits some box, preserving aspect ratio. So you tell it something like -resize 128x128 and it will scale all the images, usually of varying sizes, so that they fit in 128x128 boxes.

    The documentation should be quite a lot clearer in describing what it actually does.



  • … colleague just complained that IDEA crashes for him after upgrade to 2022.1.

    … apparently JetCrawlBrain knew it before release, and released it anyway: https://youtrack.jetbrains.com/issue/JBR-4351/JVM-crash-(SIGSEGV-in-JBR)-at-libobjc.A.dylib-(objc_release-objc


  • ♿ (Parody)

    @Vault_Dweller said in WTF Bites:

    @cvi Have you tried 51820x384?

    :3px:



  • @Bulb said in WTF Bites:

    The documentation should be quite a lot clearer in describing what it actually does.

    Well, that would kinda imply reading the documentation in the first place. I just wanted to resize an image. 😢


  • I survived the hour long Uno hand

    @cvi said in WTF Bites:

    @Bulb said in WTF Bites:

    The documentation should be quite a lot clearer in describing what it actually does.

    Well, that would kinda imply reading the documentation in the first place. I just wanted to resize an image. 😢

    Don’t worry, you’re on the perfect site for outsourcing your documentation reading!



  • @cvi said in WTF Bites:

    Well, that would kinda imply reading the documentation in the first place.

    … since it's command-line, you need to look up the option name. If it said right there “By default maintains aspect ratio. Add ! to size if you don't want that.” right on the option, there is some chance you'd notice it.



  • @Bulb Yeah fair. Still think it shouldn't do that by default.



  • @cvi This is the kind of case where both ways are common, so someone will be surprised either way. It would probably be best if it was explicit both ways, but you know, histerical raisins.



  • … also, the manual page of ImageMagick does not seem to have the section about geometry at all. :trwtf:


  • I survived the hour long Uno hand

    @Bulb said in WTF Bites:

    … also, the manual page of ImageMagick does not seem to have the section about geometry at all. :trwtf:

    :phb: This is an open source project, why are you wasting your contrib time on documentation. Nobody reads that anyway, and I’m not paying to support your open source habits for something nobody will see.



  • @izzion Well, they do have the documentation. Just not in the appropriate format.



  • @Bulb said in WTF Bites:

    Just not in the appropriate format.

    That's what you have the convert tool for. :thonking:


  • Considered Harmful

    @Bulb said in WTF Bites:

    This is the kind of case where both ways are common

    Common = the way I want at the moment
    Uncommon = everything else


  • Fake News

    @Bulb said in WTF Bites:

    The documentation should be quite a lot clearer in describing what it actually does.

    Now I see what @aitap meant with the shouting (highlight mine):

    size General description
    widthxheight Maximum values of height and width given, aspect ratio preserved.
    widthxheight^ Minimum values of width and height given, aspect ratio preserved.
    widthxheight! Width and height emphatically given, original aspect ratio ignored.

  • Considered Harmful

    @JBert uh, also shout is a canonical noncanon name for ! (bang)


  • Trolleybus Mechanic

    I solved another bug which was bothering a certain company for more than 10 years. An estonian GSM modem seemed to hang randomly and refuse to send SMSes until reset. The messages are sent with an AT command (obviously), which returns a reference number for each message. Today I noticed something suspicious: on one device the last message sent correctly was numbered 255. I waited some days until the next device hanged. Yep. 255. Some badly handled integer overflow. Now i'm testing my fix (which just power toggles the modem after 255th message), so I need to bump the counter, like this:

    for x in {1..100}; do 
        echo -e "AT+CMGS=\"+48$MY_NUMBER\"\r\n" > /dev/ttyS1
        sleep 2; 
        echo -e "dupa\032\r\n" > /dev/ttyS1
        sleep 10; 
    done
    
    

    I wonder if the network operator will engage some spam filter eventually. So far it gets delivered.

    There were other problems with this device, including random unannounced resets which resulted in a locked SIM card (despite it being unlocked previously) and some other hangups. It also randomly mixed in "RING" when you called during data transmission (which thankfully isn't used in this application). I somewhat underestimated the amount of work needed to completely fix it. Modems suck.



  • @sebastian-galczynski said in WTF Bites:

    1. Some badly handled integer overflow.

    I was going to say, "8-bit integers in 2022?" but I know 8-bit microcontrollers are still used in low-end embedded applications. But getting 8-bit integer overflow wrong is :headdesk:. Are they writing in assembly, because even the crappiest C compiler should just handle that correctly.


  • ♿ (Parody)

    @sebastian-galczynski said in WTF Bites:

    (which just power toggles the modem after 255th message

    ITAPPMONROBOT rides again!


  • Trolleybus Mechanic

    @HardwareGeek said in WTF Bites:

    I was going to say, "8-bit integers in 2022?" but I know 8-bit microcontrollers are still used in low-end embedded applications. But getting 8-bit integer overflow wrong is . Are they writing in assembly, because even the crappiest C compiler should just handle that correctly.

    I have no idea. The processor inside the modem is ARMv5TE, which is 32-bit. The message reference number is defined in the GSM spec as 8-bit though.


  • BINNED

    @sebastian-galczynski it overflows after only 255 SMS and that happens every once in awhile?
    Doesn’t sound like the whole thing is used much at all.


  • Trolleybus Mechanic

    @topspin said in WTF Bites:

    Doesn’t sound like the whole thing is used much at all.

    It's a monitoring system which only sends alerts when something bad happens.



  • @sebastian-galczynski said in WTF Bites:

    only sends alerts when something bad happens.

    Like sending the 256th alert.



  • @HardwareGeek said in WTF Bites:

    @sebastian-galczynski said in WTF Bites:

    only sends alerts when something bad happens.

    Like not sending the 256th alert.

    FTFY


  • Trolleybus Mechanic

    @dkf said in WTF Bites:

    @topspin said in WTF Bites:

    172M	./node_modules
    

    You're like a little baby. Watch this:

    449M	node_modules/
    

    And it's basically a backend for a not-particularly-complex CRUD, and only about 30% done in my estimation. This actually convinced me to use stored procedures for some basic sanity checks. I just don't trust this... stuff, and its authors.



  • @sebastian-galczynski said in WTF Bites:

    @dkf said in WTF Bites:

    @topspin said in WTF Bites:

    172M	./node_modules
    

    You're like a little baby. Watch this:

    449M	node_modules/
    

    And it's basically a backend for a not-particularly-complex CRUD, and only about 30% done in my estimation. This actually convinced me to use stored procedures for some basic sanity checks. I just don't trust this... stuff, and its authors.

    Why in the world is a backend being built with node? :doing_it_wrong:


  • Trolleybus Mechanic

    @Carnage said in WTF Bites:

    Why in the world is a backend being built with node?

    They wanted "ThE MoDErN StACk", with Apollo GraphQL. Also they hired bootcamp-educated "web developers" for this job. So javascript (typescript to be precise) it is. They spent a year writing the CRUD, and it's still not even close to functional. I know, it's lunacy, you could just use any old ass web framework with CRUD generation to crank it out in a month, but that's apparently not the current thing.



  • @sebastian-galczynski said in WTF Bites:

    @Carnage said in WTF Bites:

    Why in the world is a backend being built with node?

    They wanted "ThE MoDErN StACk", with Apollo GraphQL. Also they hired bootcamp-educated "web developers" for this job. So javascript (typescript to be precise) it is. They spent a year writing the CRUD, and it's still not even close to functional. I know, it's lunacy, you could just use any old ass web framework with CRUD generation to crank it out in a month, but that's apparently not the current thing.

    :facepalm:
    I think the next shit I'll be rewriting in java when the COBOL mainframes run out will be broken as hell npm backends.


  • Trolleybus Mechanic

    @Carnage said in WTF Bites:

    I think the next shit I'll be rewriting in java when the COBOL mainframes run out will be broken as hell npm backends.

    I wonder what will happen to the front-end. Because the SPA they put in front of it is not pretty either. It has all the hallmarks of a modern SPA:
    no backend form validation whatsoever (your username was already in use? fsck you!)
    form submissions failing silently on api errors
    unlinkable views
    broken history / back button behavior
    middle-click on "links" not working, even if they are actual links
    broken state when started from a link other than '/', including a hilarious bug in which a single react component clones itself on every F5, filling all the screen



  • @sebastian-galczynski said in WTF Bites:

    @Carnage said in WTF Bites:

    I think the next shit I'll be rewriting in java when the COBOL mainframes run out will be broken as hell npm backends.

    I wonder what will happen to the front-end. Because the SPA they put in front of it is not pretty either. It has all the hallmarks of a modern SPA:
    no backend form validation whatsoever (your username was already in use? fsck you!)
    form submissions failing silently on api errors
    unlinkable views
    broken history / back button behavior
    middle-click on "links" not working, even if they are actual links
    broken state when started from a link other than '/', including a hilarious bug in which a single react component clones itself on every F5, filling all the screen

    That's just common modern web frontend design.


  • Trolleybus Mechanic

    @Carnage said in WTF Bites:

    That's just common modern web frontend design.

    Not quite. It lacks infinite scroll causing memory leaks. Instead it has broken pagination, which counts records incorrectly if you filter or sort by something in a joined table.


Log in to reply