WTF Bites


  • Notification Spam Recipient

    @DCoder said in WTF Bites:

    preload this much garbage?

    And here I was complaining when our site loaded a 10mb static background image....


  • Banned

    It's been like 30 years already and GNU Make still hasn't figured out that a single command can produce multiple files.



  • @Gąska yeah, there is some workaround involving chained dependencies and probably some order-only dependencies that is considered good enough… I think it is documented in the manual, but don't see it quickly.


  • Banned

    @Bulb I've tried to look it up yesterday. I've found a bunch of workarounds, but each of them has a serious drawback. It's a "pick your poison" situation with no good answer.

    • Make the generated files form a dependency chain: this runs the generator N times, where N is number of generated files.
    • Make wildcard rule: requires all generated files to have a single and distinct prefix/suffix, which might not always be possible (it's not in my case).
    • Make a single dummy target that runs the generator instead of listing generated files: disables incremental compilation for everything that depends on generated files.
    • Only make rules for one of the generated files and ignore the rest: changes in generated files won't always trigger rebuild (especially when the generator is smart enough not to overwrite files when the content wouldn't change,
    • Use Sun Make: not available for Cygwin.

    In the end, I think I'll just extract it outside makefile and just remember to regenerate the files manually.



  • @Gąska when you make the generated files form a dependency chain, you don't need to run the generator N times. You run it just one time and make the command in the remaining rules just true, because the files are already generated. But you may also need to carefully add some order-only dependencies (after |) and I am not sure how it works.

    It might be also interesting to look what cmake generates from a custom command with BYPRODUCTS. But the documentation seems to say that nothing, actually (except on Ninja, which both supports them and actually requires having them declared).


  • Java Dev

    @Gąska I've got a case where a script generates both a .h and a .c from a .txt. The makefile rule is from the TXT file to the C file; the H file depends on the C file with an empty action. This hasn't caused me any problems, but we don't use parallel compiles.


  • Banned

    @Bulb @PleegWat I'll try doing that. It might just happen to work. Thank you both!


  • Discourse touched me in a no-no place

    @Gąska said in WTF Bites:

    GNU Make still hasn't figured out that a single command can produce multiple files

    This sort of thing?

    $ cat Makefile
    .PHONY: all
    
    all: file1 file2
    
    scrub:
            rm -f file1 file2
    
    file1 file2:
            touch file2 file1
    
    $ make scrub
    rm -f file1 file2
    
    $ make
    touch file2 file1
    
    $ make
    make: Nothing to be done for 'all'.
    
    $ make --version
    GNU Make 4.2.1
    Built for x86_64-pc-linux-gnu
    Copyright (C) 1988-2016 Free Software Foundation, Inc.
    Licence GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    

  • Banned

    @PJH

    $ make -j2
    touch file2 file1
    touch file2 file1
    

  • Discourse touched me in a no-no place

    @Gąska ah, gotcha.


  • ♿ (Parody)

    Just spied this comment in a recent svn commit:

    changes to support electron


  • Discourse touched me in a no-no place

    IE blocking its own "Page cannot be displayed" page.

    471f67bf-a6e2-4289-9045-8e50b9f4d8a2-image.png


  • Notification Spam Recipient

    @loopback0 said in WTF Bites:

    IE blocking its own "Page cannot be displayed" page.

    471f67bf-a6e2-4289-9045-8e50b9f4d8a2-image.png

    I noticed that. Thought it was hilarious.

    Isn't Windows Server amazing?



  • @Tsaukpaetra said in WTF Bites:

    Isn't Windows Server amazing?

    In an absurd sense, YES!


  • Banned

    Now here is an example of a naive way of using wildcard expansion, that does not do what you would intend. Suppose you would like to say that the executable file foo is made from all the object files in the directory, and you write this:

    objects = *.o
    
    foo : $(objects)
            cc -o foo $(CFLAGS) $(objects)
    

    The value of objects is the actual string ‘*.o’. Wildcard expansion happens in the rule for foo, so that each existing ‘.o’ file becomes a prerequisite of foo and will be recompiled if necessary.

    But what if you delete all the ‘.o’ files? When a wildcard matches no files, it is left as it is, so then foo will depend on the oddly-named file *.o. Since no such file is likely to exist, make will give you an error saying it cannot figure out how to make *.o. This is not what you want!

    Exactly. This is not what I want. This is not what anybody wants. Why the hell does it work like that? What kind of masochist has come up with that stupid antifeature!?



  • :headdesk: :facepalm:


  • BINNED

    @Gąska I knew there where going to be posts here when you wrote "learning to write makefiles". Makefiles are idiotic.



  • @loopback0 said in WTF Bites:

    IE blocking its own "Page cannot be displayed" page.

    471f67bf-a6e2-4289-9045-8e50b9f4d8a2-image.png

    And the Internet Explorer Super Enhanced Security Configuration will uninstall IE and tell you to use Edge...


  • BINNED

    @TimeBandit said in WTF Bites:

    :headdesk: :facepalm:

    Cool. Now you can get away with everything: "No, your honor, that wasn't me. My license plate isn't 'SML01 :person_shrugging_light_skin_tone:', it's 'SML01 :person_shrugging_medium_light_skin_tone:'.


  • Banned

    @topspin said in WTF Bites:

    @Gąska I knew there where going to be posts here when you wrote "learning to write makefiles".

    Me too. I hate makefiles with passion. But a man's got to do what a man's got to do.


  • Banned

    @TimeBandit said in WTF Bites:

    :headdesk: :facepalm:

    Further googling leaves me both somewhat relieved and somewhat disappointed. Turns out emojis aren't part of the plate number, you can only have one of them, and it's always in the same place, and there are only five to choose from - which makes it nothing more than a special background design for a regular alphanumeric plate.



  • @Gąska said in WTF Bites:

    you can only have one of them

    That's one too many



  • @Gąska said in WTF Bites:

    you can only have one of them, and it's always in the same place, and there are only five to choose from

    If they allow Unicode modifiers, there's still plenty of fun to be had :trollface:


  • 🚽 Regular

    @Gąska said in WTF Bites:

    Further googling leaves me both somewhat relieved and somewhat disappointed. Turns out emojis aren't part of the plate number, you can only have one of them, and it's always in the same place, and there are only five to choose from - which makes it nothing more than a special background design for a regular alphanumeric plate.

    Or you could have RTFA.

    Edit: added hightlight for clarification


  • BINNED

    @Zecc said in WTF Bites:

    RTFA

    :doing_it_wrong:



  • @Gąska said in WTF Bites:

    Now here is an example of a naive way of using wildcard expansion, that does not do what you would intend. Suppose you would like to say that the executable file foo is made from all the object files in the directory, and you write this:

    objects = *.o
    
    foo : $(objects)
            cc -o foo $(CFLAGS) $(objects)
    

    The value of objects is the actual string ‘*.o’. Wildcard expansion happens in the rule for foo, so that each existing ‘.o’ file becomes a prerequisite of foo and will be recompiled if necessary.

    But what if you delete all the ‘.o’ files? When a wildcard matches no files, it is left as it is, so then foo will depend on the oddly-named file *.o. Since no such file is likely to exist, make will give you an error saying it cannot figure out how to make *.o. This is not what you want!

    Exactly. This is not what I want. This is not what anybody wants. Why the hell does it work like that? What kind of masochist has come up with that stupid antifeature!?

    It is not an antifeature, just a feature that stopped quarter the way to actual usefulness. They taught it to expand wildcards, but didn't go all the way to teach it to expand them over potential files. It is still somewhat useful as you can do

    SOURCES = $(wildcard *.cpp)
    OBJECTS = $(patsubst %.cpp,%.o,$(SOURCES))
    
    program: $(OBJECTS)
            …
    

    which is still better than poke in the eye.

    There is another implementation, makepp, which does have wildcard expansion over potential files, so in that

    program: *.o
           …
    

    does what you want.

    It is implemented in perl, so it might even work on cygwin…



  • @Gąska said in WTF Bites:

    @topspin said in WTF Bites:

    @Gąska I knew there where going to be posts here when you wrote "learning to write makefiles".

    Me too. I hate makefiles with passion. But a man's got to do what a man's got to do.

    Can't you at least use cmake? It is also full of :wtf:, but code monkeys usually love its ability to generate projects for various IDEs (which is a reason for a lot of its :wtf:ness—builders some IDEs use suck even more than GNU make).

    Generally speaking, I've been looking for a good build system for ages and usually found that in the end one can get shit done in make quicker anyway.


  • Discourse touched me in a no-no place

    @Bulb said in WTF Bites:

    which is still better than poke in the eye

    It's still make, so no, it isn't better than a poke in the eye.


  • Considered Harmful

    @Bulb If I say Gradle I'll get lynched, but I've heard some good things about Meson.


  • Banned

    @Bulb said in WTF Bites:

    @Gąska said in WTF Bites:

    Now here is an example of a naive way of using wildcard expansion, that does not do what you would intend. Suppose you would like to say that the executable file foo is made from all the object files in the directory, and you write this:

    objects = *.o
    
    foo : $(objects)
            cc -o foo $(CFLAGS) $(objects)
    

    The value of objects is the actual string ‘*.o’. Wildcard expansion happens in the rule for foo, so that each existing ‘.o’ file becomes a prerequisite of foo and will be recompiled if necessary.

    But what if you delete all the ‘.o’ files? When a wildcard matches no files, it is left as it is, so then foo will depend on the oddly-named file *.o. Since no such file is likely to exist, make will give you an error saying it cannot figure out how to make *.o. This is not what you want!

    Exactly. This is not what I want. This is not what anybody wants. Why the hell does it work like that? What kind of masochist has come up with that stupid antifeature!?

    It is not an antifeature, just a feature that stopped quarter the way to actual usefulness.

    I meant specifically the "if no files match the wildcard, the asterisk is treated literally" part. There are exactly zero situations where this is even remotely useful. Especially since you can escape the asterisk with backslash if you really want that *.o file.



  • @pie_flavor said in WTF Bites:

    If I say Gradle I'll get lynched

    I'll settle with telling you that since it does not include any checks whether target needs to be remade (it expects each plugin to do its own checks, and starting all the modules usually takes even more time than make looking for all the potential sources using all its obscure built-in rules), it does not really qualify.

    @pie_flavor said in WTF Bites:

    but I've heard some good things about Meson

    Is the release 5 out alrea… hm, I probably got it mixed up with something; the current release is 0.50.

    It does look like a saner reimplementation of the cmake idea. Might be worth something.

    @Gąska said in WTF Bites:

    I meant specifically the "if no files match the wildcard, the asterisk is treated literally" part. There are exactly zero situations where this is even remotely useful.

    Oh, that. That is just the standard behaviour of wildcards that don't match anything. They behave the same way in shell.

    And I would dispute its uselessness. In this particular case it makes it error out earlier if you try to use the missing part of the feature, which is a good thing more than bad.


  • Banned

    @Bulb said in WTF Bites:

    @Gąska said in WTF Bites:

    I meant specifically the "if no files match the wildcard, the asterisk is treated literally" part. There are exactly zero situations where this is even remotely useful.

    Oh, that. That is just the standard behaviour of wildcards that don't match anything. They behave the same way in shell.

    MAKEFILE IS NOT SHELL!!!

    And I would dispute its uselessness. In this particular case it makes it error out earlier if you try to use the missing part of the feature, which is a good thing more than bad.

    Missing part of what feature? Wildcards themselves are only ever useful if you don't even know what files you want to find. If you knew, you'd just put it right there in makefile by full name.



  • @Gąska said in WTF Bites:

    MAKEFILE IS NOT SHELL!!!

    But they are both standard Un:wtf:x t🤮🤮ls… Yay for consistency.

    @Gąska said in WTF Bites:

    Wildcards themselves are only ever useful if you don't even know what files you want to find. If you knew, you'd just put it right there in makefile by full name.

    … which you are told to do anyway, yes.


  • Discourse touched me in a no-no place

    @boomzilla said in WTF Bites:

    Just spied this comment in a recent svn commit:

    changes to support electron

    ?

    5def093d-3289-4e28-8e9d-ab7b73cb3ba0-image.png


  • Discourse touched me in a no-no place

    @PJH changes to support general fermions (not just electron, but also muon and tau)


  • Discourse touched me in a no-no place

    @dkf said in WTF Bites:

    @PJH changes to support general fermions (not just electron, but also muon and tau)

    I think you may be confusing fermions with leptons, if you're only specifying µ and 𝜏 as the only extra support. :pendant:


  • Discourse touched me in a no-no place

    @PJH As long as they implement the Fermion class, it's cool…



  • Minor WTF: Playing some Anthem. Runs fine (if you've got the game installed on an NVMe connected SSD otherwise the loading screens take a while).

    Then the server seems to have gone down because mid-mission I get a prominent: "Connection lost. Searching for server" popup plastered into the middle of the screen.

    After three minutes that message is still there. What is not there: A way to cancel this search and/or an obvious way to quit the game.

    Seems that they forgot to add a timeout-routine there. Nothing that Alt-F4 couldn't fix though.



  • Ctrl-Shift-Esc to the rescue?



  • @Zecc said in WTF Bites:

    Or you could have RTFA.

    :rofl:
    :barrier: 📮 and :kneeling_warthog:



  • @TimeBandit said in WTF Bites:

    @Gąska said in WTF Bites:

    you can only have one of them

    That's one too many

    Without it, you'd have to settle for using the actual background of the license plate to hide your offensive message.

    d8e2cdf1-59d0-4e39-a4eb-29dd59158b79-image.png



  • @Rhywden Do us normal plebs get to play it yet? I'd go check the launch schedule, but I've had enough of lengthy tables for one day...


  • Banned

    @cvi today was the release.



  • In other words, a change intended to prevent scripts from being passed to the wrong interpreter caused the system to start passing scripts to the wrong interpreter.

    With a bonus Perl sighting!

    76e6935f-c840-49d1-91f8-4518066f0216-image.png

    Source: @velartrill


  • Discourse touched me in a no-no place

    @DCoder Having read quite a lot of what was going on, TRWTF is NixOS. Though Perl is a close second.


  • BINNED

    @DCoder said in WTF Bites:

    In other words, a change intended to prevent scripts from being passed to the wrong interpreter caused the system to start passing scripts to the wrong interpreter.

    With a bonus Perl sighting!

    76e6935f-c840-49d1-91f8-4518066f0216-image.png

    Source: @velartrill

    This has a hunch of “Broken Arrow” to it. How often do Perl scripts have broken she-bang lines that they decided to implement this feature? :wtf:


  • Banned

    @topspin said in WTF Bites:

    How often do Perl scripts have broken she-bang lines that they decided to implement this feature? :wtf:

    Most likely once in the lead developer's entire life.


  • Discourse touched me in a no-no place

    @Gąska said in WTF Bites:

    Most likely once in the lead developer's entire life.

    Alas, it was a feature of even early Perl, and that was because the limit on line lengths of #! lines was something like 32 bytes (including the #! itself) on some commercial unixes. That's quite easy to hit even with sane directory name lengths.

    But it being Perl, the fix was far more :wtf: than you'd expect. Except if you've seen Larry Wall's work in other areas too.


  • Banned

    @dkf well, I can't think of any other way it could be done. Of course TRWTF is the entire idea of shebangs.


  • Discourse touched me in a no-no place

    @Gąska said in WTF Bites:

    I can't think of any other way it could be done.

    The main other technique is to launch a small shell script that relaunches with the right interpreter and arguments.


Log in to reply