From patchwork Thu Nov 22 11:59:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1001718 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=datacom.com.br Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 430yft5wN3z9s5c for ; Thu, 22 Nov 2018 22:59:49 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 20ABC87945; Thu, 22 Nov 2018 11:59:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mbTf1FvW4saD; Thu, 22 Nov 2018 11:59:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 98813876A2; Thu, 22 Nov 2018 11:59:44 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 950E61C22DE for ; Thu, 22 Nov 2018 11:59:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 922DA30A4E for ; Thu, 22 Nov 2018 11:59:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rGnXudouLKm2 for ; Thu, 22 Nov 2018 11:59:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.datacom.com.br (mx.datacom.ind.br [177.66.5.10]) by silver.osuosl.org (Postfix) with ESMTPS id 8210530A4D for ; Thu, 22 Nov 2018 11:59:41 +0000 (UTC) Received: from mail.datacom.com.br (localhost [127.0.0.1]) by mail.datacom.com.br (Postfix) with ESMTPS id D02911BA4096 for ; Thu, 22 Nov 2018 10:00:17 -0200 (-02) Received: from localhost (localhost [127.0.0.1]) by mail.datacom.com.br (Postfix) with ESMTP id BCE4C1BA40AA for ; Thu, 22 Nov 2018 10:00:17 -0200 (-02) Received: from mail.datacom.com.br ([127.0.0.1]) by localhost (mail.datacom.com.br [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id yv-IscaL5bdG for ; Thu, 22 Nov 2018 10:00:17 -0200 (-02) Received: from pedeld202344.datacom.net (pedeld202344.datacom.net [10.0.120.87]) by mail.datacom.com.br (Postfix) with ESMTPSA id 4DE2C1BA4096 for ; Thu, 22 Nov 2018 10:00:17 -0200 (-02) From: Carlos Santos To: buildroot@buildroot.org Date: Thu, 22 Nov 2018 09:59:30 -0200 Message-Id: <20181122115930.21278-1-casantos@datacom.com.br> X-Mailer: git-send-email 2.14.5 Subject: [Buildroot] [PATCH next] util-linux: fix build for SPARC X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Pull a patch already applied upstream that fixes the build of setarch for SPARC processors. Fixes: http://autobuild.buildroot.net/results/44d0538332499cea691a381048562a09cda23624 http://autobuild.buildroot.net/results/e7e3469717ab27d66d2528087fd7c3a41477ae05 Signed-off-by: Carlos Santos --- ...-setarch-fix-obscure-sparc32bash-use-case.patch | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 package/util-linux/0003-setarch-fix-obscure-sparc32bash-use-case.patch diff --git a/package/util-linux/0003-setarch-fix-obscure-sparc32bash-use-case.patch b/package/util-linux/0003-setarch-fix-obscure-sparc32bash-use-case.patch new file mode 100644 index 0000000000..f52421618f --- /dev/null +++ b/package/util-linux/0003-setarch-fix-obscure-sparc32bash-use-case.patch @@ -0,0 +1,83 @@ +From 3fa06e049012218d883d0e1251df86bafbc446bf Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 22 Nov 2018 11:03:35 +0100 +Subject: [PATCH] setarch: fix obscure sparc32bash use-case + +Reported-by: Carlos Santos +Signed-off-by: Karel Zak +--- + sys-utils/setarch.c | 28 ++++++++++++++++++---------- + 1 file changed, 18 insertions(+), 10 deletions(-) + +diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c +index a733f7b3c..7c0a63fbb 100644 +--- a/sys-utils/setarch.c ++++ b/sys-utils/setarch.c +@@ -268,6 +268,7 @@ int main(int argc, char *argv[]) + int c; + struct arch_domain *doms, *target; + unsigned long pers_value = 0; ++ char *shell = NULL, *shell_arg = NULL; + + /* Options without equivalent short options */ + enum { +@@ -310,14 +311,14 @@ int main(int argc, char *argv[]) + archwrapper = strcmp(program_invocation_short_name, "setarch") != 0; + if (archwrapper) { + arch = program_invocation_short_name; /* symlinks to setarch */ +-#if defined(__sparc64__) || defined(__sparc__) ++ ++ /* Don't use ifdef sparc here, we get "Unrecognized architecture" ++ * error message later if necessary */ + if (strcmp(arch, "sparc32bash") == 0) { +- if (set_arch(arch, 0L, 0)) +- err(EXIT_FAILURE, _("Failed to set personality to %s"), arch); +- execl("/bin/bash", "", NULL); +- errexec("/bin/bash"); ++ shell = "/bin/bash"; ++ shell_arg = ""; ++ goto set_arch; + } +-#endif + } else { + if (1 < argc && *argv[1] != '-') { + arch = argv[1]; +@@ -391,6 +392,7 @@ int main(int argc, char *argv[]) + argc -= optind; + argv += optind; + ++set_arch: + /* get execution domain (architecture) */ + if (arch) { + doms = init_arch_domains(); +@@ -422,17 +424,23 @@ int main(int argc, char *argv[]) + if (arch) + verify_arch_domain(target, arch); + ++ if (!argc) { ++ shell = "/bin/sh"; ++ shell_arg = "-sh"; ++ } + if (verbose) { +- printf(_("Execute command `%s'.\n"), argc ? argv[0] : "/bin/sh"); ++ printf(_("Execute command `%s'.\n"), shell ? shell : argv[0]); + /* flush all output streams before exec */ + fflush(NULL); + } + +- if (!argc) { +- execl("/bin/sh", "-sh", NULL); +- errexec("/bin/sh"); ++ /* Execute shell */ ++ if (shell) { ++ execl(shell, shell_arg, NULL); ++ errexec(shell); + } + ++ /* Execute on command line specified command */ + execvp(argv[0], argv); + errexec(argv[0]); + } +-- +2.14.5 +