From 387fb72ee084aca883b35d37d177958715bffab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Sun, 22 Aug 2021 03:18:03 +0200 Subject: l and h get args, no logmem, embed css, php dep --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 6d99a0c..a05c89a 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,12 @@ service sear.c start * a POSIX system * GNU C library -* GNU compiler collection (it's written in GNU C - it uses ~~anonymous~~ nested functions) - - anonymous functions were a pain to debug +* GNU compiler collection (it's written in GNU C - it uses nested functions) * GNU Make * libxml2-dev (for the simple HTML/1.0 client and HTML parser) * libmicrohttpd-dev (for serving results - use a reverse proxy, such as nginx, for HTTPS) * xxd (for converting HTML pages into C arrays when compiling from source) +* php-cli for a single line of Makefile (and I talk about bloat) ## compiling from source @@ -37,8 +37,10 @@ make * navigate to [http://localhost:7327](http://localhost:7327) and do a couple of searches to see if everything works * the horseshoe button redirects directly to the first result without wasting time on the results page. use if you feel lucky. (BP) * the painting button performs a search for images. PRIVACY WARNING: images are loaded directly from servers (not from google) -* check logs by navigating to /logs.html +* ~~check logs by navigating to /logs.html~~ logging to memory was disabled for consuming less memory, you can define SC\_LOGMEM while compiling to enable deprecated memory logging support * program also writes all logs to standard error +* setting the h parameter will rewrite links to HTTP from HTTPS +* setting the l parameter with a number will limit number of displayed links to that number. ## prebuilt binaries @@ -59,3 +61,9 @@ before downloading, check that the build passed, indicated below on the badge: ![screenshot in chromium 3](https://cdn.sijanec.eu/img/2021/04/sear.c_prtsc3.png) ![screenshot in chromium 4](https://cdn.sijanec.eu/img/2021/04/sear.c_prtsc4.png) ![screenshot in chromium 5](https://cdn.sijanec.eu/img/2021/04/sear.c_prtsc5.png) + +# additional information + +* valgrind reports a memory leak, leak is bigger with every API search query. run `make valgrind` and you'll see it. I was unable to find the bug, but it just bothers me. I wrote a small bug PoC (test/bug) but I could not replicate the bug (`cd tmp/bug; make; make valgrind; less valgrind-out.txt` - process exits with no leaks possible). Example output from sear.c valgrind with one request done is included in test/bug/example-valgrind.txt. Such small memory leak is not a problem, since we store all extracted data from the query indefinetley anyways, but it's still pretty dumb to leak memory. +* memory allocations are not checked for failures. This needs to be done to use fanalyzer +* __attribute__s such as nonnull are not set in struct members of query types and in functions such as htmlspecialchars but `if (!arg) return NULL` is done instead, which is poor coding style and fanalyzing can't be done in this case. This needs to be fixed to use fanalyzer. -- cgit v1.2.3