Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix for [1f4af0a127369d4a1], tclZipfs storage cleanup issue. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | core-8-branch |
Files: | files | file ages | folders |
SHA3-256: |
dd4f24fce90dc392a3108a0673832cfb |
User & Date: | pooryorick 2021-04-20 19:33:57.685 |
References
2021-04-20
| ||
19:36 | • Ticket [1f4af0a127] zipfs-5.1 Valgrind, TclZipfs_MountBuffer, "1 blocks are definitely lost" status still Open with 3 other changes artifact: d3991bde8d user: pooryorick | |
Context
2021-04-22
| ||
15:58 | merge core-8-branch and refactor more of the zipfs code for comprehensibility check-in: e9ef4e168c user: dkf tags: zipfs-comments | |
2021-04-21
| ||
08:43 | Unbreak Windows build (windows 32-bit only, not checked by GITHUB actions) check-in: 291aa336d9 user: jan.nijtmans tags: core-8-branch | |
06:54 | Merge 8.7 check-in: 98f163f0e6 user: jan.nijtmans tags: trunk, main | |
06:21 | Enhance TclStringCat(). In stead of forcing incoming obj's to Unicode representation, teach it how t... Closed-Leaf check-in: 2ce693447e user: jan.nijtmans tags: bug-7f1162a867 | |
2021-04-20
| ||
19:33 | Fix for [1f4af0a127369d4a1], tclZipfs storage cleanup issue. check-in: dd4f24fce9 user: pooryorick tags: core-8-branch | |
13:45 | Fixes for Valgrind issues similar to [ec06d0db3225afca]. check-in: ec5b3d21f9 user: pooryorick tags: core-8-branch | |
Changes
Changes to generic/tclZipfs.c.
︙ | ︙ | |||
1536 1537 1538 1539 1540 1541 1542 | * *------------------------------------------------------------------------- */ static int ZipFSCatalogFilesystem( Tcl_Interp *interp, /* Current interpreter. NULLable. */ | | | | 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 | * *------------------------------------------------------------------------- */ static int ZipFSCatalogFilesystem( Tcl_Interp *interp, /* Current interpreter. NULLable. */ ZipFile *zf, /* Temporary buffer hold archive descriptors */ const char *mountPoint, /* Mount point path. */ const char *passwd, /* Password for opening the ZIP, or NULL if * the ZIP is unprotected. */ const char *zipname) /* Path to ZIP file to build a catalog of. */ { int pwlen, isNew; size_t i; ZipFile *zf0; ZipEntry *z; Tcl_HashEntry *hPtr; Tcl_DString ds, dsm, fpBuf; unsigned char *q; /* * Basic verification of the password for sanity. |
︙ | ︙ | |||
1566 1567 1568 1569 1570 1571 1572 | } } /* * Validate the TOC data. If that's bad, things fall apart. */ | | | > > | | | < < < | < < < | 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 | } } /* * Validate the TOC data. If that's bad, things fall apart. */ if (zf->baseOffset >= zf->length || zf->passOffset >= zf->length || zf->directoryOffset >= zf->length) { ZIPFS_ERROR(interp, "bad zip data"); ZIPFS_ERROR_CODE(interp, "BAD_ZIP"); ZipFSCloseArchive(interp, zf); ckfree(zf); return TCL_ERROR; } WriteLock(); /* * Mount point sometimes is a relative or otherwise denormalized path. * But an absolute name is needed as mount point here. */ Tcl_DStringInit(&ds); Tcl_DStringInit(&dsm); if (strcmp(mountPoint, "/") == 0) { mountPoint = ""; } else { mountPoint = CanonicalPath("", mountPoint, &dsm, 1); } hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, mountPoint, &isNew); if (!isNew) { if (interp) { zf0 = (ZipFile *) Tcl_GetHashValue(hPtr); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s is already mounted on %s", zf0->name, mountPoint)); ZIPFS_ERROR_CODE(interp, "MOUNTED"); } Unlock(); ZipFSCloseArchive(interp, zf); ckfree(zf); return TCL_ERROR; } Unlock(); /* * Convert to a real archive descriptor. */ zf->mountPoint = (char *) Tcl_GetHashKey(&ZipFS.zipHash, hPtr); Tcl_CreateExitHandler(ZipfsExitHandler, zf); zf->mountPointLen = strlen(zf->mountPoint); zf->nameLength = strlen(zipname); zf->name = (char *) ckalloc(zf->nameLength + 1); memcpy(zf->name, zipname, zf->nameLength + 1); |
︙ | ︙ | |||
2015 2016 2017 2018 2019 2020 2021 | } if (ZipFSOpenArchive(interp, zipname, 1, zf) != TCL_OK) { ckfree(zf); return TCL_ERROR; } if (ZipFSCatalogFilesystem(interp, zf, mountPoint, passwd, zipname) != TCL_OK) { | < < | 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 | } if (ZipFSOpenArchive(interp, zipname, 1, zf) != TCL_OK) { ckfree(zf); return TCL_ERROR; } if (ZipFSCatalogFilesystem(interp, zf, mountPoint, passwd, zipname) != TCL_OK) { return TCL_ERROR; } return TCL_OK; } /* *------------------------------------------------------------------------- * * TclZipfs_MountBuffer -- |
︙ | ︙ | |||
2105 2106 2107 2108 2109 2110 2111 | zf->ptrToFree = NULL; } if (ZipFSFindTOC(interp, 0, zf) != TCL_OK) { return TCL_ERROR; } result = ZipFSCatalogFilesystem(interp, zf, mountPoint, NULL, "Memory Buffer"); | < | 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 | zf->ptrToFree = NULL; } if (ZipFSFindTOC(interp, 0, zf) != TCL_OK) { return TCL_ERROR; } result = ZipFSCatalogFilesystem(interp, zf, mountPoint, NULL, "Memory Buffer"); return result; } /* *------------------------------------------------------------------------- * * TclZipfs_Unmount -- |
︙ | ︙ |