small pixel drawing of a pufferfish j3s.sh

thought/recover-lost-text-by-coredumping-firefox.html

recover lost text by coredumping firefox
              2023-10-20

sometimes websites fuck up and erase your text.

websites either glitch, crash, freeze, or are just designed
extremely poorly, and your 5+ minutes of writing effort
have disappeared into the æthernet. the usual ctrl+z doesn't
work - either does the back button. your text is gone.

it often feels like you might never be capable
of recapturing that writing, even if you try
to re-think and re-write it.

a tangible loss - some magic that's gone forever.

or sometimes it's just a really fucking annoying survey
question that you answered, but you didn't even really want
to do the survey, but you had already started so you're not
backing out now, and also you just HAD to know which hogwarts
familiar you were, even though everyone knows you're going to be
that fucking frog that neville owns, but now the fucking browser
fucked up, or maybe it was the website, i don't know, but my text
is god damned gone forever, and i hate this earth, and now i shall
throw my keyboard out the nearest window.

this type of data loss happens to me far too often, and
when it does, my internal reality turns into a hellscape.

this also happens to yngmar[0], and he reacts appropriately:

- Yell "Fuck you and your piece of shit website".
- Close tab
- Do some woodworking, sew clothes, plant trees,
  grow crops, help refugees, etc.


i recently discovered this little trick to
rescue any text that was recently typed into
firefox.

coredumping might seem unreliable, but it has
never failed me before.

1. find the firefox pid

  pgrep -l firefox

2. attach gdb to firefox and dump its core

  sudo gdb -p <pid>
  gcore firefox.dump
  <this takes awhile>
  exit

3. find your lost text in the coredump

  strings firefox.dump | grep 'phrase-from-your-text'

4. remove coredump

  rm firefox.dump

that's it! text recovered. 😎

shoutout to klardotsh[1] for inspiring me to post this.

love,


j3s


[0]: https://social.tchncs.de/@yngmar/111269159153831442
[1]: https://merveilles.town/@klardotsh