Artifacts Associated With Ticket 23dd83ce7c
Ticket change [4bf271e34c] (rid 218723) by apnadkarni on 2023-09-26 07:58:29:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-markdown"
- comment initialized to:
Valgrind shows following errors when a file contained within a mounted archive is truncated (`close [open FILE w]`) ``` ==12978== Invalid free() / delete / delete[] / realloc() ==12978== at 0x483CA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==12978== by 0x488EB73: TclpFree (tclAlloc.c:722) ==12978== by 0x4A506B5: ZipChannelClose (tclZipfs.c:4234) ==12978== by 0x49B614F: ChanClose (tclIO.c:384) ==12978== by 0x49B9116: CloseChannel (tclIO.c:3149) ==12978== by 0x49B8E6A: FlushChannel (tclIO.c:3026) ==12978== by 0x49B9A59: Tcl_Close (tclIO.c:3593) ==12978== by 0x49B714A: Tcl_UnregisterChannel (tclIO.c:1275) ==12978== by 0x49C65F2: Tcl_CloseObjCmd (tclIOCmd.c:713) ==12978== by 0x489E153: Dispatch (tclBasic.c:4920) ==12978== by 0x489E1DD: TclNRRunCallbacks (tclBasic.c:4960) ==12978== by 0x489DA8F: Tcl_EvalObjv (tclBasic.c:4679) ==12978== by 0x48A034C: TclEvalEx (tclBasic.c:5837) ==12978== by 0x49D5C59: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==12978== by 0x49E7195: Tcl_MainEx (tclMain.c:405) ==12978== by 0x10A618: main (tclAppInit.c:94) ==12978== Address 0x7b7a090 is 0 bytes inside a block of size 2,097,152 free'd ==12978== at 0x483C98F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==12978== by 0x483E027: realloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==12978== by 0x488EB9B: TclpRealloc (tclAlloc.c:747) ==12978== by 0x4A5058F: ZipChannelClose (tclZipfs.c:4211) ==12978== by 0x49B614F: ChanClose (tclIO.c:384) ==12978== by 0x49B9116: CloseChannel (tclIO.c:3149) ==12978== by 0x49B8E6A: FlushChannel (tclIO.c:3026) ==12978== by 0x49B9A59: Tcl_Close (tclIO.c:3593) ==12978== by 0x49B714A: Tcl_UnregisterChannel (tclIO.c:1275) ==12978== by 0x49C65F2: Tcl_CloseObjCmd (tclIOCmd.c:713) ==12978== by 0x489E153: Dispatch (tclBasic.c:4920) ==12978== by 0x489E1DD: TclNRRunCallbacks (tclBasic.c:4960) ==12978== by 0x489DA8F: Tcl_EvalObjv (tclBasic.c:4679) ==12978== by 0x48A034C: TclEvalEx (tclBasic.c:5837) ==12978== by 0x49D5C59: Tcl_FSEvalFileEx (tclIOUtil.c:1782) ==12978== by 0x49E7195: Tcl_MainEx (tclMain.c:405) ==12978== by 0x10A618: main (tclAppInit.c:94) ```
- foundin initialized to: "8.7"
- is_private initialized to: "0"
- login: "apnadkarni"
- priority initialized to: "5 Medium"
- private_contact initialized to: "9546e9877f1a8899e25a89082561ee694e7fb402"
- resolution initialized to: "None"
- severity initialized to: "Severe"
- status initialized to: "Open"
- submitter initialized to: "apnadkarni"
- subsystem initialized to: "- New Builtin Commands"
- title initialized to:
Truncation of zipfs file results in valgrind 0 byte allocation errors
- type initialized to: "Bug"
Ticket change [14350bad6e] (rid 218787) by apnadkarni on 2023-09-27 11:49:42:
- closedate changed to: "2460214.99285481"
- closer changed to: "apnadkarni"
- icomment: "Fixed in [a6c30811c9]"
- login: "apnadkarni"
- mimetype: "text/x-fossil-plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [3128821f18] (rid 218789) by chw on 2023-09-27 13:35:49:
- closedate changed to: "2460215.06654675"
- closer changed to: "chw"
- icomment:
Regarding the comment "TODO - there seems to be no locking here ..." in the diff closing this ticket [a6c30811c9] you might want to move the WriteLock() call after if (info->isWriting) before the if block. This would solve the issue since before committing to the global ZipEntry table that WriteLock() ensures exclusive access. Since other threads require a ReadLock() to obtain an open channel they'll have to wait until after that commit.
- login: "chw"
- mimetype: "text/x-fossil-plain"
Ticket change [8862842cfe] (rid 218790) by apnadkarni on 2023-09-27 15:10:49:
- closedate changed to: "2460215.13251545"
- closer changed to: "apnadkarni"
- icomment:
Yes. I just want to review all of the code for multithreading issues first though.
- login: "apnadkarni"
- mimetype: "text/plain"
Ticket change [ad5b7d6793] (rid 218803) by chrstphrchvz on 2023-09-27 21:54:00:
- closedate changed to: "2460215.41250047"
- closer changed to: "chrstphrchvz"
- icomment:
Regarding 64 * 1024 * 1024 “magic”, that looks like a 64MiB limit. It was upstreamed from AndroWish, and I did not find any history for it beyond it appearing in the initial check-in: [https://www.androwish.org/home/blame?filename=jni/tcl/generic/zipfs.c&checkin=3ba628a7f908a348e9b0]
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
Ticket change [6c26f99304] (rid 218804) by chw on 2023-09-28 05:06:56:
- closedate changed to: "2460215.71315736"
- closer changed to: "chw"
- icomment:
As far as I remember (it's 10 years later now) the reason was that on Android there is/was a size limit of 64 MByte per APK (installer package) thus I've chosen this boundary. Could certainly be lifted but having an upper limit for the potential bootstrap filesystem is not a totally bad idea.
- login: "chw"
- mimetype: "text/plain"
Ticket change [e5ee5ca3b5] (rid 218838) by apnadkarni on 2023-09-28 11:00:59:
- closedate changed to: "2460215.95902168"
- closer changed to: "apnadkarni"
- icomment:
Yes, I figured there must be some motivation behind the limit but couldn't figure where it came from as the pkware spec does not mention any. Didn't think of APK's. Easy enough to change at some point...
- login: "apnadkarni"
- mimetype: "text/plain"