[llvm-bugs] [Bug 33469] New: UTIME_OMIT shouldn't be used to detect presence of utimensat()

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 15 07:19:43 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33469

            Bug ID: 33469
           Summary: UTIME_OMIT shouldn't be used to detect presence of
                    utimensat()
           Product: libc++
           Version: 4.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: howarth.mailing.lists at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

The Xcode 9 beta release breaks the assumption...

    // We can use the presence of UTIME_OMIT to detect platforms that do not
    // provide utimensat.

made in src/experimental/filesystem/operations.cpp. The new Xcode 9 release has
a shared SDK for both 10.12/10.13 on 10.12...

% cd /Library/Developer/CommandLineTools/SDKs
[Mac-Pro:Developer/CommandLineTools/SDKs] howarth% ls -l
total 16
drwxr-xr-x  5 root  wheel  170 Jun 14 17:48 MacOSX.sdk
lrwxr-xr-x  1 root  wheel   10 Jun 14 09:11 MacOSX10.12.sdk -> MacOSX.sdk
lrwxr-xr-x  1 root  wheel   10 Jun 14 17:47 MacOSX10.13.sdk -> MacOSX.sdk

which results in a MacOSX.sdk/usr/include/sys/stat.h being used which
unconditionally contains...

#define UTIME_OMIT      -2

This produces a undefined _utimensat symbol when '-isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk
-mmacosx-version-min=10.12' is used. This is because the the 
MacOSX.sdk/usr/include/sys/stat.h properly uses the __API_AVAILABLE() macro on
the utimensat()...

int     utimensat(int __fd, const char *__path, const struct timespec
__times[2],
                int __flag) __API_AVAILABLE(macosx(10.13), ios(11.0),
tvos(11.0), watchos(4.0));

which leaves that symbol undeclared on the 10.12 target. However
src/experimental/filesystem/operations.cpp errornously tries to use the
utimensat() call based on the definition of UTIME_OMIT.
    This should be replaced with an appropriate cmake module to check for
utimensat() directly with the current compile flags rather than incorrectly
depending on the definition of UTIME_OMIT.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170615/f6caf290/attachment-0001.html>


More information about the llvm-bugs mailing list