From owner-svn-src-stable@FreeBSD.ORG Fri Jun 1 06:45:15 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4ED791065675; Fri, 1 Jun 2012 06:45:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 310F48FC14; Fri, 1 Jun 2012 06:45:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q516jFYm092863; Fri, 1 Jun 2012 06:45:15 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q516jE6L092857; Fri, 1 Jun 2012 06:45:14 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206010645.q516jE6L092857@svn.freebsd.org> From: Dimitry Andric Date: Fri, 1 Jun 2012 06:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236385 - in stable/9/contrib/llvm: include/llvm/Support lib/Support/Unix lib/Support/Windows tools/clang/lib/Frontend X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jun 2012 06:45:15 -0000 Author: dim Date: Fri Jun 1 06:45:14 2012 New Revision: 236385 URL: http://svn.freebsd.org/changeset/base/236385 Log: MFC r236260: Pull in r156591 from upstream llvm trunk: Allow unique_file to take a mode for file permissions, but default to user only read/write. and r156592 from upstream clang trunk: For final output files create them with mode 0664 to match other compilers and expected defaults. This should fix clang creating files with mode 0600. Reported by: James Modified: stable/9/contrib/llvm/include/llvm/Support/FileSystem.h stable/9/contrib/llvm/lib/Support/Unix/PathV2.inc stable/9/contrib/llvm/lib/Support/Windows/PathV2.inc stable/9/contrib/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) Modified: stable/9/contrib/llvm/include/llvm/Support/FileSystem.h ============================================================================== --- stable/9/contrib/llvm/include/llvm/Support/FileSystem.h Fri Jun 1 06:40:48 2012 (r236384) +++ stable/9/contrib/llvm/include/llvm/Support/FileSystem.h Fri Jun 1 06:45:14 2012 (r236385) @@ -422,8 +422,8 @@ error_code status_known(const Twine &pat /// @results errc::success if result_{fd,path} have been successfully set, /// otherwise a platform specific error_code. error_code unique_file(const Twine &model, int &result_fd, - SmallVectorImpl &result_path, - bool makeAbsolute = true); + SmallVectorImpl &result_path, + bool makeAbsolute = true, unsigned mode = 0600); /// @brief Canonicalize path. /// Modified: stable/9/contrib/llvm/lib/Support/Unix/PathV2.inc ============================================================================== --- stable/9/contrib/llvm/lib/Support/Unix/PathV2.inc Fri Jun 1 06:40:48 2012 (r236384) +++ stable/9/contrib/llvm/lib/Support/Unix/PathV2.inc Fri Jun 1 06:45:14 2012 (r236385) @@ -346,9 +346,10 @@ error_code status(const Twine &path, fil return error_code::success(); } +// Since this is most often used for temporary files, mode defaults to 0600. error_code unique_file(const Twine &model, int &result_fd, - SmallVectorImpl &result_path, - bool makeAbsolute) { + SmallVectorImpl &result_path, + bool makeAbsolute, unsigned mode) { SmallString<128> Model; model.toVector(Model); // Null terminate. @@ -395,7 +396,7 @@ retry_random_path: // Try to open + create the file. rety_open_create: - int RandomFD = ::open(RandomPath.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600); + int RandomFD = ::open(RandomPath.c_str(), O_RDWR | O_CREAT | O_EXCL, mode); if (RandomFD == -1) { // If the file existed, try again, otherwise, error. if (errno == errc::file_exists) Modified: stable/9/contrib/llvm/lib/Support/Windows/PathV2.inc ============================================================================== --- stable/9/contrib/llvm/lib/Support/Windows/PathV2.inc Fri Jun 1 06:40:48 2012 (r236384) +++ stable/9/contrib/llvm/lib/Support/Windows/PathV2.inc Fri Jun 1 06:45:14 2012 (r236385) @@ -487,9 +487,11 @@ handle_status_error: return error_code::success(); } +// FIXME: mode should be used here and default to user r/w only, +// it currently comes in as a UNIX mode. error_code unique_file(const Twine &model, int &result_fd, - SmallVectorImpl &result_path, - bool makeAbsolute) { + SmallVectorImpl &result_path, + bool makeAbsolute, unsigned mode) { // Use result_path as temp storage. result_path.set_size(0); StringRef m = model.toStringRef(result_path); Modified: stable/9/contrib/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp Fri Jun 1 06:40:48 2012 (r236384) +++ stable/9/contrib/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp Fri Jun 1 06:45:14 2012 (r236385) @@ -560,7 +560,8 @@ CompilerInstance::createOutputFile(Strin TempPath += "-%%%%%%%%"; int fd; if (llvm::sys::fs::unique_file(TempPath.str(), fd, TempPath, - /*makeAbsolute=*/false) == llvm::errc::success) { + /*makeAbsolute=*/false, 0664) + == llvm::errc::success) { OS.reset(new llvm::raw_fd_ostream(fd, /*shouldClose=*/true)); OSFile = TempFile = TempPath.str(); }