Commit ed08556
committed
gh-154490: Only keep permission bits of the mode argument in ZipFile.mkdir()
The file type bits of a caller-provided mode were previously mixed into
the entry's external attributes, so a mode such as 0o107777 could mark
the created entry as a socket instead of a directory. Sanitize the mode
with & 0o7777, matching what stat.S_IMODE does, before combining it with
S_IFDIR. Also spell the default mode as 0o777 instead of 511 in the
signature and documentation, for consistency with os.mkdir().1 parent a2a8466 commit ed08556
4 files changed
Lines changed: 31 additions & 6 deletions
File tree
- Doc/library
- Lib
- test/test_zipfile
- zipfile
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
541 | | - | |
| 541 | + | |
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
545 | | - | |
546 | | - | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
547 | 548 | | |
548 | 549 | | |
549 | 550 | | |
550 | 551 | | |
551 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
552 | 558 | | |
553 | 559 | | |
554 | 560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5478 | 5478 | | |
5479 | 5479 | | |
5480 | 5480 | | |
| 5481 | + | |
| 5482 | + | |
| 5483 | + | |
| 5484 | + | |
| 5485 | + | |
| 5486 | + | |
| 5487 | + | |
| 5488 | + | |
| 5489 | + | |
| 5490 | + | |
| 5491 | + | |
| 5492 | + | |
5481 | 5493 | | |
5482 | 5494 | | |
5483 | 5495 | | |
5484 | | - | |
| 5496 | + | |
| 5497 | + | |
| 5498 | + | |
5485 | 5499 | | |
5486 | 5500 | | |
5487 | 5501 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2579 | 2579 | | |
2580 | 2580 | | |
2581 | 2581 | | |
2582 | | - | |
| 2582 | + | |
2583 | 2583 | | |
2584 | 2584 | | |
2585 | 2585 | | |
| |||
2592 | 2592 | | |
2593 | 2593 | | |
2594 | 2594 | | |
2595 | | - | |
| 2595 | + | |
2596 | 2596 | | |
2597 | 2597 | | |
2598 | 2598 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments