From: Ingo Schwarze <schwarze@usta.de>
To: tech@mdocml.bsd.lv
Cc: espie@nerim.net
Subject: Re: mandocdb tools, sqlite3, and ohash
Date: Thu, 7 Jun 2012 20:06:05 +0200 [thread overview]
Message-ID: <20120607180605.GA295@iris.usta.de> (raw)
In-Reply-To: <4FD0C58C.5040104@bsd.lv>
Hi Kristaps,
Kristaps Dzonsons wrote on Thu, Jun 07, 2012 at 05:15:24PM +0200:
> I've now kicked out uthash in favour of OpenBSD's native ohash.
Thanks for doing that work!
That removes one issue preventing a merge.
> (I've included espie@ in this just in case he has any ohashy
> wisdom.) This requires that I add a compat_ohash.c file, but this
> is trivial.
Marc, i have left you in the Cc: such that in case you test,
there is less risk of duplicating work. Just ignore this mail
if you don't want to test at this early stage, and say so if
you want to be removed from the Cc: for stuff not directly
related to ohash.
So far, i have read the file mandocdb.c and found the following
potential issues. I'm calling them "potential" because this is
mostly coming from code inspection without much testing.
1. Function main, OP_UPDATE case:
Is calling ofmerge, i.e. dbopen with real=0, correct?
It calls dbclose with real=0, thus calling rename to MANDOC_DB,
thus clobbering the original database instead of adding to it?
So far, i cannot really test this suspicion
because mandocdb -d always dies with segfaults or floating
point exceptions for me, i would have to ivestigate those
crashes first.
2. Function main, rebuild case:
Shouldn't this create the new db first, then move it into place
atomically in case of success? The remove(MANDOC_DB) seems
problematic: It is deleting an existing database, then creating
a new one only considerably later, if at all.
3. Function main, with multiple relative directories: e.g.
# cd /usr; mandocdb share/man local/man
That causes the first chdir to change into /usr/share/man
and the second to try to change into /usr/share/man/local/man.
That may not be a new issue, though.
4. Function dbopen with real=0:
There seems to be a race, open to symlink attacks,
between remove(file) and sqlite3_open(file);
some kind of O_EXCL or something might be required.
5. Function dirscan:
Shouldn't an argc argument be int instead of size_t?
6. Functions dirtreescan and filescan:
When a manual page has multiple hard links (MLINKS),
it looks like a matter of chance which one ends up being
used. Is there any check whether the NAME agrees with
the file name? Not sure anything is broken here, just
wondering.
7. Function filescan:
Calling mandocdb -d with file argument(s) triggers
the use_all assertion.
8. Function inocheck:
The memset(&id seems pointless, values are assigned
to the members right afterwards.
9. Function parse_mdoc_Fd:
This function triggers an assertion on #include <>.
Admittedly, that's not a new problem.
I'm not fixing it right now to avoid merge conflicts,
but we shouldn't forget.
Yours,
Ingo
--
To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv
next prev parent reply other threads:[~2012-06-07 18:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-07 15:15 Kristaps Dzonsons
2012-06-07 16:29 ` Joerg Sonnenberger
2012-06-07 18:06 ` Ingo Schwarze [this message]
2012-06-08 10:29 ` Kristaps Dzonsons
2012-06-08 12:25 ` Joerg Sonnenberger
2012-06-08 13:38 ` Kristaps Dzonsons
2012-06-08 14:13 ` Joerg Sonnenberger
[not found] ` <20120607165106.GA8819@lain.home>
2012-06-08 12:05 ` Kristaps Dzonsons
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120607180605.GA295@iris.usta.de \
--to=schwarze@usta.de \
--cc=espie@nerim.net \
--cc=tech@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).