(spacePath string, obsoleteIDs []string, targetID string, entries []EntryInfo)
| 369 | } |
| 370 | |
| 371 | func fixSpaceID(spacePath string, obsoleteIDs []string, targetID string, entries []EntryInfo) { |
| 372 | // Set all parentid attributes to the proper space ID |
| 373 | err := setAllParentIDAttributes(entries, targetID) |
| 374 | if err != nil { |
| 375 | logFailure("an error occurred during file attribute update: %v", err) |
| 376 | return |
| 377 | } |
| 378 | |
| 379 | // Update space ID itself |
| 380 | fmt.Printf(" Updating directory '%s' with attribute '%s' -> %s\n", filepath.Base(spacePath), idAttrName, targetID) |
| 381 | err = xattr.Set(spacePath, idAttrName, []byte(targetID)) |
| 382 | if err != nil { |
| 383 | logFailure("Failed to set attribute on directory '%s': %v", spacePath, err) |
| 384 | return |
| 385 | } |
| 386 | err = xattr.Set(spacePath, spaceIDAttrName, []byte(targetID)) |
| 387 | if err != nil { |
| 388 | logFailure("Failed to set attribute on directory '%s': %v", spacePath, err) |
| 389 | return |
| 390 | } |
| 391 | |
| 392 | // update the index |
| 393 | err = updateOwnerIndexFile(spacePath, obsoleteIDs) |
| 394 | if err != nil { |
| 395 | logFailure("Could not update the owner index file: %v", err) |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | func gatherAttributes(path string) ([]EntryInfo, map[string]struct{}, EntryInfo, error) { |
| 400 | dirEntries, err := os.ReadDir(path) |
no test coverage detected