@MaryAustinBooks

And appropriately enough, this photo also looks an awful lot like the map of the Straight of Hormuz we've all been looking at for the last three-and-a-half months.

#Hormuz #SelfInflicted #FootGun

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

#Python #MagicMock #footgun

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

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

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
Migrating key material · Issue #850 · dino/dino

Hi. I am looking to document how a user can preserve their OMEMO keys by backing them up to their personal storage and restoring them in case of a reinstall. Where are the keys stored?

GitHub

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

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
I love variadic template arguments until ... #footgun. #cpp #metaprogramming
I love template #metaprogramming in #C++ but am constantly afraid of #footgun.

Gee I wonder what could have lead to this #AWSoutage...

#RTO #braindrain #footgun