Skip to content
Tcl Source Code Artifact [72c54e1659]
Login

Artifact [72c54e1659]

Artifact 72c54e16595a9814039b6e9f6830284eceb1af45:

Manifest of check-in [72c54e1659] - Workarounds and fixes for wrapped executables on various platforms regarding the handling of wrapped dynamic libraries. The basic flow of operation is to copy such libraries into a temp file, hand them to the OS loader for processing, and then to delete them immediately, to prevent them form being accessible to other executables. On platforms where that is not possible the library is left in place and things are arranged to delete it on regular process exit. An example of the latter are older revisions of HPUX which report that the file is busy when trying to delete it. Younger revisions of HPUX have changed to allow the deletion, but are also buggy, the OS loader mangles its data structures so that a second library loaded in this manner fails. More recently it was found that Linux which is usually ok with deleting the file and gets everything right shows the same trouble as modern HPUX when the "docker" containerization system is involved, or more specifically the AUFS in use there. Deleting the loaded library file mangles data structures and breaks loading of the following libraries. For a demonstration which does not involve Tcl at all see the ticket https://github.com/dotcloud/docker/issues/1911 in the docker tracker. This of course breaks the use of wrapped executables within docker containers. This commit introduces the function TclSkipUnlink() which centralizes the handling of such exceptions to unlinking the library after unload, and provides code handling the known cases. IOW HPUX is generally forced to not unlink, and ditto when we detect that the copied library file resides within an AUFS. The latter must however be explicitly activated by setting the define -DTCL_TEMPLOAD_NO_UNLINK during build. We still need proper configure tests to set it on the relevant platforms (i.e. Linux). The AUFS detection and handling can be overridden by the environment variable TCL_TEMPLOAD_NO_UNLINK which can force the behaviour either way (skip or not). In case the user knows best, or wishes to test if the problem with AUFS has been fixed. by andreask on 2014-05-22 17:17:12.
B 5145f9b67365b976e0cfb48ee865aa77d8cd336d
C Workarounds\sand\sfixes\sfor\swrapped\sexecutables\son\svarious\splatforms\nregarding\sthe\shandling\sof\swrapped\sdynamic\slibraries.\n\nThe\sbasic\sflow\sof\soperation\sis\sto\scopy\ssuch\slibraries\sinto\sa\stemp\nfile,\shand\sthem\sto\sthe\sOS\sloader\sfor\sprocessing,\sand\sthen\sto\sdelete\nthem\simmediately,\sto\sprevent\sthem\sform\sbeing\saccessible\sto\sother\nexecutables.\sOn\splatforms\swhere\sthat\sis\snot\spossible\sthe\slibrary\sis\nleft\sin\splace\sand\sthings\sare\sarranged\sto\sdelete\sit\son\sregular\sprocess\nexit.\n\nAn\sexample\sof\sthe\slatter\sare\solder\srevisions\sof\sHPUX\swhich\sreport\sthat\nthe\sfile\sis\sbusy\swhen\strying\sto\sdelete\sit.\sYounger\srevisions\sof\sHPUX\nhave\schanged\sto\sallow\sthe\sdeletion,\sbut\sare\salso\sbuggy,\sthe\sOS\sloader\nmangles\sits\sdata\sstructures\sso\sthat\sa\ssecond\slibrary\sloaded\sin\sthis\nmanner\sfails.\n\nMore\srecently\sit\swas\sfound\sthat\sLinux\swhich\sis\susually\sok\swith\ndeleting\sthe\sfile\sand\sgets\severything\sright\sshows\sthe\ssame\strouble\sas\nmodern\sHPUX\swhen\sthe\s"docker"\scontainerization\ssystem\sis\sinvolved,\sor\nmore\sspecifically\sthe\sAUFS\sin\suse\sthere.\sDeleting\sthe\sloaded\slibrary\nfile\smangles\sdata\sstructures\sand\sbreaks\sloading\sof\sthe\sfollowing\nlibraries.\sFor\sa\sdemonstration\swhich\sdoes\snot\sinvolve\sTcl\sat\sall\ssee\nthe\sticket\n\n\s\s\s\s\shttps://github.com/dotcloud/docker/issues/1911\n\nin\sthe\sdocker\stracker.\n\nThis\sof\scourse\sbreaks\sthe\suse\sof\swrapped\sexecutables\swithin\sdocker\ncontainers.\n\nThis\scommit\sintroduces\sthe\sfunction\sTclSkipUnlink()\swhich\scentralizes\nthe\shandling\sof\ssuch\sexceptions\sto\sunlinking\sthe\slibrary\safter\sunload,\nand\sprovides\scode\shandling\sthe\sknown\scases.\sIOW\sHPUX\sis\sgenerally\nforced\sto\snot\sunlink,\sand\sditto\swhen\swe\sdetect\sthat\sthe\scopied\slibrary\nfile\sresides\swithin\san\sAUFS.\n\nThe\slatter\smust\showever\sbe\sexplicitly\sactivated\sby\ssetting\sthe\sdefine\n-DTCL_TEMPLOAD_NO_UNLINK\sduring\sbuild.\sWe\sstill\sneed\sproper\sconfigure\ntests\sto\sset\sit\son\sthe\srelevant\splatforms\s(i.e.\sLinux).\n\nThe\sAUFS\sdetection\sand\shandling\scan\sbe\soverridden\sby\sthe\senvironment\nvariable\sTCL_TEMPLOAD_NO_UNLINK\swhich\scan\sforce\sthe\sbehaviour\seither\nway\s(skip\sor\snot).\sIn\scase\sthe\suser\sknows\sbest,\sor\swishes\sto\stest\sif\nthe\sproblem\swith\sAUFS\shas\sbeen\sfixed.\n
D 2014-05-22T17:17:12.461
F doc/clock.n 023a904fb915554eb6e6936d5955a0fdc4d5c6b5
F doc/tclvars.n d52d78df61edd63d3e0ed0bc1999468a207fb1f1
F generic/tcl.h f522f635046f5c9bc74cc910bf1938605286f23a
F generic/tclBasic.c ca0d96f141cb6d528010f7ae398349cf23f55fdf
F generic/tclBinary.c 9314bc3cf9ab1c98f46e83c75da6384b130040b3
F generic/tclClock.c 8f3cf95158c4dccfdc40e3c83b9e0792de84f480
F generic/tclCmdMZ.c 4183bf30eaaac3190f24bf61e6a34867a843cc05
F generic/tclEncoding.c 526a506b8b74b08c8de83a03a2938e87e32e903c
F generic/tclExecute.c e102ceaf11705fa8d2f62434280aab033f0efb4f
F generic/tclIO.c 461181446895569a7c98cd2d655be13ad57276c9
F generic/tclIO.h cb79fad5de83b68b1c7fe4f06364cb794f0063c7
F generic/tclIOCmd.c 2a8c84d46a3793ddf8399440cf617469d5ae1201
F generic/tclIOGT.c 511ad3ee065b65907c101047832fd15b515bf72e
F generic/tclIORChan.c 8fc888c9643b48014a6f2356020e9eded5336e6e
F generic/tclIOUtil.c 17a2fa127a95daedd8c678b0ada005097e2f58bd
F generic/tclInt.h 646709dfd60b94a3b58cd9c6eca98b30999d15e4
F generic/tclIntPlatDecls.h 899328427806c04696716f96508f8072c0740f1b
F generic/tclListObj.c 3d0412775d3d200eab6a159b2e2087ad23990c5d
F generic/tclNotify.c bada4bc2f860758a60810040513c06f10d53e06a
F generic/tclStringObj.c a91bcd6ae1a75bbb790046fd0bd4c4c9d1b8d520
F generic/tclStubInit.c 6d9b87d340fd0e6c8a859180102442b9a5b4d007
F generic/tclThread.c df1432c407465c97b02ea58a38bfb97245f8ef8c
F generic/tclThreadAlloc.c f08799faafc9147a4b9cd020a1ef15b7ede3d4ae
F generic/tclUtil.c 6db0377f7604898af56bc3e4d4c43baec70ca262
F library/init.tcl 3d9a25f97686734bbf55d3a13388165c12c348d4
F library/parray.tcl a0b1bd4e68dce1768d3c5e0d3c7b31e28021d3ba
F library/tcltest/pkgIndex.tcl 045ecb9e24608694c6ec88d252012239c6dd6b73
F library/tcltest/tcltest.tcl 0026f9e0fea4c0538515690a618a5ffd378c865e
F tests/chanio.test b4812e705a73b4daba34d7e06c9f62a8d3dda20a
F tests/clock.test 530f4af8e558467725ef42ffd9dff83958add128
F tests/cmdAH.test 56d5d88f42eb60b01d37d42cc5dd01f6add6230a
F tests/io.test 805138790db7e2986ab8891151661b63de626619
F tests/ioCmd.test c5f409c87a5347e637f26aa8dda2b246577b8b31
F tests/iogt.test e7b2954b68522fe9f98033b16f9fd9cc32fa15b3
F tests/namespace.test 96bd1d62b1c7f86f462a87c76492b7605783a703
F tests/socket.test 8269635d838903564187738adb968829ecfdcc3c
F unix/Makefile.in 0805adfef4a451ea77f143f0cc3b396b11340fd9
F unix/configure 4ef908e29a7a191a44017afb1faa10f37b98ce9a x
F unix/configure.in b9dcace895517bd0c915569cf867f864a00ba2bb
F unix/tcl.m4 48c8e37603b1fea17af7373ca91b5d3b1d1e639b
F unix/tcl.pc.in ec0d5900f48812f8a743be3f9d9982bf49a1c949
F unix/tclConfig.sh.in 6c2f3bf7285bc8ae34a86fbb03abf13554cea428
F unix/tclUnixFile.c d9e27b7216ba9869dce5f512073701b0a9615402
F unix/tclUnixInit.c 0482cc7eb84bec324530730b02751c40ba88def3
F unix/tclUnixThrd.c 479aec97fdbd8220a6a47fed0ec9fd0848de002c
F win/Makefile.in ba4b95ea49dffdfe311164922f95c0e21e30f487
F win/configure 6796c6d081cd7913a5c2708e4146f26f9bd4df77 x
F win/configure.in 514a64b85283699f518998638c289afd1d9273b2
F win/makefile.vc 452223f7f2fc94392fcbc685d15274b58c624220
F win/tclConfig.sh.in 981fb036808da6e05a9be59368c8e133232deb91
F win/tclWin32Dll.c 40b0bec3e0e2bf6c89ed8ba6768ce84f57e2fb78
F win/tclWinChan.c a288fcf8f36fe3166a3be276200b93b41eb56afd
F win/tclWinFCmd.c 460b98be326f72ebef1056fa81c53cd7f5398287
F win/tclWinFile.c 4509f674d121f0d4d4bc2277549306358cda91cd
F win/tclWinInit.c baf7cf154946ad2cd027824703799e443e1fa943
F win/tclWinInt.h b6afacd04337b999218a18d79791fcee6b112501
F win/tclWinPort.h 47c9f0469d202c5aa04e5d29f1fe22f78319d000
F win/tclWinSerial.c d18f2a14fba23d937887106b398904c20013fc06
F win/tclWinSock.c 32ebec7c1c73a70c9ec5a1ff4241a4a09b758ffc
F win/tclsh.exe.manifest.in 11f0700eb0759f46f6c3a3a51ae529698a122d8d
F win/tclsh.rc 967eeedb2ed14f07b6e59294a0f9a0e63ee0d8fd
P f6b7d496c4a7a9697f828dfd24f5f54cfabd2b88
R 4139fbf1076ba36c90e1f27ed185081f
U andreask
Z ef10f6af487ba362dddeee35d38c6880