Thursday, June 11, 2015

TIL: never depend on the order of evaluation of sub-expressions in a stream

The code below may result in a 6 different execution orders. It will surprise and hurt you, so don't do that ;-)
std::cout << wizard.CastSpell("abracadabra") << wizard.DrinkPotion("Rosanke") << wizard.Mana();
More info can be found:

Monday, June 1, 2015

Endless extracting of tar.bz2 archive

Funny story. Over a year ago I've backed up a project directory to tar.bz2 archive. Today I've decided to check what's inside. I've encountered a frozen window of 'extract here' option from file context menu.

I've killed the extract process and rerun it from a terminal:
tar -xvvf archive.tar.bz2
After few normal lines i've seen smth (in fact thousands of such lines):
hrwxr-x--- user/group       0 2013-02-06 23:20 workspace/a/b/a/b/f.go link to workspace/a/b/f.go
hrwxr-x--- user/group       0 2013-02-06 23:20 workspace/a/b/a/b/a/b/f.go link to workspace/a/b/a/b/f.go
This clued me, that probably the archive kept the symbolic links. After Googling and reading tar manual I had this idea: let's remove a symlink from an archive:
tar --delete -f archive.tar workspace/a/b/a
This worked just well :-)