Andre Noll [Thu, 15 Oct 2020 14:20:54 +0000 (16:20 +0200)]
Merge branch 'refs/heads/t/sha3' into master
This code was written long ago and was sitting in a development branch
for some years. As such it was part of the pu branch and so has seen
some testing.
There's an easy conflict in fsck.c where one side added a function
parameter and the other renamed some variables.
* refs/heads/t/sha3:
Version 3 tables.
Add sha3 implementation, introduce version-2 tables.
Prepare hash_function() for multiple hash algorithms.
Store table version in struct osl_table.
Initialize column name hash *after* table version is known.
osl_open_table(): Remove pointless directory check.
Remove sha1.h.
Remove COMPAT_TABLE_VERSION.
Andre Noll [Thu, 17 Sep 2020 16:21:30 +0000 (18:21 +0200)]
build: Fix manual setting of CC.
We want to set CC not only if its value comes from the default origin
but also if it is undefined or empty. It's easiest to set it to "cc"
whenever its current value is empty.
Andre Noll [Sat, 12 Sep 2020 18:29:23 +0000 (20:29 +0200)]
build: Tell make(1) that the compiler creates .d files.
The best way to convey the information that two files are created
by the same command involves rules with grouped targets (indicated
by the &: separator between targets and prerequisites). However,
since grouped targets is a relatively new feature of make(1) and we
would like to keep supporting older versions, we use ordinary rules
with multiple targets. This should not be worse because the compiler
is still run only once for each source file.
The patch also introduces the pre_deps make variable to make sure the
files listed in this variable are present before we run the compiler.
Andre Noll [Wed, 23 Sep 2020 16:49:52 +0000 (18:49 +0200)]
Merge branch 'master' into next
* master:
web: Add style sheet.
web: Streamline INSTALL.
web: Simplify main page.
web: Let logo link to index.html rather than ".".
web: Don't duplicate the html header.
web: Get rid of doxygen.
web: Convert QUICK_START to markdown syntax.
web: Fix typo in README.
Andre Noll [Tue, 16 Jun 2020 19:36:36 +0000 (21:36 +0200)]
web: Add style sheet.
The style sheet configures different background colors for even and
odd numbered lines of the API summary. This visual aid should make
the document easier to follow.
Andre Noll [Mon, 15 Jun 2020 23:13:30 +0000 (01:13 +0200)]
web: Get rid of doxygen.
Doxygen is an additional dependency, and it's total overkill for
a small project like osl. The self-contained gendoc.m4 script does
everything we need, and is much faster.
This patch converts osl.h.in to gendoc syntax and removes all traces
of doxygen. Since gendoc.m4 relies on features of gnu-m4 we run it with
-g to enable gnu extensions. This has been tested on FreeBSD and NetBSD
which ship different m4 implementations, both of which understand -g.
Andre Noll [Wed, 17 Jun 2020 20:33:57 +0000 (22:33 +0200)]
Merge branch 'refs/heads/t/build' into next
* refs/heads/t/build:
build: Deactivate implicit build make(1) rules.
build: Mark files generated by lopsub as precious.
build: Remove make(1) targets to build a static library.
build: Combine make(1) targets osl_errors.h and osl.h.
build: Make sure osl.h exists when we run the compiler.
Andre Noll [Sun, 15 Mar 2020 11:27:22 +0000 (12:27 +0100)]
Version 3 tables.
This adds support for yet another hash function: sha256. We keep the
Keccak Hash as version #2, because it works well and has been around
for years in an experimental branch of this repo. As for Keccak,
we only use 20 bytes of the sha256 hash, which is safe enough and
helps to keep the patch as small as possible.
The sha256 implementation was taken from git v2.25.1.
Andre Noll [Wed, 19 Apr 2017 13:12:44 +0000 (15:12 +0200)]
Prepare hash_function() for multiple hash algorithms.
In order to transparently support more than one hash function in the
future, we now pass the table version to hash_function(). The version
is always one at the moment, and only the sha1 hash is implemented
so far.
Andre Noll [Wed, 19 Apr 2017 13:05:53 +0000 (15:05 +0200)]
Store table version in struct osl_table.
This modifies read_table_desc() to return the table version read from
the index header. The returned version number is stored in the newly
added field of struct osl_table. This will allow us to choose a hash
function based on the version.
Andre Noll [Wed, 19 Apr 2017 12:43:08 +0000 (14:43 +0200)]
Initialize column name hash *after* table version is known.
We use hash_function() to determine the path of the file/directory
which corresponds to columns of type MAPPED_STORAGE or
DISK_STORAGE. Currently this happens before the index has been
mapped, so we don't know the table version at this point.
Future versions of osl will support multiple hash functions, and the
hash function to use will be determined from the table version. At
this point the modifications of this patch become necessary. At the
moment the patch has no visible effect.
The subsequent mmap(2) call will fail if the directory does not exist
(or if the path is not a directory), so this check is not needed.
This removes the only user of the E_OSL_NOTDIR error code. We must
keep it in the errlist file though, because error codes must be
considered part of the API.
Andre Noll [Tue, 18 Apr 2017 20:07:54 +0000 (22:07 +0200)]
Remove sha1.h.
The file contains only the declaration of sha1_hash() and the
definition of HASH_SIZE This commit moves HASH_SIZE from sha1.h to
hash.h and moves the declaration of sha1_hash() to hash.h, the only
file which needs it.
Andre Noll [Tue, 18 Apr 2017 18:23:30 +0000 (20:23 +0200)]
Remove COMPAT_TABLE_VERSION.
The compatibility version concept was introduced eight years ago in
commit (62d228ec), and was never needed. In fact, COMPAT_TABLE_VERSION
has always been zero so far. This commit gets rid of it.
Given a library version and the on-disk table version, we can still
tell whether the table can be opened by comparing the MIN_TABLE_VERSION
and the CURRENT_TABLE_VERSION numbers of the library against the
value stored in the table (i.e., the CURRENT_TABLE_VERSION value of
the library that created the table).
Andre Noll [Mon, 15 Jun 2020 14:29:52 +0000 (16:29 +0200)]
Makefile: Also build osl.h by default.
Otherwise it gets built as root during make install and is thus owned
by root. This may cause problems, for example if the source resides
on an NFS mounted directory where root is not allowed to write.
Andre Noll [Mon, 8 Jun 2020 16:33:49 +0000 (18:33 +0200)]
Merge branch 'refs/heads/t/build' into next
* refs/heads/t/build:
build: Add $(LDFLAGS) to rule for oslfsck.
build: Prefix CFLAGS and friends with OSL_.
build: Reorder make variables.
build: Combine CFLAGS and LIBCFLAGS.
build: Simplify LDFLAGS setting.
build: Simplify Makefile.
build: Drop support for SunOS and MacOS.
build: Don't insist on gcc.
build: Create dependencies on the fly.
Andre Noll [Sun, 17 May 2020 20:04:40 +0000 (22:04 +0200)]
build: Prefix CFLAGS and friends with OSL_.
It is best practice to leave the "official" CPPFLAGS, CFLAGS and
LDFLAGS variables alone and just add them at the end of the command
line options. This way the user may override any of our settings
by setting the corresponding option in the official variable. For
example, to deactivate warnings about unused variables or functions,
one may compile with
Andre Noll [Sat, 16 May 2020 11:23:03 +0000 (13:23 +0200)]
build: Create dependencies on the fly.
This is faster since we run the compiler only once. It is more robust,
too, because the build does not break if a random .h file is added to
the working directory. Using $(wildcard) is almost always a mistake..
Andre Noll [Mon, 3 Jun 2019 12:05:10 +0000 (14:05 +0200)]
Merge branch 'refs/heads/t/lopsub'
* refs/heads/t/lopsub:
Convert oslfsck to lopsub.
The merge conflicted twice for the Makefile because of commit ec08b17c7514 which touched the object list of oslfsck and added
-DVERSION to the CPPFLAGs. This was easy to fix, though.
Andre Noll [Wed, 19 Apr 2017 13:49:38 +0000 (15:49 +0200)]
build: Fix dependencies for oslfsck.
The autogenerated Makefile.deps does not work for the oslfsck
exectutable because we compile the object files for oslfsck without
-fPIC to generate more performant code, and name them e.g. util.fsck.o
instead of util.o.
Geting rid of this optimization not only fixes the dependencies but
also simplifies the Makefile and speeds up the build.
Andre Noll [Sun, 28 Aug 2016 21:04:06 +0000 (23:04 +0200)]
Convert oslfsck to lopsub.
The gengetopt project seems to be dead (last release was five years
ago), so we eventually need to switch to something else.
This commit migrates the option parser of oslfsck to the lopsub
library, which turned out to be rather simple. As a result, the osl
package no longer depends on gengetopt and help2man.
The change only affects the oslfsck executable. No changes to the
library proper.
Andre Noll [Thu, 21 Apr 2016 09:09:39 +0000 (11:09 +0200)]
Convert README and INSTALL to markdown.
The grutatxt project is dead, so we need to switch to something else
eventually. Fortunately, only little changes are required for the
switch to the markdown markup language as there are only two files in
the source tree which are formated with grutatxt. This patch converts
both files and adjusts the Makefile to run the markdown converter
instead of the grutatxt script.
Andre Noll [Wed, 13 Jan 2016 14:35:36 +0000 (15:35 +0100)]
web: Create man page with groff rather than man2html.
The man2html project is dead, as is the link on the osl web page. The
URL mentioned in the info of the man2html package for Ubuntu-14.04
still works but might not be the most up to date page on the planet
any more:
In any case, it's a funny read. Needless to say that the link to the
sunsite FTP server is also dead.
This commit makes osl independent of man2html, simply by running groff
-Thtml instead of man2html. This even simplifies the Makefile a bit.
The patch also removes the dead link on the osl main page. We don't
need a replacement reference to groff because groff should be installed
on all systems anyway.
Andre Noll [Wed, 13 Jan 2016 14:12:02 +0000 (15:12 +0100)]
web: Update Doxyfile.
This file was created long ago with doxygen version 1.5.4. The system
on which the public web pages are generated runs Ubuntu 14.04 which
ships doxygen-1.8.6. This doxygen version complains as follows:
Warning: Tag `DETAILS_AT_TOP' at line 162 of file web/Doxyfile has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `SHOW_DIRECTORIES' at line 424 of file web/Doxyfile has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
Warning: Tag `HTML_ALIGN_MEMBERS' at line 727 of file web/Doxyfile has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
This patch is the result of running doxygen -u web/Doxyfile. With the
updated file the above warnings go away, and the pages look identical.
Andre Noll [Mon, 26 Oct 2015 14:38:09 +0000 (15:38 +0100)]
web: Switch to UTF-8 encoding.
Probably doesn't matter at all since there isn't a single text file in
the repo which is not pure ASCII. But still, in 2016 iso-8859 should
not be used any more..
Andre Noll [Sat, 9 Aug 2014 13:21:50 +0000 (15:21 +0200)]
Add make target www.
The new target allows to update the web page with "make www", followed
by a suitable command to copy the "web" directory to the server. That's
as easy as it gets.
Andre Noll [Thu, 22 Jan 2015 12:58:20 +0000 (13:58 +0100)]
web: Remove SSI for last modification in footer.html.
The footer.html file is is only used for the doxygen pages. It contains
a server side include directive although SSI is not activated on the
people.tuebingen.mpg.de web server and probably will never be.
This commit gets rid of the SSI and also removes the end tags </td>
and </table> from footer.html as these elements are not open at this
point of the document. This was found by the w3c validator.
Removes also the link to the W2C validator. Nobody wants to see this,
and doxygen does not even create valid html anyway..
Andre Noll [Mon, 24 Aug 2015 15:34:28 +0000 (17:34 +0200)]
Explain the osl_strerror dance.
It's not completely obvious what is going on here and *why* we not
just go with a simple pointer array for the messages returned by
osl_strerror(). This commit explains why pointer arrays are bad
in DSOs.
Andre Noll [Mon, 24 Aug 2015 15:35:08 +0000 (17:35 +0200)]
Fix comment on SHA1 implementation.
The dependency on openssl was dropped six years ago in commit f0884471. This commit corrects the stale comment that still says we
use openssl's sha1 implementation.
Andre Noll [Sat, 13 Jun 2015 18:47:33 +0000 (20:47 +0200)]
osl_get_nth_row(): Always initialize result pointer.
We buy into Postel's prescription and try to be liberal in what we
accept, and conservative in what we send. This patch makes sure the
result pointer is set to NULL on failure, and documents this fact.
Andre Noll [Sun, 4 Jan 2015 00:34:26 +0000 (00:34 +0000)]
osl_update_object(): Honor OSL_DONT_FREE.
When osl_update_object() is called to replace an object of
an OSL_NO_STORAGE column, it frees the old object even if the
OSL_DONT_FREE flag is set for the column, which is wrong. This patch
changes the function to call free() only if OSL_DONT_FREE is unset.
Andre Noll [Sun, 4 Jan 2015 00:33:35 +0000 (00:33 +0000)]
Mention that OSL_RBTREE implies OSL_UNIQUE.
Also print a warning when a table is opened or created which contains
a column description with OSL_RBTREE set but OSL_UNIQUE unset. Future
versions of osl might reject such table descriptions. But in order
to not break existing applications, we can not make such a change
without a deprecation period. So a warning has to suffice for now.
Andre Noll [Mon, 11 Aug 2014 09:13:25 +0000 (11:13 +0200)]
Install relative links to the soname.
On make install, the library is installed to $(libdir)/$(realname)
(e.g. /usr/local/lib/libosl.so.0.1.2), and a link is created to
map $(linkername) to $(soname) (e.g. /usr/local/lib/libosl.so ->
/usr/local/lib/libosl.so.0).
This changes the ln command to create a relative link rather than an
absolute link. For example, /usr/local/lib/libosl.so now points to
libosl.so.0 without the leading directory. This shouldn't matter much
but it allows to move both files elsewhere without breaking the link.
Andre Noll [Tue, 14 Jan 2014 14:11:12 +0000 (15:11 +0100)]
Fix adu link.
After the upgrade of the servers at systemlinux.org last week, the web
service is no longer available through http://systemlinux.org. Adjust
the link to the adu page accordingly.
Andre Noll [Tue, 22 May 2012 15:55:10 +0000 (17:55 +0200)]
Allow to build a static version of libosl.
This adds the new target libosl.a which creates an archive that can
be statically linked into applications. Currently this works only on
ELF-based systems including Linux, FreeBSD and NetBSD, but fails on
MacOS. So it is not built automatically.
Unfortunately, creating libosl.a turned out to be trickier than
expected, because -fvisibility=hidden works only for dynamic libraries.
So we need a different method to hide non-static internal symbols
like make_message() which must not be global (external) because they
might clash with symbols used in the application.
objcopy(1) does the trick but we must provide a list of exceptional
symbols that should not be made local. This list is generated from
the osl.h header file.
Andre Noll [Wed, 25 Nov 2009 09:40:08 +0000 (10:40 +0100)]
Split install target.
As proposed by Sebastian Stark, this introduces the install-lib,
install-bin and install-man targets. The simple "make install" still
installs everything, but splitting the target allows people to install
for example only the library if they do not have all tools available
which are necessary to build the oslfsck binary or its man page.
Andre Noll [Fri, 20 Nov 2009 08:38:56 +0000 (09:38 +0100)]
Drop dependency on openssl.
This patch adds git's implementation of the sha1 hash algorithm. This
makes osl more self-contained as it allows to build osl without
openssl being installed.
It should also reduce the startup time of applications that link
against libosl.