Skip to content

Commit a0046c7

Browse files
committed
Tar: Fix permissions (owner should have write permission)
The owner needs write permission to be able to delete the files after unpacking the archive.
1 parent db8578d commit a0046c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Tar/tar.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,14 @@ extension Archive {
419419
/// - prefix: Path prefix
420420
/// - data: File contents
421421
public func appendFile(name: String, prefix: String = "", data: [UInt8]) throws {
422-
try append(.init(header: .init(name: name, size: data.count, prefix: prefix), data: data))
422+
try append(.init(header: .init(name: name, mode: 0o755, size: data.count, prefix: prefix), data: data))
423423
}
424424

425425
/// Adds a new directory member at the end of the archive
426426
/// parameters:
427427
/// - name: Directory name
428428
/// - prefix: Path prefix
429429
public func appendDirectory(name: String, prefix: String = "") throws {
430-
try append(.init(header: .init(name: name, typeflag: .DIRTYPE, prefix: prefix)))
430+
try append(.init(header: .init(name: name, mode: 0o755, typeflag: .DIRTYPE, prefix: prefix)))
431431
}
432432
}

0 commit comments

Comments
 (0)