Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 May 2018 00:35:03 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r469343 - in head/www/firefox: . files
Message-ID:  <201805080035.w480Z3LP032246@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Tue May  8 00:35:03 2018
New Revision: 469343
URL: https://svnweb.freebsd.org/changeset/ports/469343

Log:
  www/firefox: close unwanted fds

Added:
  head/www/firefox/files/patch-bug1400051   (contents, props changed)
Modified:
  head/www/firefox/Makefile   (contents, props changed)

Modified: head/www/firefox/Makefile
==============================================================================
--- head/www/firefox/Makefile	Tue May  8 00:34:51 2018	(r469342)
+++ head/www/firefox/Makefile	Tue May  8 00:35:03 2018	(r469343)
@@ -3,7 +3,7 @@
 
 PORTNAME=	firefox
 DISTVERSION=	60.0
-PORTREVISION=	2
+PORTREVISION=	3
 PORTEPOCH=	1
 CATEGORIES=	www ipv6
 MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \

Added: head/www/firefox/files/patch-bug1400051
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/firefox/files/patch-bug1400051	Tue May  8 00:35:03 2018	(r469343)
@@ -0,0 +1,157 @@
+Switch to fork/exec on BSDs due to lack of POSIX_SPAWN_CLOEXEC_DEFAULT
+
+diff --git ipc/chromium/moz.build ipc/chromium/moz.build
+index 7888251982e8e..fc80456237765 100644
+--- ipc/chromium/moz.build
++++ ipc/chromium/moz.build
+@@ -93,21 +93,7 @@ if os_macosx:
+         'src/base/platform_thread_mac.mm',
+     ]
+ 
+-if os_bsd:
+-    SOURCES += [
+-        'src/base/atomicops_internals_x86_gcc.cc',
+-        'src/base/time_posix.cc',
+-    ]
+-    if CONFIG['OS_ARCH'] == 'GNU_kFreeBSD':
+-        SOURCES += [
+-            'src/base/process_util_linux.cc'
+-        ]
+-    else:
+-        SOURCES += [
+-            'src/base/process_util_bsd.cc'
+-        ]
+-
+-if os_linux:
++if os_posix and not os_macosx:
+     SOURCES += [
+         'src/base/atomicops_internals_x86_gcc.cc',
+         'src/base/process_util_linux.cc',
+@@ -119,20 +105,11 @@ if os_linux:
+         ]
+         DEFINES['ANDROID'] = True
+         DEFINES['_POSIX_MONOTONIC_CLOCK'] = 0
+-
+-if os_bsd or os_linux:
+     if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
+         SOURCES += [
+             'src/base/message_pump_glib.cc',
+         ]
+ 
+-if os_solaris:
+-    SOURCES += [
+-        'src/base/atomicops_internals_x86_gcc.cc',
+-        'src/base/process_util_linux.cc',
+-        'src/base/time_posix.cc',
+-    ]
+-
+ ost = CONFIG['OS_TEST']
+ if '86' not in ost and 'arm' not in ost and 'aarch64' != ost and 'mips' not in ost:
+     SOURCES += [
+diff --git ipc/chromium/src/base/process_util_bsd.cc ipc/chromium/src/base/process_util_bsd.cc
+deleted file mode 100644
+index 614a5e55116cd..0000000000000
+--- ipc/chromium/src/base/process_util_bsd.cc
++++ /dev/null
+@@ -1,101 +0,0 @@
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style license that can be
+-// found in the LICENSE file.
+-
+-// derived from process_util_mac.cc
+-
+-#include "base/process_util.h"
+-
+-#include <fcntl.h>
+-#include <spawn.h>
+-#include <sys/wait.h>
+-
+-#include <string>
+-
+-#include "base/eintr_wrapper.h"
+-
+-namespace {
+-
+-static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG");
+-
+-}  // namespace
+-
+-namespace base {
+-
+-
+-bool LaunchApp(const std::vector<std::string>& argv,
+-               const LaunchOptions& options,
+-               ProcessHandle* process_handle)
+-{
+-  bool retval = true;
+-
+-  char* argv_copy[argv.size() + 1];
+-  for (size_t i = 0; i < argv.size(); i++) {
+-    argv_copy[i] = const_cast<char*>(argv[i].c_str());
+-  }
+-  argv_copy[argv.size()] = NULL;
+-
+-  // Make sure we don't leak any FDs to the child process by marking all FDs
+-  // as close-on-exec.
+-  SetAllFDsToCloseOnExec();
+-
+-  EnvironmentArray vars = BuildEnvironmentArray(options.env_map);
+-
+-  posix_spawn_file_actions_t file_actions;
+-  if (posix_spawn_file_actions_init(&file_actions) != 0) {
+-    return false;
+-  }
+-
+-  // Turn fds_to_remap array into a set of dup2 calls.
+-  for (const auto& fd_map : options.fds_to_remap) {
+-    int src_fd = fd_map.first;
+-    int dest_fd = fd_map.second;
+-
+-    if (src_fd == dest_fd) {
+-      int flags = fcntl(src_fd, F_GETFD);
+-      if (flags != -1) {
+-        fcntl(src_fd, F_SETFD, flags & ~FD_CLOEXEC);
+-      }
+-    } else {
+-      if (posix_spawn_file_actions_adddup2(&file_actions, src_fd, dest_fd) != 0) {
+-        posix_spawn_file_actions_destroy(&file_actions);
+-        return false;
+-      }
+-    }
+-  }
+-
+-  pid_t pid = 0;
+-  int spawn_succeeded = (posix_spawnp(&pid,
+-                                      argv_copy[0],
+-                                      &file_actions,
+-                                      NULL,
+-                                      argv_copy,
+-                                      vars.get()) == 0);
+-
+-  posix_spawn_file_actions_destroy(&file_actions);
+-
+-  bool process_handle_valid = pid > 0;
+-  if (!spawn_succeeded || !process_handle_valid) {
+-    retval = false;
+-  } else {
+-    gProcessLog.print("==> process %d launched child process %d\n",
+-                      GetCurrentProcId(), pid);
+-    if (options.wait)
+-      HANDLE_EINTR(waitpid(pid, 0, 0));
+-
+-    if (process_handle)
+-      *process_handle = pid;
+-  }
+-
+-  return retval;
+-}
+-
+-bool LaunchApp(const CommandLine& cl,
+-               const LaunchOptions& options,
+-               ProcessHandle* process_handle) {
+-  return LaunchApp(cl.argv(), options, process_handle);
+-}
+-
+-}  // namespace base



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805080035.w480Z3LP032246>