From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3410D431FBD for ; Sat, 25 Jan 2014 16:55:53 -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 JwRrVQn2cr4p for ; Sat, 25 Jan 2014 16:55:47 -0800 (PST) Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 13197431FBC for ; Sat, 25 Jan 2014 16:55:47 -0800 (PST) Received: from remotemail by yantan.tethera.net with local (Exim 4.80) (envelope-from ) id 1W7E0h-0005FY-6B; Sat, 25 Jan 2014 20:55:39 -0400 Received: (nullmailer pid 24358 invoked by uid 1000); Sun, 26 Jan 2014 00:55:35 -0000 From: David Bremner To: Tomi Ollila , notmuch@notmuchmail.org Subject: Re: [RFC PATCH] configure: check for POSIX.1-2008 realpath(3) implementation. In-Reply-To: <1390687142-16401-1-git-send-email-tomi.ollila@iki.fi> References: <1390687142-16401-1-git-send-email-tomi.ollila@iki.fi> User-Agent: Notmuch/0.17+42~gb867564 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Sat, 25 Jan 2014 20:55:35 -0400 Message-ID: <871tzvo92w.fsf@zancas.localnet> MIME-Version: 1.0 Content-Type: text/plain Cc: tomi.ollila@iki.fi 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 00:55:53 -0000 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 > if (! filename) { > if (errno == ENOENT) { > +#if POSIX_2008_REALPATH > filename = strdup (config->filename); > +#else > + /* ... this is the other else... */ > + resolved_path[sizeof resolved_path - 1] = '\0'; > + strncpy(resolved_path, config->filename, sizeof resolved_path); > + /* "faking" out of memory in case path too long -- close enough? */ > + filename = resolved_path[sizeof resolved_path - 1]? > + resolved_path: NULL; > +#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. d