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

Cannot read properties of undefined error in run commands that contain a pipe and line continuation characters #82

Open
ddnomad opened this issue Mar 16, 2023 · 3 comments
Assignees

Comments

@ddnomad
Copy link

ddnomad commented Mar 16, 2023

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Create Dockerfile with contents listed below
  2. Observe errors messages from the extensions that read hadolint: Cannot read properties of undefined (reading 'length')

Dockerfile:

FROM debian:bullseye

RUN cat /etc/os-release | \
    grep debian

Expected behaviour
Linter should produce the following output (which corresponds to the output when running the linter on CLI):

Dockerfile:3 DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check
Dockerfile:3 SC2002 style: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

Screenshots or Dockerfile
Not applicable.

Environment and version (please complete the following information):

  • hadolint: Haskell Dockerfile Linter 2.12.0
  • OS: Debian 11 (5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux)

Debug information

[hadolint(3038863) file:///home/ddnomad/development/github.com/homelab] Document is saved: file:///home/ddnomad/development/github.com/homelab/images/qbittorrent/Dockerfile
[hadolint(3038863) file:///home/ddnomad/development/github.com/homelab] Current settings: {"hadolintPath":"hadolint","cliOptions":["--no-color"],"maxNumberOfProblems":100,"outputLevel":"warning"}
[hadolint] Running hadolint /home/ddnomad/development/github.com/homelab/images/qbittorrent/Dockerfile --no-color in /home/ddnomad/development/github.com/homelab
[Error - 7:47:49 PM] TypeError: Cannot read properties of undefined (reading 'length')
    at /home/ddnomad/.vscode-server/extensions/exiasr.hadolint-1.1.2/server/out/server.js:33:112710
    at Array.forEach (<anonymous>)
    at Mn (/home/ddnomad/.vscode-server/extensions/exiasr.hadolint-1.1.2/server/out/server.js:33:112526)

Additional context
None

@samualtnorman
Copy link

also hitting this, is this repo still maintained?

@ddnomad
Copy link
Author

ddnomad commented Aug 21, 2023

also hitting this, is this repo still maintained?

This is still an issue, just reproduced it. I reckon @michaellzc does not have time to take a look at this.

I suspect that fixing the actual cause is not that complicated, the bug seems to be happening in one of the forEach loops in https://github.com/michaellzc/vscode-hadolint/blob/master/server/src/server.ts, probably because whatever is returned from the call to hadolint is undefined.

The other concern would be whether we will be able to actually get the pull request merged and the extension updated, since @michaellzc does not seem to be actively watching over this repo at the moment.

@michaellzc
Copy link
Owner

also hitting this, is this repo still maintained?

This is still an issue, just reproduced it. I reckon @michaellzc does not have time to take a look at this.

I suspect that fixing the actual cause is not that complicated, the bug seems to be happening in one of the forEach loops in https://github.com/michaellzc/vscode-hadolint/blob/master/server/src/server.ts, probably because whatever is returned from the call to hadolint is undefined.

The other concern would be whether we will be able to actually get the pull request merged and the extension updated, since @michaellzc does not seem to be actively watching over this repo at the moment.

hey, I have not been closely keeping a tab on this project, largely due to a lack of personal need for hadolint anymore.

If there is any proposed fix, I am happy to review this. If you don't get any reply, please hit me up at [email protected]. Also, I would love to add those who have more bandwidth and interest in this plugin as maintainers to this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants