eslint-plugin-mozilla gets stuck in a loop looking for .eslintignore when used outside mozilla-central

RESOLVED FIXED in Firefox 55

Status

RESOLVED FIXED
2 years ago
a year ago

People

(Reporter: mythmon, Assigned: mythmon)

Tracking

Trunk
mozilla55

Firefox Tracking Flags

(firefox55 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
When searching for the root of the current repository [0], eslint-plugin-mozilla has a loop like this

  while (dirName && !fs.existsSync(path.join(dirName, ".eslintignore"))) {
    dirName = path.dirname(dirName);
  }

This assumes that when the loop gets to the "top" of the file system, dirname will return a falsey value and the loop will terminate. Instead |path.dirname("/")| returns "/" and |path.dirname("C:/")| returns "C:/". This causes an infinite loop.

With this fixed, external users of eslint-plugin-mozilla will get an error, because the root directory can't be found, which is at least better than a hang.

[0]: https://dxr.mozilla.org/mozilla-central/rev/20dff607fb88ee69135a280bbb7f32df75a86237/tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js#528-530
Comment hidden (mozreview-request)

Comment 2

2 years ago
mozreview-review
Comment on attachment 8861610 [details]
Bug 1358310 - eslint-plugin-mozilla: Fix infinite loop when finding repo root.

https://reviewboard.mozilla.org/r/133578/#review136490
Attachment #8861610 - Flags: review?(dtownsend) → review+

Comment 3

2 years ago
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s 0664f683e605 -d 73b97e528623: rebasing 391730:0664f683e605 "Bug 1358310 - eslint-plugin-mozilla: Fix infinite loop when finding repo root. r=mossop" (tip)
merging tools/lint/eslint/eslint-plugin-mozilla/lib/helpers.js
merging tools/lint/eslint/eslint-plugin-mozilla/package.json
warning: conflicts while merging tools/lint/eslint/eslint-plugin-mozilla/package.json! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
Comment hidden (mozreview-request)

Comment 5

2 years ago
Pushed by mcooper@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c1db498519cd
eslint-plugin-mozilla: Fix infinite loop when finding repo root. r=mossop

Comment 6

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/c1db498519cd
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55

Updated

a year ago
Product: Testing → Firefox Build System
You need to log in before you can comment on or make changes to this bug.