Date: Thu, 7 Jul 2011 13:12:03 +0200 From: Robert Millan <rmh@debian.org> To: Ed Schouten <ed@80386.nl> Cc: freebsd-hackers@freebsd.org, Ed Maste <emaste@freebsd.org>, debian-hurd@lists.debian.org Subject: Re: [PATCH] avoid assuming MAXPATHLEN in config(8) Message-ID: <CAOfDtXN0RkYaWKidXjwJd3UP9LNmW0BdFqH5boMUA_W19%2BsUiQ@mail.gmail.com> In-Reply-To: <20110707100123.GF71453@hoeg.nl> References: <CAOfDtXNreaFYKvyR_C15dk9mOqU30_Z4gHxQPkPH5ntY7rRtzA@mail.gmail.com> <20110707100123.GF71453@hoeg.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
2011/7/7 Ed Schouten <ed@80386.nl>: > * Robert Millan <rmh@debian.org>, 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfDtXN0RkYaWKidXjwJd3UP9LNmW0BdFqH5boMUA_W19%2BsUiQ>