home.social

#footgun — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #footgun, aggregated by home.social.

  1. You can try this in a terminal:
    ```
    python -c "from unittest.mock import MagicMock; open(MagicMock(), 'w'); print(0)"
    ```

    #Python #MagicMock #footgun

  2. But why didn't the tests fail under pytest?

    pytest wraps, substitutes or otherwise messes with `sys.stdout` enough that fd 1 being dead doesn't cause prints to fail.

    The best part? The method that calls `shutil.copy` is called `_safe_copy`, but it doesn't check whether the values it receives are strings or `Path`s. So it happily passes a `MagicMock` along as the copy destination.

    So yeah, test your tests, and if you call something safe make it at least careful.

    #Python #MagicMock #footgun

  3. Tests started failing when run with unittest, had been running fine with pytest for a while.

    Tests error out with `OSError: [Errno 9] Bad file descriptor`.

    Turns out if you `shutil.copy` something onto a `MagicMock`, you kill `sys.stdout`:

    ```
    from unittest.mock import MagicMock
    import shutil

    m = MagicMock()
    m.__fspath__.__index__() # → 1

    shutil.copy(filename, m)
    [errors omitted]

    print(1) # → OSError: [Errno 9] Bad file descriptor
    ```

    Much head scratching!

    #Python #MagicMock #footgun

  4. okay so: omemo sucks?

    https://github.com/dino/dino/issues/850

    this is basically the same story I've heard everywhere omemo is used: it's extremely hostile towards anyone who wants to back up their messages. forgetful? have multiple computers? fuck you I guess.

    I like XMPP overall but I'm going to be telling all my friends "oh yeah turn that off for any message you don't want to lose forever"

    #xmpp #omemo #wtf #footgun

  5. Python Path is great. Until it isn't.

    Don't try this at home.

    remotePath = Path("data", "stuff")
    pbexec("ssh", HOST, "rm", "-rf", remotePath / "/*")

    The result is disastrous, as it it is:

    ssh homeserver rm -rf /*

    Not run as root, the server's installed software was not accessible, but it proceeded to my home directory before I could stop it and made a mess of it. Luckily nothing terminally lost.

    It should have been remotePath / "*" or, even saner, just remotePath.

    #python #footgun

  6. Zig needs to add a hard copiler error for using spaces for indentation instead of tabs, because it is a #footgun to use a non-flexible indentation, and also for writing too many comments in one place because if you can't read the code to understand, you already have too many #footguns , and you are a bad programmer, and you have to stop programming, as we have stated in zig zen "Focus on code rather than style.
    ", this is not about style. #zig #ziglang #Zigtools #programming #codestyle

  7. Zig needs to add a hard copiler error for using spaces for indentation instead of tabs, because it is a #footgun to use a non-flexible indentation, and also for writing too many comments in one place because if you can't read the code to understand, you already have too many #footguns , and you are a bad programmer, and you have to stop programming, as we have stated in zig zen "Focus on code rather than style.
    ", this is not about style. #zig #ziglang #Zigtools #programming #codestyle

  8. Zig needs to add a hard copiler error for using spaces for indentation instead of tabs, because it is a #footgun to use a non-flexible indentation, and also for writing too many comments in one place because if you can't read the code to understand, you already have too many #footguns , and you are a bad programmer, and you have to stop programming, as we have stated in zig zen "Focus on code rather than style.
    ", this is not about style. #zig #ziglang #Zigtools #programming #codestyle

  9. Zig needs to add a hard copiler error for using spaces for indentation instead of tabs, because it is a #footgun to use a non-flexible indentation, and also for writing too many comments in one place because if you can't read the code to understand, you already have too many #footguns , and you are a bad programmer, and you have to stop programming, as we have stated in zig zen "Focus on code rather than style.
    ", this is not about style. #zig #ziglang #Zigtools #programming #codestyle

  10. Zig needs to add a hard copiler error for using spaces for indentation instead of tabs, because it is a #footgun to use a non-flexible indentation, and also for writing too many comments in one place because if you can't read the code to understand, you already have too many #footguns , and you are a bad programmer, and you have to stop programming, as we have stated in zig zen "Focus on code rather than style.
    ", this is not about style. #zig #ziglang #Zigtools #programming #codestyle

  11. Guess who's about to discover that #microprocessors (and other chips, of course) are in ... well, virtually everything these days?

    cnn.com/2025/08/06/tech/apple-

    100% tariff on imported chips will double manufacturers' costs for what is the most expensive component of many products. Cars have dozens-to-hundreds of MCUs in them now, and effectively none of them are made in the USA.

    Where's that Trump-pissing-into-a-fan meme when you need it...

    #tariff #moron #MangoMussolini #OrangeUtan #FootGun #trade #tech #CPU

  12. Guess who's about to discover that #microprocessors (and other chips, of course) are in ... well, virtually everything these days?

    cnn.com/2025/08/06/tech/apple-

    100% tariff on imported chips will double manufacturers' costs for what is the most expensive component of many products. Cars have dozens-to-hundreds of MCUs in them now, and effectively none of them are made in the USA.

    Where's that Trump-pissing-into-a-fan meme when you need it...

    #tariff #moron #MangoMussolini #OrangeUtan #FootGun #trade #tech #CPU

  13. Guess who's about to discover that #microprocessors (and other chips, of course) are in ... well, virtually everything these days?

    cnn.com/2025/08/06/tech/apple-

    100% tariff on imported chips will double manufacturers' costs for what is the most expensive component of many products. Cars have dozens-to-hundreds of MCUs in them now, and effectively none of them are made in the USA.

    Where's that Trump-pissing-into-a-fan meme when you need it...

    #tariff #moron #MangoMussolini #OrangeUtan #FootGun #trade #tech #CPU

  14. Guess who's about to discover that #microprocessors (and other chips, of course) are in ... well, virtually everything these days?

    cnn.com/2025/08/06/tech/apple-

    100% tariff on imported chips will double manufacturers' costs for what is the most expensive component of many products. Cars have dozens-to-hundreds of MCUs in them now, and effectively none of them are made in the USA.

    Where's that Trump-pissing-into-a-fan meme when you need it...

    #tariff #moron #MangoMussolini #OrangeUtan #FootGun #trade #tech #CPU

  15. Guess who's about to discover that #microprocessors (and other chips, of course) are in ... well, virtually everything these days?

    cnn.com/2025/08/06/tech/apple-

    100% tariff on imported chips will double manufacturers' costs for what is the most expensive component of many products. Cars have dozens-to-hundreds of MCUs in them now, and effectively none of them are made in the USA.

    Where's that Trump-pissing-into-a-fan meme when you need it...

    #tariff #moron #MangoMussolini #OrangeUtan #FootGun #trade #tech #CPU

  16. TIL that interfaces have two different nil values (typed and untyped nil). This is a bit confusing, but I can see the value (jerf.org/iri/post/2957/ argues this and has details).

    But I do not understand the language designers chose to make the "contains a typed nil" case not equal to nil.

    This can make:

    if (x != nil) { x.Foo() }

    cause a segfault (inside Foo) because it gets called with a nil pointer (full code: go.dev/play/p/2SeoJj2Go_l)

    Anyone know the rationale behind this ?

  17. And today, while peeling the #disaster #recovery onion, I found that I had a mild case of self-inflicted #footgun that went unnoticed for months because I didn’t read a certain bit of vendor documentation that I didn’t know about until today because of a link in another vendor’s documentation.

    The fix is not difficult. Many (two? three?) new stories are about to spawn as a result of this discovery.

    #hindsightis2020

  18. D'oh, I just typo'd an "rsync" command and wiped a 2+TB backup instead of updating part of it.

    🤦‍♂️

    At least I didn't nuke the original disk!

    Guess I know what my laptop is going to be up to for the next 6 or so hours. Sigh.

    #doh #rsync #footgun

  19. Pretty please with sugar on top, never, ever do this in Python.

    Don't use a bare `except:` (it catches more than you may think), and especially never use it to silence errors. This makes bug hunting super, super hard. Instead, catch only those exceptions that you _know_ will be raised, and let the rest bubble up.

    #Python #FootGun

  20. oopsie, I forgot to account for the fact that uppercase and lowercase letters are on completely different ranges of ASCII values when doing raw string comparisons 🤦‍♀️
    go.dev/play/p/loDcqejLM9T
    #footgun #programming #golang

  21. omg I spent a stupid amount of time debugging this

    ```go
    switch val {
    case 'option1':
    // code
    default:
    if s1, ok1 := ...; ok1 {
    if s2, ok2 := ...; ok2 {
    if s3, ok3 := ...; ok3 {
    // code

    break // LOL THIS BREAKS THE SWITCH
    }
    }
    }

    // code which I was wondering why this wasn't running
    }
    ```

    my brain lost the fact that it was an `if` statement instead of a `for` loop because it was nested so deep 🙈

    #golang #footgun

  22. my boo just pointed out--isn't the whole thing with Section 230 that the platforms claim no ownership over user-generated content?

    but Stack is claiming that THEY own the content, not the users who contributed it. You're not allowed to delete or edit your own content to prevent their genai bs.

    So does this mean Stack has become liable for its veracity, libelousness, etc..? Nice one if so :-P

    #stackoverflow #enshittification #ugc #footgun

  23. Some days you don’t get your own stuff done, but you do point out to someone else that they have loaded a high-caliber #footgun.

    #Sanitize your input, folks, and jealously guard your #argc and #argv.

  24. @Foritus i love when glory and destruction are just millimeters apart! definitely a . Saving that term for future use.

  25. Don't tell me that Ron Desantis (or his campaign) is the first to come up with the awesome term "Ballistic Podiatry" to mean a "foot gun".

    Regardless, I'll try using the term and see how well it holds up. I mean, how can I not as a fan of C++? 😉

    #usa #gopDebate #footgun #terminology #cpp

  26. @lauren

    A whole lot more #transparency about this proposal would certainly be welcome. But I don't have high hopes for that; the "New Google", with its self-destructive and (at least in appearance) anti-user decisions, doesn't seem to want to #communicate effectively with the public.

    #NewGoogle #FootGun #UnforcedError

  27. @lauren

    This seems to be a common thread among the #footgun incidents they've been experiencing for years. They don't seem to consider how a product #shutdown, #rename, #launch, major UI #change, or some other action will look from the user's point of view.

    Are they just taking the #userbase for #granted? Pure obliviousness? Management incentives that discourage it?

    A lot of the time I think I'd like to be a fly on the wall when these decisions are being made.

    #google