Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing error: JAVA_OPTS:: bad variable name #1231

Open
dnelaturi opened this issue Apr 28, 2023 · 1 comment
Open

Parsing error: JAVA_OPTS:: bad variable name #1231

dnelaturi opened this issue Apr 28, 2023 · 1 comment
Labels
bug Something went wrong

Comments

@dnelaturi
Copy link

while running tern on container image with alpine base image seeing following errors

    Layer 2:
            info: Layer created by commands: /bin/sh -c apk add --no-cache openjdk17
            info: Retrieved package metadata using apk default method.

            error: /bin/sh: export: line 0: JAVA_OPTS:: bad variable name

/bin/sh: export: line 0: JAVA_OPTS:: bad variable name
/bin/sh: export: line 0: JAVA_OPTS:: bad variable name
/bin/sh: export: line 0: JAVA_OPTS:: bad variable name
/bin/sh: export: line 0: JAVA_OPTS:: bad variable name
/bin/sh: export: line 0: JAVA_OPTS:: bad variable name
/bin/sh: export: line 0: JAVA_OPTS:: bad variable name

    File licenses found in Layer:  None
    Packages found in Layer: None

To Reproduce
Steps to reproduce the behavior:

  1. run tern scan from docker image (ternd report -w test.tar -o test.txt)

  2. seeing this error
    2023-04-28 12:56:09,110 - ERROR - rootfs - Command failed. /bin/sh: export: line 0: JAVA_OPTS:: bad variable name

  3. for image layer1 the output is clean
    Layer 1:
    info: Layer created by commands: /bin/sh -c #(nop) ADD file:9a4f77dfaba7fd2aa78186e4ef0e7486ad55101cefc1fabbc1b385601bb38920 in /
    info: Found 'Alpine Linux v3.17' in /etc/os-release.
    info: Retrieved package metadata using apk default method.

     File licenses found in Layer:  None
     Packages found in Layer:
     +------------------------+-------------+-------------------------------------------+------------+
     | Package                | Version     | License(s)                                | Pkg Format |
     +------------------------+-------------+-------------------------------------------+------------+
     | alpine-baselayout-data | 3.4.0-r0    | GPL-2.0-only                              | apk        |
     | musl                   | 1.2.3-r4    | MIT                                       | apk        |
     | busybox                | 1.35.0-r29  | GPL-2.0-only                              | apk        |
     | busybox-binsh          | 1.35.0-r29  | GPL-2.0-only                              | apk        |
     | alpine-baselayout      | 3.4.0-r0    | GPL-2.0-only                              | apk        |
     | alpine-keys            | 2.4-r1      | MIT                                       | apk        |
     | ca-certificates-bundle | 20220614-r4 | MPL-2.0 AND MIT                           | apk        |
     | libcrypto3             | 3.0.8-r3    | Apache-2.0                                | apk        |
     | libssl3                | 3.0.8-r3    | Apache-2.0                                | apk        |
     | ssl_client             | 1.35.0-r29  | GPL-2.0-only                              | apk        |
     | zlib                   | 1.2.13-r0   | Zlib                                      | apk        |
     | apk-tools              | 2.12.10-r1  | GPL-2.0-only                              | apk        |
     | scanelf                | 1.3.5-r1    | GPL-2.0-only                              | apk        |
     | musl-utils             | 1.2.3-r4    | MIT AND BSD-2-Clause AND GPL-2.0-or-later | apk        |
     | libc-utils             | 0.7.2-r3    | BSD-2-Clause AND BSD-3-Clause             | apk        |
     +------------------------+-------------+-------------------------------------------+------------+
    
  4. subsequent layers it doesn't show the correct results

=======================================================================================

    Layer 2:
            info: Layer created by commands: /bin/sh -c apk add --no-cache openjdk17
            info: Retrieved package metadata using apk default method.

            error: /bin/sh: export: line 0: JAVA_OPTS:: bad variable name

/bin/sh: export: line 0: JAVA_OPTS:: bad variable name
/bin/sh: export: line 0: JAVA_OPTS:: bad variable name
/bin/sh: export: line 0: JAVA_OPTS:: bad variable name
/bin/sh: export: line 0: JAVA_OPTS:: bad variable name
/bin/sh: export: line 0: JAVA_OPTS:: bad variable name
/bin/sh: export: line 0: JAVA_OPTS:: bad variable name

    File licenses found in Layer:  None
    Packages found in Layer: None

=======================================================================================

Expected behavior
Expected to see the results without errors.

Environment you are running Tern on
Enter all that apply

  • Output of 'tern --version'
    Tern version 2.12.0
    python version = 3.9.16 (main, Apr 12 2023, 07:00:42)
  • Operating System (Linux Distro and version or Mac or Windows)
    Ubuntu
  • Vagrant file
  • Container OS
  • Python version (3.6 or higher)
  • Cloud environment (AWS, Azure, GCP)

Please attach files if they exist

  • tern.log
  • report.*
@rnjudge
Copy link
Contributor

rnjudge commented May 19, 2023

Hi @dnelaturi, thanks for the issue! Can you please provide the Dockerfile for your image so I may debug? From what I can see this is not an issue with the Alpine base image. Rather, I suspect there is some type of unique line in the Dockerfile that Tern's parser does not recognize or an environment variable that Tern cannot properly export, hence the /bin/sh: export: line 0: JAVA_OPTS:: bad variable name error that is throwing off the results.

@rnjudge rnjudge added the bug Something went wrong label May 19, 2023
@rnjudge rnjudge changed the title unable to run tern on alpine images Parsing error: JAVA_OPTS:: bad variable name May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something went wrong
Projects
None yet
Development

No branches or pull requests

2 participants