koalaman / shellcheck

ShellCheck, a static analysis tool for shell scripts
https://www.shellcheck.net
GNU General Public License v3.0
36.52k stars 1.78k forks source link

shellcheck: unable to decommit memory: Invalid argument (0.4.4) #785

Closed austin987 closed 3 years ago

austin987 commented 8 years ago

Howdy,

I recently upgraded my project to using shellcheck 0.4.4 on travis-ci.org to take advantage of the new global file exclusions (#777). After doing so, shellcheck is throwing lots of errors on my project, with the message: +shellcheck -s sh src/winetricks shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument

What's interesting is that it only occurs on Linux (Ubuntu): https://travis-ci.org/Winetricks/winetricks/jobs/177866938

But not OS X with 0.4.5: https://travis-ci.org/Winetricks/winetricks/jobs/177866939

is this a known issue with 0.4.4? I glanced through the commits between 0.4.4 and 0.4.5, but didn't see anything relevant. Unfortunately, Ubuntu's latest is 0.4.4: https://launchpad.net/ubuntu/+source/shellcheck

so if it is fixed in 0.4.5, I'd like to know so I can ask Ubuntu to bump it.

P.S., I hate filing a bug for this since it's a previous version, but I couldn't find an IRC channel to ask about this. Is there one I'm unaware of?

koalaman commented 7 years ago

I haven't seen this error before. From what I can tell from GHC issues 12865 and 12495, it may happen when GHC/shellcheck is built on a newer system but runs on one with an older kernel.

austin987 commented 7 years ago

Makes sense. How should I proceed? I can reliably reproduce, so I can file a Ubuntu bug, but I'm curious if there's a testcase you would like to to try, or something else, first.

koalaman commented 7 years ago

I don't really have any good suggestions. If your Ubuntu kernel and all related packages are up to date and you're still getting this, I would just file a Ubuntu bug and see what they say.

austin987 commented 7 years ago

Well it's travis-ci, so I assume they are ;).

I didn't know if you wanted some sort of logs or something. Thanks.

austin987 commented 7 years ago

Reported upstream: https://bugs.launchpad.net/ubuntu/+source/shellcheck/+bug/1650846

renekliment commented 7 years ago

We're experiencing the same thing over at https://github.com/alexa-pi/AlexaPi/pull/120 This is very unfortunate. @austin987 Have you tried running it under Ubuntu 14.04 instead of 12.04?

austin987 commented 7 years ago

@renekliment I'm testing under trusty / 14.04: https://github.com/Winetricks/winetricks/blob/master/.travis.yml#L6

kurahaupo commented 7 years ago

If you need an IRC channel, you could try #bash on freenode. It's not strictly a shellcheck channel, but Koalaman and I both hang out there, as do a number of other serious shellcheck users.

renekliment commented 7 years ago

@austin987 I've tried it also and wasn't able to make it work. I see it doesn't work for you either (almost wasn't able to spot those error messages in the build log - https://travis-ci.org/Winetricks/winetricks/jobs/187364963#L360, haha). Too bad :disappointed:

renekliment commented 7 years ago

@austin987 Ended up using trusty-backports/universe shellcheck amd64 0.3.3-1~ubuntu14.04.1. At least trusty-backports is available when using sudo: required and the thing builds and works (example: https://travis-ci.org/alexa-pi/AlexaPi/jobs/187689160).

There is a PR for whitelisting that repo ( https://github.com/travis-ci/apt-source-whitelist/pull/308 ), but looking at the number of PRs and issues, I wouldn't be very enthusiastic about it, although this is a repo that makes sense.

austin987 commented 7 years ago

Thanks for the suggestion, but downgrading isn't a serious solution for me.

On Dec 30, 2016 8:24 AM, "René Kliment" notifications@github.com wrote:

@austin987 https://github.com/austin987 Ended up using trusty-backports/universe shellcheck amd64 0.3.3-1~ubuntu14.04.1. At least trusty-backports is available when using sudo: required and the thing builds and works (example: https://travis-ci.org/alexa-pi/AlexaPi/jobs/187689160).

There is a PR for whitelisting that repo ( travis-ci/apt-source- whitelist#308 https://github.com/travis-ci/apt-source-whitelist/pull/308 ), but looking at the number of PRs and issues, I wouldn't be very enthusiastic about it, although this is a repo that makes sense.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/koalaman/shellcheck/issues/785#issuecomment-269771201, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcXCDQk-hFEJEza1XcUhrinSamJjAWyks5rNQXzgaJpZM4K9dZ3 .

ccztux commented 7 years ago

Hi!

I also get this error when using shellcheck in conjunction with travics ci, but not using the debian package. I use the latest docker image: koalaman/shellcheck

Here you can see the config and errors on travis-ci.org: glsysbackup

sobolevn commented 7 years ago

Same issue here:

   - os: linux
      sudo: required
      language: ruby
      addons:
        apt:
          sources:
          - debian-sid
          packages:
          - shellcheck

Generates:

shellcheck: unable to decommit memory: Invalid argument

Link to job: https://travis-ci.org/sobolevn/git-secret/jobs/208007733

edannenberg commented 7 years ago

I can confirm the issue, but it doesn't seem to affect the test outcome. Valid code passes the build, lint warnings are detected and fail the build. The decommit memory messages appear in either case.

deiga commented 7 years ago

This also happens when running inside docker (koalamans image) on Debian 3.16.39

PeterDaveHello commented 7 years ago

This also happens when running inside official docker image (v0.4.6)

wknapik commented 6 years ago

Also seeing this in containerized jenkins builds based on debian-stretch. Shellcheck 0.4.4 from the distro package.

ackbyte commented 6 years ago

Same issue within a gitlab pipeline. gitlab-runner 11.2.0 Image: debian:stable-slim

$ find . -name "*.sh" -type f -print0 | xargs -n 1 -0 shellcheck -e SC2181,SC1091,SC2006,SC2230,SC1117,SC2002,SC2086,SC2162,SC2196,SC2001,SC2003,SC1067,SC2153 shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument shellcheck: unable to decommit memory: Invalid argument

Any suggestions how to avoid or just fix this errors?

Thanks zeldor

runejuhl commented 6 years ago

@zeldor Had the same problem with our CI pipeline; ended up just using a newer shellcheck. My image is based on Ubuntu xenial but adds artful sources and installs shellcheck from artful (apt-get install -y -t artful shellcheck).

ackbyte commented 6 years ago

@runejuhl thank you for your reply and constructive suggestion. Will try out to add some newer repository with shellcheck.