Skip to content

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

Closed
jjudd wants to merge 1 commit into
bazelbuild:masterfrom
lucidsoftware:remote-directory-order
Closed

jjudd wants to merge 1 commit into
bazelbuild:masterfrom
lucidsoftware:remote-directory-order

Conversation

@jjudd

@jjudd jjudd commented Apr 27, 2018

Copy link
Copy Markdown
Contributor

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

@ola-rozenfeld ola-rozenfeld left a comment

Copy link
Copy Markdown
Contributor

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