<i>zipfs info on mountpoint of executable returns zero offset in field 4</i> status still Open with 3 other changes
by
.
D 2024-10-30T03:50:13.412
J icomment I'll\sattempt\sto\sprovide\ssome\smore\scontext\sregarding\sthis\sissue.\r\n\r\nThe\szip\sarchive\sformat\s(or\szip\s'container\sformat')\sis\stolerant\sof\s2\sways\sof\sprepending\sdata\sthat\sisn't\spart\sof\sthe\sarchive\scontents\sas\sfar\sas\swhat\sis\sextracted/listed.\r\n\r\nI'll\srefer\sto\ssuch\sdata\s-\swhich\smay\sbe\sfor\sexample\sa\sscript\sor\san\sexecutable\s(or\sin\sless\scommon\scases\sa\ssignature\s-\sor\sother\sapplication\sspecific\sdata)\r\nas\sthe\s'preamble'.\r\n\r\nThis\scould\sbe\san\s'external\spreamble'\s-\se.g\sas\swould\sbe\screated\sby\sthe\smethod\snoted\sin\stip\s430\sby\sjust\scatting\san\sexe\sand\sa\szip\stogether.\r\n\r\nIt\scould\sbe\san\s'internal\spreamble'\s-\swhich\smight\sbe\screated\sby\sthe\ssame\smethod\s-\sbut\sthen\s'adjusting'\sthe\szip\soffsets\ssuch\sthat\sthe\spreamble\sis\spart\sof\sthe\srange\sof\sdata\scovered\sby\sthe\soffsets.\se.g\susing\ssomething\slike\s'zip\s-A'\son\sit.\r\n\r\n'zipfs\sinfo'\scan\scurrently\sonly\sreturn\sthe\soffset\sfor\sthe\smountpoint\sas\sdocumented\sin\sthe\sTcl\szipfs\sman\spage\sif\sit\sis\san\sexternal\spreamble.\r\nIf\sadjustments\shave\sbeen\smade\s-\szipfs\sinfo\swill\sreturn\szero\sfor\sthe\soffset.\r\n\r\nIn\ssome\ssense\sthis\sis\scorrect.\sBy\smaking\sthe\spreamble\sinternal\s-\sthe\szip\sarchive\sportion\sdoes\sin\seffect\sbegin\sat\s0\s-\sthe\sstart\sof\sthe\swhole\sfile.\r\nThat\szipfs\smkimg\s-\sand\sthe\sbuild\ssystem\s(using\szip\s-A)\screate\san\sinternal\spreamble\sby\sdefault\sis\sthe\scause\sof\sthis.\r\n\r\nThis\sdefault\sto\s'internal\spreamble'\sis\sthen\sat\sodds\swith\sthe\sdocumentation,\sand\sthe\s'zipfs\sinfo'\sresult\scannot\sas\sclaimed\sbe\sused\sto\s'truncate\sthe\szip\sinformation\sfrom\san\sexecutable'\s\r\n\r\nNote\sthat\swhile\sin\snearly\severy\scase\sexternal\szip\stools\scan\sextract\szip\scontents\sfrom\sa\spreambled\sfile\swhether\sinternal\sor\sexternal\s-\sthere\sare\sdifferences\sin\sdirect\swritability\setc\s-\sand\ssome\stools\sexercise\sdifferent\scodepaths\sbased\son\sthe\sfile\sextension.\s\s\r\nA\sfile\sthat\sis\snamed\swith\sa\s.zip\sextension\s-\sis\sgenerally\sexpected\sby\stools\sto\sbe\san\sarchive\swith\seither\sno\spreamble,\sor\sone\sthat\sis\sinternal.\r\n\r\npkware\sare\sthe\ssupposed\sstewards\sof\sthe\sformat\s-\shaving\sreleased\svarious\sappnotes\sgiving\sa\ssomewhat\sunderspecified\sdocumentation\sof\sit.\r\nAlthough\sthe\soriginal\sauthor\sPhil\sKats\sreleased\sthe\sformat\sto\sthe\spublic\sdomain\s-\sit\sis\sunclear\sto\swhat\sextent\sversions\sdocumented\sby\spkware\safter\shis\sdeath\scontain\scopyrighted\sextensions\sespecially\srelated\sto\sencryption.\sThis\sis\sprobably\swhy\svarious\sother\sprojects\sthat\shave\smade\suse\sof\sthe\szip\sformat\shave\stended\sto\srestrict\sthe\sfeatures\sused.\r\n\r\npkware\sput\stheir\sself\sextractor\sexe\sas\san\s'internal\spreamble'\s-\sand\stheir\stools\stend\snot\sto\ssupport\sfiles\swith\sarbitrary\sextensions\son\sthe\scommandline\s(they\sassume\sor\srequire\s.zip\sor\s.exe)\r\n\r\nOther\stools\swill\sgenerally\saccept\se.g\sfile.kit,\sfile.jar,\sfile.apk\setc\sand\slist/extract\scontents\s\r\n\r\n-----------\r\n\r\nCatting\sa\sTcl\sexe\sor\sscript\spreamble\sto\sa\szip\sfile\swhich\salready\shas\san\sinternal\spreamble\swill\sresult\sin\sa\sfile\swith\sboth\san\sexternal\sand\sinternal\spreamble.\r\nThis\shas\sat\sleast\sone\spossibly\srare\slegitimate\susecase\r\nThere\sis\sat\sleast\sone\szip\ssigning\stool\swhich\suses\san\sinternal\spreamble\sinstead\sof\sother\smechanisms\sto\sstore\sthe\ssignature.\r\n(Other\smechanisms\sinclude\sputting\sit\sin\sthe\scomment(seems\sdubious\sway\sto\sdo\sit)\sor\sin\sthe\sarchive\sitself\sas\sfor\sexample\s.jar\sfiles\sdo)\r\n\r\nCatting\sfor\sexample\sa\stcl\sexecutable\sto\san\sexisting\ssfx\swould\salso\sresult\sin\sa\smixed\sexternal/internal\spreamble.\sThis\sis\sanother\sunlikely\susecase\s-\sin\sthat\swhile\sthe\sinternal\ssfx\sheader\sseems\sto\sdo\sno\sharm\s-\sits\sonly\sutility\sis\sif\sthe\stcl\spreamble\sis\slater\ssplit\soff\sand\sthe\sresulting\szip\sis\swanted\sto\sremain\san\ssfx.\sGenerally\sits\sprobably\sjust\sa\swaste\sof\sspace.\r\n\r\nIf\sa\szip\skit/exe\swith\sboth\san\sexternal\sand\sinternal\spreamble\sis\sadjusted\sto\smake\sall\sthe\spreambles\sinternal\s-\sthere\sis\sinformation\sloss\sregarding\swhere\sthe\ssplit\soccurs\sbetween\sthe\spreambles.\s(Possibly\snot\sa\scase\sparticularly\scared\sabout/important\sin\sthe\sTcl\szipfs\secosystem\sbut\san\sundocumented\sedge\scase\snonetheless)\r\n\r\nIf\sa\stcl\sexe\sor\sscript\spreamble\sis\sadjusted\sto\sbe\sinternal\s-\sthe\ssplit\sbetween\spreamble\sand\szip\sis\salso\sharder\sto\sascertain.\sIt's\snot\san\sissue\sfor\sextracting/reading\sthe\szip\scontents\s-\sbut\sfor\sdetermining\swhere\sthe\spreamble\sends.\r\n(easy\senough\sif\syou\sknow\sthere\sis\sjust\sone\sscript\sdelimited\swith\s\\x1a\s-\snot\sso\seasy\sfor\scross-platform\sformats\sof\sexecutables\sor\sapplication\sspecific\sdata\setc)\r\n\r\nInternal\spreamble\ssplitting\sgenerally\srelies\son\susing\sthe\sfirst\sfile\srecord\spointed\sto\sby\sthe\szip-archives\sCentral\sDirectory.\r\n1)\sas\sa\sreduced\scase\sfor\sjust\sa\szip\sfile\swith\sno\scontents\sbut\sjust\sa\scomment\s-\sthere\sisn't\seven\sa\sCDR\s(just\san\send\sof\scentral\sdirectory\srecord)\r\n\s\s(zipfs\scan't\smount\san\sempty\szip,\svfs::zip\scan\s-\sbut\sin\sany\scase\sread-only\s-\sso\sprobably\snot\srelevant\sto\sTcl\sas\sit\sstands)\r\n2)\sexisting\szip\sarchives\scan\shave\seither\sinternal\spreambles,\sor\sfile\srecords\sthat\sare\sunreferenced\sby\sthe\sCDR\r\n\r\n\r\nThis\smakes\ssplitting\shard.\sNot\san\sissue\sjust\sfor\sextracting/reading,\sor\sfor\sjust\srunning\sor\sself\sextracting\s-\sbut\swithout\sa\sfunctional\s'zipfs\sinfo'\susers\shave\sto\sparse\sthe\szip\sthemselves\sto\ssplit\sthe\sTcl\spreamble.\sSuch\sparsing\sis\stricky/error\sprone\seven\swithout\sunusual\scases\s-\sand\spresumably\swhat\szipfs\sinfo's\soffset\sresult\swas\ssupposed\sto\savoid\sthe\sneed\sfor.\r\n\r\nTcl's\szipfs\scan\scurrently\ssplit\san\sexternal\spreamble\sno\sproblem\sand\sreports\sit\sin\s'zipfs\sinfo'.\r\n\r\nTo\sfix\s'zipfs\sinfo'\sfor\sthe\scurrent\sdefault\sof\s'internal\spreamble'\s-\ssome\snot\scompletely\sreliable\sCDR\smechanism\swill\sneed\sto\sbe\sused.\r\nIt\scould\sbe\smade\s'completely\sreliable'\sby\sdocumenting\sthe\srestrictions\sTcl\splaces\son\szip\sarchives\s(specifically\sno\scomment\sonly\sor\sempty\szips,\sand\sall\sfiles\smust\sbe\sreferenced\sby\s(and\sin\sorder)\sthe\sCDR)\r\n\r\nOpinion:\s\sThe\scurrent\sdefault\s(which\sI\sdon't\sbelieve\swas\sthe\soriginal?)\sto\s'adjusting\soffsets'\sand\susing\sinternal\spreamble\sis\sunnecessary,\smore\scomplicated,\smore\srestrictive.\r\n(and\scurrently\snot\sfully\ssupported\sas\sevidenced\sby\s'zipfs\sinfo'\soutput)\r\n\r\nIf\sthe\sintention\sis\sto\sstick\swith\sthe\sdefault\s(by\szipfs\smkimg\sand\sbuild\ssystem)\sinternalizing\sof\sthe\sTcl\spreamble\sinto\sthe\szip\soffset\srange\s-\sa\sdecision\sneeds\sto\sbe\smade\son\swhat\szipfs\sinfo\sreports.\sWhile\stechnically\scorrect\s(there\sis\sno\soffset\s-\sit\swas\sadjusted\saway)\s-\sit's\snot\suseful,\sand\snot\scoherent\swith\sdocumentation.\r\n\r\nIf\ssticking\swith\sthis\sdefault\s-\szipfs\sinfo\sshould\sstill\sreport\sthe\scorrect\soffset\sas\sit\scurrently\sdoes\sfor\sthe\ssimpler\sand\sIMO\smore\ssensible\sexternal\sTcl\spreamble\ssituation.\r\n\r\nRegarding\suse\sof\sexternal\szip\stools\son\spreambled\szips:\sThe\ssituation\son\swindows\sI\sbelieve\sfavours\sexternal\splain\scatted\spreambles\sfor\sfiles\snot\snamed\swith\sthe\s.zip\sextension\s-\sbut\sthere\sare\smany\svariations\sin\sbehaviour\sacross\splatforms\sand\stools.\s7zip\sis\savailable\son\sall\splatforms\sand\sworks\swell\swith\sexternal\spreambles.
J login juliannoble2
J mimetype text/plain
K aaa84fbbc59fc039788c080a8cd32d2f73316db9
U juliannoble2
Z 79ffa3d3007db34a29dd1e52703e7d7f