Auto: Determine cause of auto-exec spawnSync /bin/sh E2BIG

Created on 12 Jun 2020  ·  6Comments  ·  Source: intuit/auto

Describe the bug

Currently my latest build fails on the release step with a E2BIG error. I've done some research and found this can be due to a few reasons such as to many command argument (doesn't seem like the case here) or texts that are too large.

I feel like it may be the latter, but im unsure of how to debug the issue.

Ill try a temporary work around and comment my auto-exec lines, but any suggestions are welcome!

To Reproduce

Trying to figure that out right now.

Expected behavior

Either mention the troubling file, or not throw an error

Environment information:

Gitlab CI & Local (arch linux machine)

Additional context

I don't think this is necessarily due to auto. Most likely a spawn problem, just figured it would be helpful to post here for anyone who runs into a similar issue in the future, and to brain storm debugging ideas.

bug hacktoberfest

Most helpful comment

A solution could be storing the args somewhere on disk and let the command pull from there instead of an env var. But that's a pretty big breaking change for the plugin

To unblock you this plugin does the same thing

const { SEMVER, execPromise, getCurrentBranch } = require("@auto-it/core");

module.exports = class NextCherryPickPlugin {
  constructor() {
    this.name = "update docs";
  }

  /**
   * Setup the plugin
   *
   * @param {import('@auto-canary/core').default} auto
   */
  apply(auto) {
    auto.hooks.beforeCommitChangelog.tapPromise(this.name, async (config) => {
      await execPromise("yarn", ["lint:doc:fix"]);
      await execPromise("git", ["add", "."]);
    });
  }
};

All 6 comments

I think that this may be a fatal flaw in the exec plugin.

E2BIG means that there were too many args to the execSync call. I'm pretty sure that the args it's talking about it just all the hook info we pass in though env variables ($ARG0).

I'm not really sure if this is something we can even fix. Might have to document this limitation and maybe even add an option to forgo passing in the contextual information.

A solution could be storing the args somewhere on disk and let the command pull from there instead of an env var. But that's a pretty big breaking change for the plugin

To unblock you this plugin does the same thing

const { SEMVER, execPromise, getCurrentBranch } = require("@auto-it/core");

module.exports = class NextCherryPickPlugin {
  constructor() {
    this.name = "update docs";
  }

  /**
   * Setup the plugin
   *
   * @param {import('@auto-canary/core').default} auto
   */
  apply(auto) {
    auto.hooks.beforeCommitChangelog.tapPromise(this.name, async (config) => {
      await execPromise("yarn", ["lint:doc:fix"]);
      await execPromise("git", ["add", "."]);
    });
  }
};

If you can find a solution to E2BIG that would be awesome! (or anyone else who sees this issue)

I'll definitely think about it, there should be some way to work around it. Thanks!

I see in the execSpawn args list we pass process.env fully on top of the auto context, maybe the option we add could specify to only pass auto-specific env vars?

I (an interested bystander) wholeheartedly endorse the "storing args in a file" solution. Yes, it's a breaking change, but it's a breaking change you need.

@hipstersmoothie

To unblock you this plugin does the same thing

To be clear, to use this I just save it in my (non-Node/NPM/TypeScript) repo and set "plugins": ["path/to/file"] in my config file, or is there more to it?

Was this page helpful?
0 / 5 - 0 ratings