[PATCH] compat: add canonicalize_file_name

Tomi Ollila tomi.ollila at iki.fi
Mon Jan 27 11:07:03 PST 2014


On Mon, Jan 27 2014, David Bremner <david at tethera.net> wrote:

> the POSIX 2008 behaviour of realpath is not available everywhere so we
> provide a simple wrapper function.  We use (and provide) the gnu
> extension canonicalize_file_name to make it cleaner to test for the
> feature we need; otherwise we have to rely on realpath segfaulting if
> the second argument is null.
> ---

I think this patch is tolerable. I first thought we should check the
combination of not having canonicalize_file_name() and having POSIX 2008
behaviour of realpath()...

... but the compat code is simple enough and basically done the same way
as in (e.g.)

http://svnweb.freebsd.org/base/release/9.2.0/lib/libc/stdlib/realpath.c?revision=255898&view=markup

qualifying the implementation. So +1 from me.

Tomi

>  compat/Makefile.local                |  4 ++++
>  compat/canonicalize_file_name.c      | 18 ++++++++++++++++++
>  compat/compat.h                      |  8 ++++++++
>  compat/have_canonicalize_file_name.c | 10 ++++++++++
>  configure                            | 16 ++++++++++++++++
>  notmuch-config.c                     |  2 +-
>  6 files changed, 57 insertions(+), 1 deletion(-)
>  create mode 100644 compat/canonicalize_file_name.c
>  create mode 100644 compat/have_canonicalize_file_name.c
>


More information about the notmuch mailing list