Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort entries by segment when building a parent node to prevent unordered directory structures. #5110

Closed

Conversation

jjudd
Copy link
Contributor

@jjudd jjudd commented Apr 27, 2018

When building a parent node from action inputs, the paths to the files are
sorted. These paths are then broken down into segments and a tree structure
is created from the segments.

Problem is, the segments at each level of the tree structure are not sorted
before they are added to the parent node. This can result in an unordered
directory tree.

For example, the sort order of this list of files

/foo/bar-client/bar-client_ijar.jar
/foo/bar/bar_ijar.jar

is maintained when it becomes a tree structure

foo ->
    bar-client ->
        bar-client_ijar.jar
    bar
        bar_ijar.jar

which is out of order.

Resolves: #5109

…red directory structures.

When building a parent node from action inputs, the paths to the files are
sorted. These paths are then broken down into segments and a tree structure
is created from the segments.

Problem is, the segments at each level of the tree structure are not sorted
before they are added to the parent node. This can result in an unordered
directory tree.

For example, the sort order of this list of files
/foo/bar-client/bar-client_ijar.jar
/foo/bar/bar_ijar.jar

is maintained when it becomes a tree structure
foo ->
    bar-client ->
        bar-client_ijar.jar
    bar
        bar_ijar.jar

which is out of order.

Resolves: bazelbuild#5109
@jjudd jjudd changed the title Sort entries by segment when building a parent node to prevent unordered red directory structures. Sort entries by segment when building a parent node to prevent unordered directory structures. Apr 27, 2018
Copy link
Contributor

@ola-rozenfeld ola-rozenfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, thank you very much for this!

@bazel-io bazel-io closed this in e6eaf25 May 7, 2018
meteorcloudy pushed a commit that referenced this pull request May 7, 2018
…red directory structures.

When building a parent node from action inputs, the paths to the files are
sorted. These paths are then broken down into segments and a tree structure
is created from the segments.

Problem is, the segments at each level of the tree structure are not sorted
before they are added to the parent node. This can result in an unordered
directory tree.

For example, the sort order of this list of files
```
/foo/bar-client/bar-client_ijar.jar
/foo/bar/bar_ijar.jar
```

is maintained when it becomes a tree structure
```
foo ->
    bar-client ->
        bar-client_ijar.jar
    bar
        bar_ijar.jar
```
which is out of order.

Resolves: #5109

Closes #5110.

PiperOrigin-RevId: 195649710
@borkaehw borkaehw deleted the remote-directory-order branch December 6, 2019 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants