From owner-svn-ports-head@FreeBSD.ORG Thu Feb 6 17:48:26 2014 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42C89964; Thu, 6 Feb 2014 17:48:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 20D461194; Thu, 6 Feb 2014 17:48:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s16HmPAC047730; Thu, 6 Feb 2014 17:48:25 GMT (envelope-from nox@svn.freebsd.org) Received: (from nox@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s16HmPUx047728; Thu, 6 Feb 2014 17:48:25 GMT (envelope-from nox@svn.freebsd.org) Message-Id: <201402061748.s16HmPUx047728@svn.freebsd.org> From: Juergen Lock Date: Thu, 6 Feb 2014 17:48:25 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r343128 - in head/emulators/qemu-devel: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Feb 2014 17:48:26 -0000 Author: nox Date: Thu Feb 6 17:48:25 2014 New Revision: 343128 URL: http://svnweb.freebsd.org/changeset/ports/343128 QAT: https://qat.redports.org/buildarchive/r343128/ Log: - Fix bsd-user targets running scripts with shebang args. [1] - Bump PORTREVISION as per the new ruling. (fix only affecting non-default option BSD_USER) PR: ports/186490 [1] Submitted by: mat [1] Added: head/emulators/qemu-devel/files/extra-patch-bsd-user-freebsd-os-proc.c (contents, props changed) Modified: head/emulators/qemu-devel/Makefile Modified: head/emulators/qemu-devel/Makefile ============================================================================== --- head/emulators/qemu-devel/Makefile Thu Feb 6 17:36:38 2014 (r343127) +++ head/emulators/qemu-devel/Makefile Thu Feb 6 17:48:25 2014 (r343128) @@ -3,7 +3,7 @@ PORTNAME= qemu PORTVERSION= 1.7.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= emulators MASTER_SITES= http://wiki.qemu.org/download/:release \ LOCAL/nox:snapshot @@ -67,6 +67,7 @@ PATCHFILES= \ 0017-bsd-user-add-support-for-miscellaneous-system-calls.patch \ 0018-bsd-user-add-arm-mips-and-mips64-options-to-configur.patch PATCH_DIST_STRIP= -p1 +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bsd-user-freebsd-os-proc.c .endif CONFIGURE_ARGS+= --extra-ldflags=-L${LOCALBASE}/lib Added: head/emulators/qemu-devel/files/extra-patch-bsd-user-freebsd-os-proc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/qemu-devel/files/extra-patch-bsd-user-freebsd-os-proc.c Thu Feb 6 17:48:25 2014 (r343128) @@ -0,0 +1,116 @@ +--- a/bsd-user/freebsd/os-proc.c +--- b/bsd-user/freebsd/os-proc.c +@@ -83,7 +83,7 @@ out: + } + + static int +-is_target_shell_script(int fd, char *interp, size_t size) ++is_target_shell_script(int fd, char *interp, size_t size, char **interp_args) + { + char buf[2], *p, *b; + ssize_t n; +@@ -120,7 +120,21 @@ is_target_shell_script(int fd, char *int + return 0; + } + if ((p = memchr(b, '\n', size)) != NULL) { ++ int hasargs = 0; + *p = 0; ++ ++ *interp_args = NULL; ++ p = interp; ++ while (*p) { ++ if ((*p == ' ') || (*p == '\t')) { ++ hasargs = 1; ++ *p = 0; ++ } else if (hasargs) { ++ *interp_args = p; ++ break; ++ } ++ ++p; ++ } + return 1; + } + b += n; +@@ -136,7 +150,7 @@ is_target_shell_script(int fd, char *int + abi_long freebsd_exec_common(abi_ulong path_or_fd, abi_ulong guest_argp, + abi_ulong guest_envp, int do_fexec) + { +- char **argp, **envp, **qargp, **qarg1, **qarg0; ++ char **argp, **envp, **qargp, **qarg1, **qarg0, **qargend; + int argc, envc; + abi_ulong gp; + abi_ulong addr; +@@ -166,7 +180,7 @@ abi_long freebsd_exec_common(abi_ulong p + envc++; + } + +- qarg0 = argp = alloca((argc + 4) * sizeof(void *)); ++ qarg0 = argp = alloca((argc + 5) * sizeof(void *)); + /* save the first agrument for the emulator */ + *argp++ = (char *)getprogname(); + qargp = argp; +@@ -188,7 +202,8 @@ abi_long freebsd_exec_common(abi_ulong p + } + total_size += strlen(*q) + 1; + } +- *q = NULL; ++ *q++ = NULL; ++ qargend = q; + + for (gp = guest_envp, q = envp; gp; gp += sizeof(abi_ulong), q++) { + if (get_user_ual(addr, gp)) { +@@ -217,7 +232,7 @@ abi_long freebsd_exec_common(abi_ulong p + } + + if (do_fexec) { +- char execpath[PATH_MAX]; ++ char execpath[PATH_MAX], *scriptargs; + + if (((int)path_or_fd > 0 && + is_target_elf_binary((int)path_or_fd)) == 1) { +@@ -238,7 +253,7 @@ abi_long freebsd_exec_common(abi_ulong p + goto execve_end; + } + } else if (is_target_shell_script((int)path_or_fd, execpath, +- sizeof(execpath)) != 0) { ++ sizeof(execpath), &scriptargs) != 0) { + char scriptpath[PATH_MAX]; + + /* execve() as a target script using emulator. */ +@@ -246,6 +261,10 @@ abi_long freebsd_exec_common(abi_ulong p + sizeof(scriptpath)) != NULL) { + *qargp = execpath; + *qarg1 = scriptpath; ++ if (scriptargs) { ++ memmove(qarg1 + 1, qarg1, (qargend-qarg1) * sizeof(*qarg1)); ++ *qarg1 = scriptargs; ++ } + ret = get_errno(execve(qemu_proc_pathname, qarg0, envp)); + } else { + ret = -TARGET_EBADF; +@@ -256,7 +275,7 @@ abi_long freebsd_exec_common(abi_ulong p + } + } else { + int fd; +- char execpath[PATH_MAX]; ++ char execpath[PATH_MAX], *scriptargs; + + p = lock_user_string(path_or_fd); + if (p == NULL) { +@@ -275,11 +294,15 @@ abi_long freebsd_exec_common(abi_ulong p + *qarg1 = (char *)p; + ret = get_errno(execve(qemu_proc_pathname, qargp, envp)); + } else if (is_target_shell_script(fd, execpath, +- sizeof(execpath)) != 0) { ++ sizeof(execpath), &scriptargs) != 0) { + close(fd); + /* execve() as a target script using emulator. */ + *qargp = execpath; + *qarg1 = (char *)p; ++ if (scriptargs) { ++ memmove(qarg1 + 1, qarg1, (qargend-qarg1) * sizeof(*qarg1)); ++ *qarg1 = scriptargs; ++ } + ret = get_errno(execve(qemu_proc_pathname, qarg0, envp)); + } else { + close(fd);