From 8c5789f53ade6db6433ee5cbd0b940b54c94cd52 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Sun, 26 Jan 2014 13:18:12 +0200 Subject: [PATCH] Re: [RFC PATCH] configure: check for POSIX.1-2008 realpath(3) implementation. --- f6/7c367bff1139d3d5dce45ebca59c645f473bae | 100 ++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 f6/7c367bff1139d3d5dce45ebca59c645f473bae diff --git a/f6/7c367bff1139d3d5dce45ebca59c645f473bae b/f6/7c367bff1139d3d5dce45ebca59c645f473bae new file mode 100644 index 000000000..8803b8169 --- /dev/null +++ b/f6/7c367bff1139d3d5dce45ebca59c645f473bae @@ -0,0 +1,100 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id AAAC1431FBD + for ; Sun, 26 Jan 2014 03:18:24 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ec3QXsHvpZx1 for ; + Sun, 26 Jan 2014 03:18:17 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 38286431FBC + for ; Sun, 26 Jan 2014 03:18:17 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id E3188100051; + Sun, 26 Jan 2014 13:18:12 +0200 (EET) +From: Tomi Ollila +To: David Bremner , notmuch@notmuchmail.org +Subject: Re: [RFC PATCH] configure: check for POSIX.1-2008 realpath(3) + implementation. +In-Reply-To: <871tzvo92w.fsf@zancas.localnet> +References: <1390687142-16401-1-git-send-email-tomi.ollila@iki.fi> + <871tzvo92w.fsf@zancas.localnet> +User-Agent: Notmuch/0.17+41~g8e7fabf (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 26 Jan 2014 11:18:24 -0000 + +On Sun, Jan 26 2014, David Bremner wrote: + +> Tomi Ollila writes: +>> +#if POSIX_2008_REALPATH +>> filename = realpath (config->filename, NULL); +>> +#else +>> + /* compatibility with minor effort, not elegance, is the ruling factor +>> + in these (two) else branches... */ +>> + char resolved_path[PATH_MAX]; +>> + filename = realpath (config->filename, resolved_path); +>> +#endif + + +> +> I worry a bit about making the mainline code messier and harder to maintain, in order to +> accomodate an unknown number of targets without POSIX2008 realpath. Do +> we know how widespread this problem is? Is it just NetBSD? +> +> I looked at borrowing realpath from gnulib; it looks like it would be a +> bit of work as the least complicated version includes 3 other include +> files. But then the mainline code could be blisfully ignorant of the +> whole dispute. + +We could also create + +char * realpath2008 (const char * path, char * resolved_path) +{ + if (resolved_path == NULL) { + resolved_path = malloc (MAX_PATH); + if (resolved_path == NULL) + return NULL; + } + return realpath (path, resolved_path); +} + +And, in the case where NULL argument is accepted, + +#define realpath2008(path, resolved_path) realpath(path, resolved_path) + +(or an inline function to do the same) + +In this case one is not totally ignorant to the whole dispute -- but +on the other hand, developer should be savvy about the potential +issues using realpath() function, and this might just ring the bell... + +> d + +Tomi -- 2.26.2