Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Sources/SWBCore/WorkspaceContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,7 @@ extension FSProxy {
// Many filesystems on other platforms (e.g. various non-ext4 temporary filesystems on Linux) don't support xattrs and will return ENOTSUP.
// In particular, tmpfs doesn't support xattrs on Linux unless `CONFIG_TMPFS_XATTR` is enabled in the kernel config.
// FIXME: Detect whether the FS supports xattrs at runtime
#if canImport(Darwin)
try setExtendedAttribute(path, key: Self.CreatedByBuildSystemAttribute, value: Self.CreatedByBuildSystemAttributeOnValue)
#endif
}

public func commandLineArgumentsToApplyCreatedByBuildSystemAttribute(to path: Path) -> [String] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,22 @@ public final class CreateBuildDirectoryTaskAction: TaskAction {

do {
try fs.createDirectory(directoryPath, recursive: true)
try fs.setCreatedByBuildSystemAttribute(directoryPath)
return .succeeded
} catch {
outputDelegate?.emitError(error.localizedDescription)
return .failed
}

// Warn on darwin if we are unable to set the "CreateByBuildSystem"
// attribute
do {
try fs.setCreatedByBuildSystemAttribute(directoryPath)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The other alternative is we just use try? and drop the diagnostic entirely. @owenv, what do you think?

The reason I suggested the if-Darwin to @rauhul is because we'd otherwise have to change tests to ignore this message since most Linux build environments are using containers, which use tmpfs, which don't support xattrs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the xattr still control whether we're willing to clean a directory? If yes, it could be quite confusing that we never told the user about the fact that we couldn't set it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a setting to allow deleting directories without the attr, but I think this warning still makes sense

} catch {
#if canImport(Darwin)
outputDelegate?.emitWarning("Failed to set build system attribute on \(directoryPath.str): \(error.localizedDescription)")
#endif
}

return .succeeded
}

public override func performTaskAction(
Expand Down