Skip to content

Bug: lint:scripts exits with code 8 instead of 0 due to missing_count.size typo #738

@nickpellant

Description

@nickpellant

Description

The i18n lint:scripts command always exits with code 8 on 64-bit systems when there are 0 missing translations, instead of exiting with code 0.

The bug is in lib/i18n-js/cli/lint_scripts_command.rb at line 140:

exit(missing_count.size)

This calls Integer#size on missing_count, which returns the number of bytes needed to store the integer value (8 on 64-bit systems), rather than the integer itself.

How to reproduce

  1. Set up a project with i18n-js configured with lint_scripts patterns
  2. Ensure all translations are present (0 missing)
  3. Run bundle exec i18n lint:scripts
  4. Observe the exit code: echo $? returns 8
$ bundle exec i18n lint:scripts
=> Config file: "./config/i18n.yml"
=> Require file: "./config/environment.rb"
=> Node: "/usr/local/bin/node"
=> Available locales: [:en]
=> Patterns: ["app/frontend/**/*.ts", "app/frontend/**/*.tsx"]
=> 172 translations, 0 missing, 0 ignored

$ echo $?
8

What do you expect

When there are 0 missing translations, the command should exit with code 0 (success).

What happened instead

The command exits with code 8 because 0.size returns 8 on 64-bit systems (the number of bytes needed to store an Integer).

Suggested fix

Change line 140 from:

exit(missing_count.size)

To:

exit(missing_count)

Software:

  • Gem version: 4.2.4
  • Ruby version: 3.4.7 (also reproducible on other versions)

Full backtrace

N/A - no exception is raised, the bug is in the exit code logic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions