https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70975

            Bug ID: 70975
           Summary: experimental/filesystem/operations/copy.cc FAILs on
                    Solaris 12
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
  Target Milestone: ---
              Host: *-*-solaris2.12
            Target: *-*-solaris2.12
             Build: *-*-solaris2.12

The experimental/filesystem/operations/copy.cc testcase FAILs on Solaris 12:

FAIL: experimental/filesystem/operations/copy.cc execution test

Unfortunately, the gdb stack trace is completely misleading, but dbx reveals

signal SEGV (no mapping at the fault address) in sendfile at 0xfdf0e533
0xfdf0e533: sendfile+0x0023:    movl     (%esi),%eax
Current function is do_copy_file
  429       const auto n = ::sendfile(out.fd, in.fd, nullptr,
from_st->st_size);

  [1] sendfile(0x4, 0x3, 0x0, 0x0), at 0xfdf0e533 
=>[2] do_copy_file(from = CLASS, to = CLASS, option = copy_options::none,
from_st = 0xfeffd628, to_st = (nil), ec = STRUCT), line 429 in "ops.cc"
  [3] std::experimental::filesystem::v1::copy(from = CLASS, to = CLASS, options
= copy_options::none, ec = STRUCT), line 540 in "ops.cc"
  [4] std::experimental::filesystem::v1::copy(from = CLASS, to = CLASS, options
= copy_options::none), line 232 in "ops.cc"
  [5] std::experimental::filesystem::v1::copy(__from = CLASS, __to = CLASS),
line 62 in "fs_ops.h"
  [6] test03(), line 109 in "copy.cc"
  [7] main(), line 152 in "copy.cc"

Looking at the source reveals what's the problem:

#ifdef _GLIBCXX_USE_SENDFILE
    const auto n = ::sendfile(out.fd, in.fd, nullptr, from_st->st_size);

sendfile is called with off = nullptr.  While this is supported on Linux,
Solaris unconditionally dereferences off as can be seen in the OpenSolaris
libsendfile sources.

AFAICT, sendfile is not in XPG7, so it's unclear what the ultimate
specification
is.

Solaris 10 and 11 are not affected since sendfile() only lives in libsendfile,
while it has been folded into libc in Solaris 12.

  Rainer

Reply via email to