From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 7 11:12:03 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D46D11065670; Thu, 7 Jul 2011 11:12:03 +0000 (UTC) (envelope-from rmh.aybabtu@gmail.com) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id A8C6E8FC18; Thu, 7 Jul 2011 11:12:03 +0000 (UTC) Received: by pwi7 with SMTP id 7so759000pwi.13 for ; Thu, 07 Jul 2011 04:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=BCHvDgeJYfaUCIH9k2nE4FH+PpQZJ0eyWeuPcX+v9bI=; b=bpRnDEzpz2nXYwFIjmpQ8Wpl8O/A1IdhoFUf6REwfgu7bfzm1T1vG17QMjOxOap4uS v857JtCZUWg+JB1TA+odzqqhYCmaBQq7hyfG+7ZGOE+4IRVfVt1fU07QCepaxdQ9PzgL MHpKvKeqMJ0KnoFl+lEy0mLsnuW5EE8kNA87k= MIME-Version: 1.0 Received: by 10.68.50.198 with SMTP id e6mr975749pbo.292.1310037123141; Thu, 07 Jul 2011 04:12:03 -0700 (PDT) Sender: rmh.aybabtu@gmail.com Received: by 10.68.57.4 with HTTP; Thu, 7 Jul 2011 04:12:03 -0700 (PDT) In-Reply-To: <20110707100123.GF71453@hoeg.nl> References: <20110707100123.GF71453@hoeg.nl> Date: Thu, 7 Jul 2011 13:12:03 +0200 X-Google-Sender-Auth: LeJUGmunHhqoi2_1Lod2HNkY0j0 Message-ID: From: Robert Millan To: Ed Schouten Content-Type: text/plain; charset=UTF-8 Cc: freebsd-hackers@freebsd.org, Ed Maste , debian-hurd@lists.debian.org Subject: Re: [PATCH] avoid assuming MAXPATHLEN in config(8) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jul 2011 11:12:03 -0000 2011/7/7 Ed Schouten : > * Robert Millan , 20110707 11:33: >> config(8) assumes MAXPATHLEN is defined in a few places, but presence >> of this macro isn't garanteed (POSIX says that it is only present when >> a file length limit exists, which may not be the case). > > Even though it is good to make our code conform to standards as much as > possible, do keep in mind that your patch also causes a lot of > regressions in that area. The code now uses asprintf(), which is not > part of POSIX. I also think the use of __GLIBC__ is frowned upon. Uhm... you're right. Actually I knew asprintf() is not part of POSIX, it just didn't occur to me that this contradicted my point about MAXPATHLEN [1]. As for the __GLIBC__ bit, it is difficult to handle this without a function that canonicalizes arbitrary-length pathnames. Would you prefer something like: #ifdef MAXPATHLEN // use realpath on a statically-allocated buffer #else // assume canonicalize_file_name() is present #endif [1] Btw, POSIX itself is quite contradictory too: it doesn't let you assume MAXPATHLEN, but it doesn't give you the facilities you need in case it isn't present (e.g. asprintf and canonicalize_file_name but gethostname and getline / fgetln come to mind too). -- Robert Millan