diff mbox

bash: fix string format errors when enabling security flags

Message ID 1468511006-4514-1-git-send-email-ross.burton@intel.com
State Accepted
Commit 293d90d757d0d1e292c90cb0e9c576faf911ffcc
Headers show

Commit Message

Ross Burton July 14, 2016, 3:43 p.m. UTC
If security_flags.inc is included then bash 3.2.48 fails to build:

| ../bash-3.2.48/print_cmd.c:1152:3: error: format not a string literal and no format arguments [-Werror=format-security]
|    cprintf (indentation_string);

Backport a patch from upstream to solve this.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 .../bash/bash-3.2.48/string-format.patch            | 21 +++++++++++++++++++++
 meta/recipes-extended/bash/bash_3.2.48.bb           |  1 +
 2 files changed, 22 insertions(+)
 create mode 100644 meta/recipes-extended/bash/bash-3.2.48/string-format.patch

-- 
2.8.1

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox

Patch

diff --git a/meta/recipes-extended/bash/bash-3.2.48/string-format.patch b/meta/recipes-extended/bash/bash-3.2.48/string-format.patch
new file mode 100644
index 0000000..eda3964
--- /dev/null
+++ b/meta/recipes-extended/bash/bash-3.2.48/string-format.patch
@@ -0,0 +1,21 @@ 
+Fix a string format warning when using security flags:
+
+| ../bash-3.2.48/print_cmd.c:1152:3: error: format not a string literal and no format arguments [-Werror=format-security]
+|    cprintf (indentation_string);
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/print_cmd.c b/print_cmd.c
+index d1dfd1a..956db53 100644
+--- a/print_cmd.c
++++ b/print_cmd.c
+@@ -1149,7 +1149,7 @@ indent (amount)
+   for (i = 0; amount > 0; amount--)
+     indentation_string[i++] = ' ';
+   indentation_string[i] = '\0';
+-  cprintf (indentation_string);
++  cprintf ("%s", indentation_string);
+ }
+ 
+ static void
diff --git a/meta/recipes-extended/bash/bash_3.2.48.bb b/meta/recipes-extended/bash/bash_3.2.48.bb
index d42b292..6b4028d 100644
--- a/meta/recipes-extended/bash/bash_3.2.48.bb
+++ b/meta/recipes-extended/bash/bash_3.2.48.bb
@@ -20,6 +20,7 @@  SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz;name=tarball \
            file://test-output.patch \
            file://run-ptest \
            file://dont-include-target-CFLAGS-in-host-LDFLAGS.patch \
+           file://string-format.patch \
           "
 
 SRC_URI[tarball.md5sum] = "338dcf975a93640bb3eaa843ca42e3f8"