mirror of
https://github.com/apple/container.git
synced 2026-10-14 10:09:10 +00:00
Fix the xattr sort comparator (#605)
- Closes #603. - Fixes the `xattr` sort comparator. For example, when `$0.index > $1.index` and `$0.name.count < $1.name.count`.
This commit is contained in:
1 parent
0aedf8f9d9
commit
15bbddcaeb
1 file changed
+6
-3
@@ -177,10 +177,13 @@ extension EXT4 {
|
||||
}
|
||||
var attributes = self.blockAttributes
|
||||
attributes.sort(by: {
|
||||
if ($0.index < $1.index) || ($0.name.count < $1.name.count) || ($0.name < $1.name) {
|
||||
return true
|
||||
if $0.index != $1.index {
|
||||
return $0.index < $1.index
|
||||
}
|
||||
return false
|
||||
if $0.name.count != $1.name.count {
|
||||
return $0.name.count < $1.name.count
|
||||
}
|
||||
return $0.name < $1.name
|
||||
})
|
||||
try Self.write(buffer: &buffer, attrs: attributes, start: UInt16(idx), delta: UInt16(idx), inline: false)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user