This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug network/21426] sys/socket.h uio.h namespace


https://sourceware.org/bugzilla/show_bug.cgi?id=21426

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  9fe3c80c7c3dbce34dadc7f0693d211fdd9a0b03 (commit)
      from  3fa6e4872d63b57d77c545ef1fbcbb8b0796d232 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9fe3c80c7c3dbce34dadc7f0693d211fdd9a0b03

commit 9fe3c80c7c3dbce34dadc7f0693d211fdd9a0b03
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Tue Apr 25 17:52:47 2017 +0000

    Fix sys/socket.h namespace issues from sys/uio.h inclusion (bug 21426).

    sys/socket.h includes sys/uio.h to get the definition of the iovec
    structure.

    POSIX allows sys/socket.h to make all sys/uio.h symbols visible.
    However, all of sys/uio.h is XSI-shaded, so for non-XSI POSIX this
    results in conformtest failures (for sys/socket.h and other headers
    that include it):

        Namespace violation: "UIO_MAXIOV"
        Namespace violation: "readv"
        Namespace violation: "writev"

    Now, there is some ambiguity in POSIX about what namespace
    reservations apply in this case - see
    http://austingroupbugs.net/view.php?id=1127 - but glibc convention
    would still avoid declaring readv and writev, for example, for feature
    test macros that don't include them (if only headers from the relevant
    standard are included), even if such declarations are permitted, so
    there is a bug here according to glibc conventions.

    This patch moves the struct iovec definition to a new
    bits/types/struct_iovec.h header and includes that from sys/socket.h
    instead of including the whole of sys/uio.h.  This fixes the namespace
    issue; however, three files in glibc that were relying on the implicit
    inclusion needed to be updated to include sys/uio.h explicitly.  So
    there is a question of whether sys/socket.h should continue to include
    sys/uio.h under some conditions, such as __USE_XOPEN or __USE_MISC or
    __USE_XOPEN || __USE_MISC, for greater compatibility with code that
    (wrongly) expects this optional inclusion to be present there.  (I
    think the three affected files in glibc should still have explicit
    sys/uio.h inclusions added in any case, however.)

    Tested for x86_64.

        [BZ #21426]
        * misc/bits/types/struct_iovec.h: New file.
        * misc/Makefile (headers): Add bits/types/struct_iovec.h.
        * include/bits/types/struct_iovec.h: New file.
        * bits/uio.h (struct iovec): Replace by inclusion of
        <bits/types/struct_iovec.h>.
        * sysdeps/unix/sysv/linux/bits/uio.h (struct iovec): Likewise.
        * socket/sys/socket.h: Include <bits/types/struct_iovec.h> instead
        of <sys/uio.h>.
        * nptl/tst-cancel4.c: Include <sys/uio.h>
        * posix/test-errno.c: Likewise.
        * support/resolv_test.c: Likewise.
        * conform/Makefile (test-xfail-POSIX2008/arpa/inet.h/conform):
        Remove.
        (test-xfail-POSIX2008/netdb.h/conform): Likewise.
        (test-xfail-POSIX2008/netinet/in.h/conform): Likewise.
        (test-xfail-POSIX2008/sys/socket.h/conform): Likewise.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   18 +++++++++++++
 bits/uio.h                                         |   10 +-------
 conform/Makefile                                   |    4 ---
 include/bits/types/struct_iovec.h                  |    1 +
 misc/Makefile                                      |    2 +-
 .../bits/types/struct_iovec.h                      |   26 +++++++++----------
 nptl/tst-cancel4.c                                 |    1 +
 posix/test-errno.c                                 |    1 +
 socket/sys/socket.h                                |    2 +-
 support/resolv_test.c                              |    1 +
 sysdeps/unix/sysv/linux/bits/uio.h                 |    7 +----
 11 files changed, 38 insertions(+), 35 deletions(-)
 create mode 100644 include/bits/types/struct_iovec.h
 copy sysdeps/mips/mips32/fpu/fpucw-helpers.c => misc/bits/types/struct_iovec.h
(74%)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]