Closed Bug 1358310 Opened 7 years ago Closed 7 years ago

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

Categories

(Developer Infrastructure :: Lint and Formatting, defect)

defect
Not set
normal

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: mythmon, Assigned: mythmon)

Details

Attachments

(1 file)

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 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+
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)
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
https://hg.mozilla.org/mozilla-central/rev/c1db498519cd
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Product: Testing → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: