| ... | @@ -426,3 +426,29 @@ test "tar should not overwrite existing file" { | ... | @@ -426,3 +426,29 @@ test "tar should not overwrite existing file" { |
| 426 | try tar.pipeToFileSystem(root2.dir, fsb.reader(), .{ .mode_mode = .ignore, .strip_components = 0 }); | 426 | try tar.pipeToFileSystem(root2.dir, fsb.reader(), .{ .mode_mode = .ignore, .strip_components = 0 }); |
| 427 | } | 427 | } |
| 428 | | 428 | |
| | 429 | test "tar case sensitivity" { |
| | 430 | // Mimicking issue #18089, this tar contains, same file name in two case |
| | 431 | // sensitive name version. Should fail on case insensitive file systems. |
| | 432 | // |
| | 433 | // $ tar tvf 18089.tar |
| | 434 | // 18089/ |
| | 435 | // 18089/alacritty/ |
| | 436 | // 18089/alacritty/darkermatrix.yml |
| | 437 | // 18089/alacritty/Darkermatrix.yml |
| | 438 | // |
| | 439 | const data = @embedFile("testdata/18089.tar"); |
| | 440 | var fsb = std.io.fixedBufferStream(data); |
| | 441 | |
| | 442 | var root = std.testing.tmpDir(.{}); |
| | 443 | defer root.cleanup(); |
| | 444 | |
| | 445 | tar.pipeToFileSystem(root.dir, fsb.reader(), .{ .mode_mode = .ignore, .strip_components = 1 }) catch |err| { |
| | 446 | // on case insensitive fs we fail on overwrite existing file |
| | 447 | try testing.expectEqual(error.PathAlreadyExists, err); |
| | 448 | return; |
| | 449 | }; |
| | 450 | |
| | 451 | // on case sensitive os both files are created |
| | 452 | try testing.expect((try root.dir.statFile("alacritty/darkermatrix.yml")).kind == .file); |
| | 453 | try testing.expect((try root.dir.statFile("alacritty/Darkermatrix.yml")).kind == .file); |
| | 454 | } |