💾 Archived View for librehacker.com › gemlog › tech › 20220714-0.gmi captured on 2024-07-09 at 00:36:46. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-10)
-=-=-=-=-=-=-
A great thing about gemini is that gemtext documents tend to be very lightweight, and so it usually does not take very long to load them over Tor. So, assuming Tor does a reasonably good job at hiding your IP address, and throwing in all the built-in privacy benefits of Gemini, one can enjoy a comfortable feeling of privacy while browsing Gemini capsules. It is easy to torify Lagrange with torsocks, by simply running "torsocks lagrange".
I ran into a serious problem, however, in using a torified lagrange: for some unknown reason, the background task which handles refreshing your feeds will (apparently) lockup, causing the feeds never to finish refreshing, and driving one of your CPU cores to switch to space-heater mode (100% usage forever). This only happens once every few times you refresh your feeds, but since lagrange (1.13.6) is hardcoded to refresh your feeds every 16 minutes, then inevitably you will switch back to Lagrange to find that the feed refresher has gotten stuck in this infinite-loop-like behavior.
I tried to debug the problem using gdb. First I had to build lagrange with debugging symbols. I record some notes on that here for my own records:
christopher@theoden ~/Build$ tar xkf `guix build -S -q lagrange` christopher@theoden ~/Build$ cd lagrange-1.13.6/ christopher@theoden ~/Build/lagrange-1.13.6$ guix environment lagrange christopher@theoden ~/Build/lagrange-1.13.6 [env]$ cmake -DCMAKE_BUILD_TYPE=Debug --log-level=ERROR . -- Configuring done -- Generating done -- Build files have been written to: /home/christopher/Build/lagrange-1.13.6 christopher@theoden ~/Build/lagrange-1.13.6 [env]$ cmake --build . [ 1%] Building C object lib/the_Foundation/CMakeFiles/the_Foundation.dir/src/the_foundation.c.o <...snip...> [100%] Linking C executable lagrange [100%] Built target app christopher@theoden ~/Build/lagrange-1.13.6 [env]$ file lagrange lagrange: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, with debug_info, not stripped
The resulting executable works fine for normal gdb debugging sessions. However, if you try to run it with torsocks, gdb will not be useful because torsocks is blocking the expected signals:
christopher@theoden ~/Build/lagrange-1.13.6 [env]$ torsocks --shell New torified shell coming right up... christopher@theoden ~/Build/lagrange-1.13.6 [env]$ gdb ./lagrange GNU gdb (GDB) 11.1 Copyright (C) 2021 Free Software Foundation, Inc. License 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. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-unknown-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./lagrange... (gdb) run Starting program: /home/christopher/Build/lagrange-1.13.6/lagrange <...snip...> ^C1657827666 WARNING torsocks[32268]: [syscall] Unsupported syscall number 200. Denying the call (in tsocks_syscall() at syscall.c:567)
So, I hit a wall there. Nevertheless, it occurred to me that, since I only need to refresh my feeds once per day, I could just disable automatic feed refreshing, and refresh them manually as needed. If the problem reoccurred, I would still have to restart lagrange, but only once or maybe twice per day at worst, which would be no great burden.
As I mentioned, the refresh timer is hardwired in. But I just needed to comment out two lines in the source code, and then rebuild.
christopher@theoden ~/Build [env]$ diff ./lagrange-1.13.6-original/src/feeds.c lagrange-1.13.6/src/feeds.c 699c699 < d->refreshTimer = SDL_AddTimer(1000 * intervalSec, refresh_Feeds_, NULL); --- > // d->refreshTimer = SDL_AddTimer(1000 * intervalSec, refresh_Feeds_, NULL); 704c704 < SDL_RemoveTimer(d->refreshTimer); --- > // SDL_RemoveTimer(d->refreshTimer);
christopher@theoden ~/Build/lagrange-1.13.6 [env]$ cmake --build . --clean-first <...snip...> christopher@theoden ~/Build/lagrange-1.13.6 [env]$ torsocks ./lagrange & disown