Skip to content

Race Condition #1898

Closed
Closed
@ForbesLindesay

Description

@ForbesLindesay

I've found what I think is a race condition in less. Unfortunately the minimum example I can come up with involves 5 files. With the lessc command line it then outputs one of two different things at random. If you add the sync-imports flag, the problem is mitigated.

Inputs

index.less

@import "indirect-a.less";
@import "indirect-b.less";

body {
  color: @color;
}

indirect-a.less

@import "variables.less";
@import "override.less";

indirect-b.less

@import "variables.less";

variables.less

@color: red;

override.less

@color: black;

Command

lessc index.less

Output

One of the following two options is output at random:

Aprox 95% of the time:

body {
  color: #000000;
}

Aprox 5% of the time:

body {
  color: #ff0000;
}

This occurs with the latest version in npm and with the version currently in the GitHub repo.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions