Skip to contentSkip to conversation

clamav: Fix issue when yara_grammar.h is regenerated.

PATCH In review Jeremy Puhlman 2 participants 6 messages Jul 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clamav: Fix issue when yara_grammar.h is regenerated.

From: Jeremy Puhlman <[email protected]>

Somewhere a long the line someone hand modified the yara_grammar.h file but didn't add code to generate the same code. The result is if the file is regenerated from the .y file it complains about a missing definition of YR_COMPILER.

This is fixed in 0.103. Backported code snippet to resolve the issue.

---
 ...yara_grammar.h-to-include-yara_compi.patch | 32 +++++++++++++++++++
 recipes-scanners/clamav/clamav_0.101.5.bb     |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch
recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch new file +32 -0
new file mode 100644
index 0000000..1abbaea
@@ -0,0 +1,32 @@
+From e7201870e19dea1bc3bc1bb16288c5135709ec6c Mon Sep 17 00:00:00 2001
+From: Jeremy Puhlman <[email protected]>
+Date: Thu, 2 Jul 2020 23:41:17 +0000
+Subject: [PATCH] force generated yara_grammar.h to include yara_compiler.h
+
+Someone manually modified yara_grammar.h to inlude yara_compiler.h,
+however if yara_grammar.h is generated from yara_grammar.y, it fails
+to build because YR_COMPILER is not defined.
+
+Upstream-Status: Backport [https://github.com/Cisco-Talos/clamav-devel/commit/8e765853d07098a13b4f352c2c77e4d3873905f6#diff-0a6403048e9f5a96598ba9d1d45c7b31]
+---
+ libclamav/yara_grammar.y | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libclamav/yara_grammar.y b/libclamav/yara_grammar.y
+index cb893975d..eb0784a2a 100644
+--- a/libclamav/yara_grammar.y
++++ b/libclamav/yara_grammar.y
+@@ -36,6 +36,10 @@ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+ 
++%code requires {
++#include "yara_compiler.h"
++}
++
+ %{
+ 
+ #include <assert.h>
+-- 
+2.24.3
+
recipes-scanners/clamav/clamav_0.101.5.bb +1 -0
index 2ea2c9b..7694265 100644
@@ -18,6 +18,7 @@ SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \
     file://tmpfiles.clamav \
     file://${BPN}.service \
     file://freshclam-native.conf \
+    file://0001-force-generated-yara_grammar.h-to-include-yara_compi.patch \
     "
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.20.1
#1 lore raw
Quoted 8 lines · Jeremy Puhlman

From: Jeremy Puhlman <[email protected]>

Somewhere a long the line someone hand modified the yara_grammar.h file but didn't add code to generate the same code. The result is if the file is regenerated from the .y file it complains about a missing definition of YR_COMPILER.

This is fixed in 0.103. Backported code snippet to resolve the issue.

I am seeing this error with this patch applied on a qemux86-64 machine.

| /home/build/builds/master/tmp/work/x86_64-linux/clamav-native/0.101.5-r0/git/libclamav/yara_grammar.y:236.19-27:
error: extra characters in character literal

|   236 |     | rules error 'include' /* .. or include statement */
|       |                   ^~~~~~~~~
|

/home/build/builds/master/tmp/work/x86_64-linux/clamav-native/0.101.5-r0/git/libclamav/yara_grammar.y:
warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
| Makefile:4247: recipe for target 'yara_grammar.c' failed

-armin

Quoted 60 lines
---
 ...yara_grammar.h-to-include-yara_compi.patch | 32 +++++++++++++++++++
 recipes-scanners/clamav/clamav_0.101.5.bb     |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch
recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch new file +32 -0
new file mode 100644
index 0000000..1abbaea
@@ -0,0 +1,32 @@
+From e7201870e19dea1bc3bc1bb16288c5135709ec6c Mon Sep 17 00:00:00 2001
+From: Jeremy Puhlman <[email protected]>
+Date: Thu, 2 Jul 2020 23:41:17 +0000
+Subject: [PATCH] force generated yara_grammar.h to include yara_compiler.h
+
+Someone manually modified yara_grammar.h to inlude yara_compiler.h,
+however if yara_grammar.h is generated from yara_grammar.y, it fails
+to build because YR_COMPILER is not defined.
+
+Upstream-Status: Backport [https://github.com/Cisco-Talos/clamav-devel/commit/8e765853d07098a13b4f352c2c77e4d3873905f6#diff-0a6403048e9f5a96598ba9d1d45c7b31]
+---
+ libclamav/yara_grammar.y | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libclamav/yara_grammar.y b/libclamav/yara_grammar.y
+index cb893975d..eb0784a2a 100644
+--- a/libclamav/yara_grammar.y
++++ b/libclamav/yara_grammar.y
+@@ -36,6 +36,10 @@ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+ 
++%code requires {
++#include "yara_compiler.h"
++}
++
+ %{
+ 
+ #include <assert.h>
+-- 
+2.24.3
+
recipes-scanners/clamav/clamav_0.101.5.bb +1 -0
index 2ea2c9b..7694265 100644
@@ -18,6 +18,7 @@ SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \
     file://tmpfiles.clamav \
     file://${BPN}.service \
     file://freshclam-native.conf \
+    file://0001-force-generated-yara_grammar.h-to-include-yara_compi.patch \
     "
 
 S = "${WORKDIR}/git"
#2 lore raw
Quoted 9 lines · Jeremy Puhlman
Quoted 8 lines

From: Jeremy Puhlman<[email protected]>

Somewhere a long the line someone hand modified the yara_grammar.h file but didn't add code to generate the same code. The result is if the file is regenerated from the .y file it complains about a missing definition of YR_COMPILER.

This is fixed in 0.103. Backported code snippet to resolve the issue.

Quoted 7 lines

I am seeing this error with this patch applied on a qemux86-64 machine.

| /home/build/builds/master/tmp/work/x86_64-linux/clamav-native/0.101.5-r0/git/libclamav/yara_grammar.y:236.19-27: error: extra characters in character literal
|   236 |     | rules error 'include' /* .. or include statement */
|       |                   ^~~~~~~~~
| /home/build/builds/master/tmp/work/x86_64-linux/clamav-native/0.101.5-r0/git/libclamav/yara_grammar.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
| Makefile:4247: recipe for target 'yara_grammar.c' failed

Weird we should be using common bison/lex. You are building on a ubuntu host correct?

Quoted 69 lines

-armin

Quoted 52 lines
---
  ...yara_grammar.h-to-include-yara_compi.patch | 32 +++++++++++++++++++
  recipes-scanners/clamav/clamav_0.101.5.bb     |  1 +
  2 files changed, 33 insertions(+)

create mode 100644 recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch

recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch new file +32 -0
new file mode 100644
index 0000000..1abbaea
@@ -0,0 +1,32 @@
+From e7201870e19dea1bc3bc1bb16288c5135709ec6c Mon Sep 17 00:00:00 2001
+From: Jeremy Puhlman<[email protected]>
+Date: Thu, 2 Jul 2020 23:41:17 +0000
+Subject: [PATCH] force generated yara_grammar.h to include yara_compiler.h
+
+Someone manually modified yara_grammar.h to inlude yara_compiler.h,
+however if yara_grammar.h is generated from yara_grammar.y, it fails
+to build because YR_COMPILER is not defined.
+
+Upstream-Status: Backport [https://github.com/Cisco-Talos/clamav-devel/commit/8e765853d07098a13b4f352c2c77e4d3873905f6#diff-0a6403048e9f5a96598ba9d1d45c7b31]
+---
+ libclamav/yara_grammar.y | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libclamav/yara_grammar.y b/libclamav/yara_grammar.y
+index cb893975d..eb0784a2a 100644
+--- a/libclamav/yara_grammar.y
++++ b/libclamav/yara_grammar.y
+@@ -36,6 +36,10 @@ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
++%code requires {
++#include "yara_compiler.h"
++}
++
+ %{
+
+ #include <assert.h>
+--
+2.24.3
+
recipes-scanners/clamav/clamav_0.101.5.bb +0 -0
index 2ea2c9b..7694265 100644

recipes-scanners/clamav/clamav_0.101.5.bb SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \ · line 24

Quoted 7 lines
recipes-scanners/clamav/clamav_0.101.5.bb +1 -0
@@ -18,6 +18,7 @@ SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \
      file://tmpfiles.clamav  \
      file://${BPN}.service \
      file://freshclam-native.conf  \
+file://0001-force-generated-yara_grammar.h-to-include-yara_compi.patch  \
      "
 
  S = "${WORKDIR}/git"

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
Virus-free. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Signature · 2 lines
Jeremy A. Puhlman
[email protected]
#3 lore raw
Quoted 23 lines · Jeremy Puhlman
Quoted 14 lines · Jeremy Puhlman
Quoted 8 lines

From: Jeremy Puhlman <[email protected]>

Somewhere a long the line someone hand modified the yara_grammar.h file but didn't add code to generate the same code. The result is if the file is regenerated from the .y file it complains about a missing definition of YR_COMPILER.

This is fixed in 0.103. Backported code snippet to resolve the issue.

I am seeing this error with this patch applied on a qemux86-64 machine.

| /home/build/builds/master/tmp/work/x86_64-linux/clamav-native/0.101.5-r0/git/libclamav/yara_grammar.y:236.19-27:
error: extra characters in character literal

Quoted 6 lines
|   236 |     | rules error 'include' /* .. or include statement */
|       |                   ^~~~~~~~~
|

/home/build/builds/master/tmp/work/x86_64-linux/clamav-native/0.101.5-r0/git/libclamav/yara_grammar.y:
warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
| Makefile:4247: recipe for target 'yara_grammar.c' failed

Quoted 2 lines

Weird we should be using common bison/lex. You are building on a ubuntu host correct?

yes

Quoted 75 lines
Quoted 69 lines

-armin

Quoted 51 lines
---
 ...yara_grammar.h-to-include-yara_compi.patch | 32 +++++++++++++++++++
 recipes-scanners/clamav/clamav_0.101.5.bb     |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch
recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch new file +32 -0
new file mode 100644
index 0000000..1abbaea
@@ -0,0 +1,32 @@
+From e7201870e19dea1bc3bc1bb16288c5135709ec6c Mon Sep 17 00:00:00 2001
+From: Jeremy Puhlman <[email protected]>
+Date: Thu, 2 Jul 2020 23:41:17 +0000
+Subject: [PATCH] force generated yara_grammar.h to include yara_compiler.h
+
+Someone manually modified yara_grammar.h to inlude yara_compiler.h,
+however if yara_grammar.h is generated from yara_grammar.y, it fails
+to build because YR_COMPILER is not defined.
+
+Upstream-Status: Backport [https://github.com/Cisco-Talos/clamav-devel/commit/8e765853d07098a13b4f352c2c77e4d3873905f6#diff-0a6403048e9f5a96598ba9d1d45c7b31]
+---
+ libclamav/yara_grammar.y | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libclamav/yara_grammar.y b/libclamav/yara_grammar.y
+index cb893975d..eb0784a2a 100644
+--- a/libclamav/yara_grammar.y
++++ b/libclamav/yara_grammar.y
+@@ -36,6 +36,10 @@ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+ 
++%code requires {
++#include "yara_compiler.h"
++}
++
+ %{
+ 
+ #include <assert.h>
+-- 
+2.24.3
+
recipes-scanners/clamav/clamav_0.101.5.bb +0 -0
index 2ea2c9b..7694265 100644

recipes-scanners/clamav/clamav_0.101.5.bb SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \ · line 24

Quoted 7 lines
recipes-scanners/clamav/clamav_0.101.5.bb +1 -0
@@ -18,6 +18,7 @@ SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \
     file://tmpfiles.clamav \
     file://${BPN}.service \
     file://freshclam-native.conf \
+    file://0001-force-generated-yara_grammar.h-to-include-yara_compi.patch \
     "
 
 S = "${WORKDIR}/git"

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
Virus-free. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Signature · 2 lines
Jeremy A. Puhlman
[email protected]
#4 lore raw
In reply to Jeremy Puhlman
Quoted 13 lines · Jeremy Puhlman
Quoted 11 lines · Jeremy Puhlman
Quoted 8 lines

From: Jeremy Puhlman <[email protected]>

Somewhere a long the line someone hand modified the yara_grammar.h file but didn't add code to generate the same code. The result is if the file is regenerated from the .y file it complains about a missing definition of YR_COMPILER.

This is fixed in 0.103. Backported code snippet to resolve the issue.

I am seeing this error with this patch applied on a qemux86-64 machine.

Quoted 10 lines
Quoted 9 lines

| /home/build/builds/master/tmp/work/x86_64-linux/clamav-native/0.101.5-r0/git/libclamav/yara_grammar.y:236.19-27:
error: extra characters in character literal

|   236 |     | rules error 'include' /* .. or include statement */
|       |                   ^~~~~~~~~
|

/home/build/builds/master/tmp/work/x86_64-linux/clamav-native/0.101.5-r0/git/libclamav/yara_grammar.y:
warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
| Makefile:4247: recipe for target 'yara_grammar.c' failed

i am also seeing this while working on updating master to 102.3.

-armin

Quoted 77 lines

Weird we should be using common bison/lex. You are building on a ubuntu host correct?

Quoted 68 lines

-armin

Quoted 51 lines
---
 ...yara_grammar.h-to-include-yara_compi.patch | 32 +++++++++++++++++++
 recipes-scanners/clamav/clamav_0.101.5.bb     |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch
recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch new file +32 -0
new file mode 100644
index 0000000..1abbaea
@@ -0,0 +1,32 @@
+From e7201870e19dea1bc3bc1bb16288c5135709ec6c Mon Sep 17 00:00:00 2001
+From: Jeremy Puhlman <[email protected]>
+Date: Thu, 2 Jul 2020 23:41:17 +0000
+Subject: [PATCH] force generated yara_grammar.h to include yara_compiler.h
+
+Someone manually modified yara_grammar.h to inlude yara_compiler.h,
+however if yara_grammar.h is generated from yara_grammar.y, it fails
+to build because YR_COMPILER is not defined.
+
+Upstream-Status: Backport [https://github.com/Cisco-Talos/clamav-devel/commit/8e765853d07098a13b4f352c2c77e4d3873905f6#diff-0a6403048e9f5a96598ba9d1d45c7b31]
+---
+ libclamav/yara_grammar.y | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libclamav/yara_grammar.y b/libclamav/yara_grammar.y
+index cb893975d..eb0784a2a 100644
+--- a/libclamav/yara_grammar.y
++++ b/libclamav/yara_grammar.y
+@@ -36,6 +36,10 @@ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+ 
++%code requires {
++#include "yara_compiler.h"
++}
++
+ %{
+ 
+ #include <assert.h>
+-- 
+2.24.3
+
recipes-scanners/clamav/clamav_0.101.5.bb +0 -0
index 2ea2c9b..7694265 100644

recipes-scanners/clamav/clamav_0.101.5.bb SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \ · line 24

Quoted 7 lines
recipes-scanners/clamav/clamav_0.101.5.bb +1 -0
@@ -18,6 +18,7 @@ SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \
     file://tmpfiles.clamav \
     file://${BPN}.service \
     file://freshclam-native.conf \
+    file://0001-force-generated-yara_grammar.h-to-include-yara_compi.patch \
     "
 
 S = "${WORKDIR}/git"

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
Virus-free. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Signature · 2 lines
Jeremy A. Puhlman
[email protected]
#5 lore raw
Quoted 16 lines · On 7/3/2020 10:55 AM, akuster808 wrote:
Quoted 13 lines · Jeremy Puhlman
Quoted 11 lines · Jeremy Puhlman
Quoted 8 lines

From: Jeremy Puhlman<[email protected]>

Somewhere a long the line someone hand modified the yara_grammar.h file but didn't add code to generate the same code. The result is if the file is regenerated from the .y file it complains about a missing definition of YR_COMPILER.

This is fixed in 0.103. Backported code snippet to resolve the issue.

I am seeing this error with this patch applied on a qemux86-64 machine.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
| /home/build/builds/master/tmp/work/x86_64-linux/clamav-native/0.101.5-r0/git/libclamav/yara_grammar.y:236.19-27: error: extra characters in character literal
|   236 |     | rules error 'include' /* .. or include statement */
|       |                   ^~~~~~~~~
| /home/build/builds/master/tmp/work/x86_64-linux/clamav-native/0.101.5-r0/git/libclamav/yara_grammar.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
| Makefile:4247: recipe for target 'yara_grammar.c' failed

i am also seeing this while working on updating master to 102.3.

I think it may be the update to bison tightening rules, perhaps. I have a local build reproducing it on 0.101, Ill take a look at it next week.

Quoted 79 lines

-armin

Quoted 76 lines

Weird we should be using common bison/lex. You are building on a ubuntu host correct?

Quoted 68 lines

-armin

Quoted 51 lines
---
  ...yara_grammar.h-to-include-yara_compi.patch | 32 +++++++++++++++++++
  recipes-scanners/clamav/clamav_0.101.5.bb     |  1 +
  2 files changed, 33 insertions(+)

create mode 100644 recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch

recipes-scanners/clamav/clamav-0.101.5/0001-force-generated-yara_grammar.h-to-include-yara_compi.patch new file +32 -0
new file mode 100644
index 0000000..1abbaea
@@ -0,0 +1,32 @@
+From e7201870e19dea1bc3bc1bb16288c5135709ec6c Mon Sep 17 00:00:00 2001
+From: Jeremy Puhlman<[email protected]>
+Date: Thu, 2 Jul 2020 23:41:17 +0000
+Subject: [PATCH] force generated yara_grammar.h to include yara_compiler.h
+
+Someone manually modified yara_grammar.h to inlude yara_compiler.h,
+however if yara_grammar.h is generated from yara_grammar.y, it fails
+to build because YR_COMPILER is not defined.
+
+Upstream-Status: Backport [https://github.com/Cisco-Talos/clamav-devel/commit/8e765853d07098a13b4f352c2c77e4d3873905f6#diff-0a6403048e9f5a96598ba9d1d45c7b31]
+---
+ libclamav/yara_grammar.y | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libclamav/yara_grammar.y b/libclamav/yara_grammar.y
+index cb893975d..eb0784a2a 100644
+--- a/libclamav/yara_grammar.y
++++ b/libclamav/yara_grammar.y
+@@ -36,6 +36,10 @@ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
++%code requires {
++#include "yara_compiler.h"
++}
++
+ %{
+
+ #include <assert.h>
+--
+2.24.3
+
recipes-scanners/clamav/clamav_0.101.5.bb +0 -0
index 2ea2c9b..7694265 100644

recipes-scanners/clamav/clamav_0.101.5.bb SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \ · line 24

Quoted 7 lines
recipes-scanners/clamav/clamav_0.101.5.bb +1 -0
@@ -18,6 +18,7 @@ SRC_URI = "git://github.com/vrtadmin/clamav-devel;branch=rel/0.101 \
      file://tmpfiles.clamav  \
      file://${BPN}.service \
      file://freshclam-native.conf  \
+file://0001-force-generated-yara_grammar.h-to-include-yara_compi.patch  \
      "
 
  S = "${WORKDIR}/git"

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
Virus-free. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Signature · 2 lines
Jeremy A. Puhlman
[email protected]
Signature · 2 lines
Jeremy A. Puhlman
[email protected]