|
Message-ID: <20170615000005.GJ1627@brightrain.aerifal.cx> Date: Wed, 14 Jun 2017 20:00:05 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: [PATCH 2/3] confstr: don't give empty strings for unset values On Fri, Jun 09, 2017 at 12:26:17AM -0500, A. Wilcox wrote: > From: "A. Wilcox" <AWilcox@...cox-Tech.com> > > If confstr(3) returns an empty string, that means the implementation > supports the configuration and simply needs no setting. Some values > should actually be unset on musl. This change ensures that > configurations not supported by musl do not have values. > --- > src/conf/confstr.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/src/conf/confstr.c b/src/conf/confstr.c > index 02cb1aa..c899abd 100644 > --- a/src/conf/confstr.c > +++ b/src/conf/confstr.c > @@ -11,6 +11,19 @@ size_t confstr(int name, char *buf, size_t len) > errno = EINVAL; > return 0; > } > + > + if (name == _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS || > + // Since sysconf _SC_V7_ILP32_OFF32 = -1 > + name == _CS_POSIX_V7_ILP32_OFF32_CFLAGS || > + name == _CS_POSIX_V7_ILP32_OFF32_LDFLAGS || > + name == _CS_POSIX_V7_ILP32_OFF32_LIBS || > + // Since sysconf _SC_V7_LPBIG_OFFBIG = -1 > + name == _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS || > + name == _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS || > + name == _CS_POSIX_V7_LPBIG_OFFBIG_LIBS) { > + return 0; > + } I'm not sure musl is actually correct in reporting these right now. POSIX describes LPBIG_OFFBIG as long, pointer, and off_t being "at least 64 bits", which is the case on 64-bit archs. Of course ILP32_OFF32 is always false. But I don't think POSIX imposes any requirement that we return an error here anyway. See unistd.h: _CS_POSIX_V7_ILP32_OFF32_CFLAGS If sysconf(_SC_V7_ILP32_OFF32) returns -1, the meaning of this value is unspecified. ^^^^^^^^^^^ Also I'm not sure what makes sense to return for _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS. On most archs, the only compilation environment does satisfy the conditions, but it doesn't have a name that can be passed to getconf -v. On some (x32, maybe n32?) archs, strictly speaking we're nonconforming by not having such an environment (I think at least suseconds_t is wrong, maybe blksize_t too). The requirements for interaction with POSIX.2 (xcu c99 and getconf commands) make this whole area a mess to implement since we don't control that part of the implementation. BTW your other two patches look fine, committing them. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.