diff options
author | Mike Frysinger <vapier@gentoo.org> | 2014-11-01 08:11:47 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2014-11-01 08:11:47 +0000 |
commit | a71b0971bc96ec32459ebf7dbef89c7437938359 (patch) | |
tree | eab7e8b1c9eb244bc65b8585833302f698c8d8a1 /dev-util/ccache | |
parent | Version bump #527480 by Markus. (diff) | |
download | historical-a71b0971bc96ec32459ebf7dbef89c7437938359.tar.gz historical-a71b0971bc96ec32459ebf7dbef89c7437938359.tar.bz2 historical-a71b0971bc96ec32459ebf7dbef89c7437938359.zip |
Fix temp file usage to not rely on pids (fixes running in pid namespaces). Fix disk usage checks #456178 by Richard Yao. Always use /usr/lib/ccache/bin/ #509956 by Michał Górny.
Package-Manager: portage-2.2.14/cvs/Linux x86_64
Manifest-Sign-Key: 0xD2E96200
Diffstat (limited to 'dev-util/ccache')
-rw-r--r-- | dev-util/ccache/ChangeLog | 11 | ||||
-rw-r--r-- | dev-util/ccache/Manifest | 31 | ||||
-rw-r--r-- | dev-util/ccache/ccache-3.1.10-r1.ebuild | 69 | ||||
-rw-r--r-- | dev-util/ccache/files/ccache-3.1.10-real-temp-files.patch | 185 | ||||
-rw-r--r-- | dev-util/ccache/files/ccache-3.1.10-size-on-disk.patch | 21 |
5 files changed, 302 insertions, 15 deletions
diff --git a/dev-util/ccache/ChangeLog b/dev-util/ccache/ChangeLog index fc474ce90e52..9d872d8c6406 100644 --- a/dev-util/ccache/ChangeLog +++ b/dev-util/ccache/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for dev-util/ccache # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-util/ccache/ChangeLog,v 1.140 2014/11/01 07:54:34 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-util/ccache/ChangeLog,v 1.141 2014/11/01 08:11:46 vapier Exp $ + +*ccache-3.1.10-r1 (01 Nov 2014) + + 01 Nov 2014; Mike Frysinger <vapier@gentoo.org> +ccache-3.1.10-r1.ebuild, + +files/ccache-3.1.10-real-temp-files.patch, + +files/ccache-3.1.10-size-on-disk.patch: + Fix temp file usage to not rely on pids (fixes running in pid namespaces). + Fix disk usage checks #456178 by Richard Yao. Always use /usr/lib/ccache/bin/ + #509956 by Michał Górny. 01 Nov 2014; Mike Frysinger <vapier@gentoo.org> files/ccache-config: Trim empty ccache dirs automatically #517242 by Arfrever Frehtes Taifersar diff --git a/dev-util/ccache/Manifest b/dev-util/ccache/Manifest index bf8693fcb16f..2f56dd05a30d 100644 --- a/dev-util/ccache/Manifest +++ b/dev-util/ccache/Manifest @@ -5,6 +5,8 @@ AUX ccache-2.4-profile.patch 1069 SHA256 7cd6e8fcd2fc90aac484ff83c1181c82eca4ec3 AUX ccache-2.4-respectflags.patch 403 SHA256 f7006cc34ecc8315b023d4533273d47a7a34958e7037242811a58ee8570efbd5 SHA512 f05ebbfc30a71d0f9e2182364a9c0fed2ffe4cd382f2ff19bb2d6311d2ec086452804253aea485aea36a70871b35cf6b88e1e55260cdb898aaa8755644ba7f8a WHIRLPOOL 809a6841dd4ca9ab35fddd5258dc5781d1ebf11d7e412b7aa7611135b5aeb8fe01bd5bb2c4f1f26fef076d4c1edb34bed53870c193dd75d0d69e4c14d1fef581 AUX ccache-2.4-utimes.patch 3267 SHA256 72f617b329a68c9db57180a9940689a48acee771067392a2d68b8abf8cdf891a SHA512 06592fa636085e39fb3b8a3495fc388a68603afcc3d2273b4379caa1d0ab2346082459916bf047aa1f6fef73cc23ecbcd74e7335e2ca9fd154a7e726713fae44 WHIRLPOOL 8db5e5187aa775f8fb569346e64d663e245d8be1403e0d807cd4b34a0a4af0db3f32db60712ef49a461ef82e315ed7baf5c5dd86c0c3f37553e4d43d8af3a7d3 AUX ccache-2.4-xrealloc.patch 742 SHA256 119c8fb7f3ec725444e416e42d690fdf81470213a837274bc5375f659942147c SHA512 86a06cdeb9e9b7ed6bcbf57f85cfa38fe13f64d4654e225cc1b24b0dea38778fc87732362be872587ad3db02e5421a7bcb4771f56cf79ecea0b77ed4928cddfc WHIRLPOOL ded4aa06e4daf6447314e00e3ac4503b143a41385f1532672c43dea9b2033b7ca17ef4111e95efd2be87c84e176bdb9310b485f45312a2c83cee557766f31195 +AUX ccache-3.1.10-real-temp-files.patch 5539 SHA256 39382b8f098b7c546d2d2d951abf6766af3afed71b25456a1c57093d06dacf06 SHA512 a0c519ed56277cd79cf2ba5bea9b44a5450a2269f44ff94dd6288a52f929bfa453733a4cba49dd61df0c614d19b88513737fb13550d49ea1ebf32c3ea155dff5 WHIRLPOOL 795fc6858e490d12f1586791cb61766c52081dc21ae5caf80c822f116b014b4e18c073d6fc290ada3f414a16233a93b57463145afe67e5f26bb3e26822b019a3 +AUX ccache-3.1.10-size-on-disk.patch 518 SHA256 63e778782c31420caa395079554a1204cb2d899d745afbc330aee708dbbd7605 SHA512 bf7a160b091798e7de57748f4f9e0d6f027872c713108e3791cfc82bf64d3ed843607267ff0cca9e0848abf8bbcbbb6c19921560032576849a42f29ecc496212 WHIRLPOOL ebbe8a3409efa280554800a75bb5a16a5a798a1504cc5613374a7ab156b7d80ba8ff9914fd1bc61454d09545dc3f2fd8f2ba5857344b0e3546201d9a4ecdb3a4 AUX ccache-3.1.7-no-perl.patch 400 SHA256 5784419b79e89bda1bf0a8d053c26c9d798dc88ef0756f19c0b0d40f93c3aef8 SHA512 bd529e4ec577a458e5933d2f55ab54fc783eb00a14f4f6879e1cf4f20d058816651b80bed7141e1fac6863f1ed34cfc65658d42ad728b2dcb9cf4ceab7f6318a WHIRLPOOL 8299d984e66d3328166bf4a4e676f963bbd7203bacde6ac5b1d74a98da589239efa03946431b43f026e45eaf5b922e7792a89fc905c17a591304c86c1af9ddbc AUX ccache-3.1.9-test-gcc-4.8.patch 5157 SHA256 da673ec98db54c2fee09585ffe4ac4fde3d9867a9a66f0064f8de4d7409644c1 SHA512 44cb88357b1fece0869463c4819422823d8025be577dc50eaeb435a3675c033c56e1dc0474b505830b229de7f8bd92cd6833eae72830d89a2e4a89b8a46aed6f WHIRLPOOL 88d61b411367808e0239a949e01742ed2204e8212a4af8dd919f4d6335a040769d9b33ea2e1c1b71eba69c25b81f1417d717bcb6dd4799a9d276a0ec7bfe00ff AUX ccache-config 2222 SHA256 02df1f8f5fbd07c0eab09f18a51c357525953163391adc95ed5e46c813bffdd0 SHA512 58a635bcfb1a682b36a67e70ecad29912fd1e5cca20ebbd1a89912b97f18ada204cf24f2bb88ddce985ab3423a94d34e2322a08f1dc0d8bd17a4b77bbcd66282 WHIRLPOOL 87086954357d3e09e7fa75395ef02a84d86fb1d74caa3d117c5bca80d1531f1b454ef715678972893fd82be43a3e3efbc8c81a14a3520dd3b84eb7141c06277d @@ -25,6 +27,7 @@ EBUILD ccache-2.4-r7.ebuild 2412 SHA256 2a49abd73c7dc5a1464c3842f0f261aa3be666e6 EBUILD ccache-2.4-r8.ebuild 2493 SHA256 cf1e11acbe5ab243232cabffee3776f272198b3d67d726aedc74cf6ecd7b44b3 SHA512 f25365a5877a0d97a55104712492b56f9286ca03a3743d5e1c43919a1ca9496696d38fe4a60c408e10fab1f52b7023aeb19b809e4d21d850f67bf8ea45283d59 WHIRLPOOL a942be540fc002f4b8f91a96a21f8b281ca4667baedfb51a2a27a0e48e934b25bd55d17cfd65299735fb39f54276ef5435d50718989f018fbc7a1717b7431df6 EBUILD ccache-2.4-r9.ebuild 2533 SHA256 c1b440410ebdf9850c91fa69eea44727e2f09be7093dd3daa0a6397b5227b715 SHA512 221d515fdb48a110d44928f581f9b9866af02ca9bed98063239bf9852f7a1d325091948b568c39d19dcd105bb88dd894187245f2b4911fa4366784235393859a WHIRLPOOL 2f8c34b280d6c9e0d8620cec33769b484c08bdb9440695e59669958c607b774f0df99c3b964e6ee183a46a3b8418a0732b2d3738dcb3be6f743a44016a4e4390 EBUILD ccache-3.1.1.ebuild 1881 SHA256 8c46a74aeaaf0a7b04eae87cd5308d4e11af42c8a5c7bfa690af9bd3e1eae9dd SHA512 6a57439de8d3c02b4608fe7773cf2800ff0bdd09fe1117559694c68c9451e182aa58eb2ef7a43833d8e9f70cb9d1c04d9d2987e7cba418feea9a041b6147f790 WHIRLPOOL 401c2fcb58bf19d73f124f483dc94351d6612bcb6cd65b6b7e0349d2e8383460fdfcf2e71243b2e0c29d12ffb759ae84117ddf1c8d47b39cbb5d3eda977aff43 +EBUILD ccache-3.1.10-r1.ebuild 2254 SHA256 6e76f01c269990692065438486354f714e5545f5cbd296eb7404020e0806ef9d SHA512 115ca712b3c33acdae279d3914a189f1b0cad89440a4abdff07b29e52291a6b67cfd167e7c69d704d6c571005edee272d511dc465a119ef084780ba15e4abe87 WHIRLPOOL 4b2c3e09781bbcc03b523d312bf074ba210205ddedb7c55222ef1d9da49fbac3de8241641b93bcbc04408dbfd98d94f5181ea03085f7d6da220b611678a4b1f9 EBUILD ccache-3.1.10.ebuild 2270 SHA256 4d5025e5afec91f333f2edd8625b7183c7d063b9949140bb1710555ae3832adc SHA512 5ac51895e340aa9138fdae87d48603cfefaae9a7642226e2a6da9656aeccb2c3cd936bc6cdbb65e50e1345409c61c44574d3812c8eb93d07f25631c22f2173b0 WHIRLPOOL d03745fea8f8c083535476a16ed4112893bcfb73259e7cb2375f84c961418b8fcf1b21ac89b1a6e41802f39d2b0dbd45fb45107ce55899cc1d4fd7c7e11921a0 EBUILD ccache-3.1.2.ebuild 1841 SHA256 a82766e6582602ca249b4b4432e3f399f2ad6d0db6af860b2d7c7134251f40c6 SHA512 b74a62b6ba12b99c12fd89f748120c7f102e0cc8297972c308e55a30ee426dd339560d1d2168e36a2cf4f2426f37ceff6437568afd6880f8c7904ffff78005de WHIRLPOOL a1fa1ed3694eb689bc3aa1ac25c035edd2aed8ecb5df6b752f61da3d48cd76576f9d673cde73c3cbe2c110a379767988f8d43850cafd335d176faa3650596acc EBUILD ccache-3.1.3.ebuild 1841 SHA256 ff190eba38b8f5f253106780fe36ed979241ee0ce521bc4d7248ea9a2747ad4a SHA512 e48c78851bdd12ecc86a70867ae9908c1f70b9b27b79ab76b2f5fc71a5e8bf0c6f0e2d93915cb768415913d581363611224ca6966a232c833e12d7dc4a661644 WHIRLPOOL bf2fc84ef5095bd5db3b33097aa2508932b65cd1f378ecbf867973152a6944f2f85fb23642ac364e48a7c178cf8f297bccbc926447b574f077bd055987e5773a @@ -36,22 +39,22 @@ EBUILD ccache-3.1.8.ebuild 1828 SHA256 c8cb4b4b93ad0e34cbcd2cb53da63f2c0856c5ed7 EBUILD ccache-3.1.9-r2.ebuild 2414 SHA256 8ce6c043db2f19f2e02793cc0a7d96d638eac980f5010b0ebf787a701199feff SHA512 4b42ccdaf4e6af712185cad5d4976d0f78ef77b6a3d7f7dc676181bc7a1ebf60a49d4b51cbb18f53d802b537a17f633bef03c90513342293b318dc21c7b06474 WHIRLPOOL a1a6da113df674fec5da42d8febc6d79755cf3b5570c36644139dac3c016ba7f531b42e082f0b1d4ad585c3a6cde00471857d17684afdbf189f8fc7e95746cf3 EBUILD ccache-3.1.9-r3.ebuild 2311 SHA256 a04470ec13d50277af4172058764ba0ca27ff5fc4bb601088959fd7978eca018 SHA512 293a645353e3a560d68b4ddba5d77c1a6a54fa23160559cc7465b37de601c5381aab9d44440c597dcd6cb52eb8487a56b6246c14e084808b48c154a257439e4f WHIRLPOOL 23534b4af2242cc1aa6d2c8bf0a2c6bff157f6603c0c86ffde781897af3e8d0e1d0c359d3b909b51c0fec39a7b8d3d2f231b392f5bc121800b390e4a302706e1 EBUILD ccache-3.1.9.ebuild 1930 SHA256 10c374f8e0896172880bf9a7e93351c8f5676e20a9d050b9e3b1a93e76bf1411 SHA512 4a2f148cfe8526fb9fa70b0b9339810af2811ba7d077a90fdc8b8b2280ea80a4790c9e475344f88bde4e01dbeb93ffa429d8e2d417537006201abd1eb2057284 WHIRLPOOL 104505aaf61b01fc384ff8e6118dfe51fd29b50f4c541a8cf31168a661f8216735368ea280b7e1e9bde640bf5f853e45d12cb321cde648f61578ee82a08e1721 -MISC ChangeLog 17734 SHA256 2c2e0586a1a2918a70a84d6b41a2fc2e7da5c58715e1bd3f77e957c4d766cf71 SHA512 9fcf034f690949d59cc03d6bd64f7332e433f43cbcdf3b2a1737ee2ab9300c3c6458981af27ee82e9886af444cd8777f705f9905f8c5c42e1bdd22932b65b5a2 WHIRLPOOL 6cb981760792f67f35c2cab6dc1009c657e4eb7414982f6007712cf2aed283321fdde09aed216c969c8ffca51ddfe806bcdee0a586ebb21779f40eb764119ccd +MISC ChangeLog 18120 SHA256 7828ea3e0e87c25588336dc2ad1b47af501c2b223a00800f6474292b71165a5b SHA512 6e5468b64b5eb6798d5c51eb6a82f9fd32046422cb7b86a614d630dc2d9ef0bb7b5c16170337944404faf1907154ecfd435f26f361b82e4cbef00c3b02c51de1 WHIRLPOOL c36760507d6782f57004847b0db52558690cc9a9413cf5f1055708af01d89a2b335307e07d6eb87630b5e5ee159d4c18b820c688a7ae0e8f932dac0cd8a025e3 MISC metadata.xml 412 SHA256 c54d1b5f225e3a82754a2550d3875b7211249572a9372abdeff5fccda469aada SHA512 63219b00d64d67e2ff11ac39f667be3ad110df35259d79267985e05ba6f0c932fd5b11dd78deb3fd062c963b6cd218db0a05958b54d323b86950991b80939899 WHIRLPOOL 329af87aff780d16300e5832dec6bec923b1cf54bd14f52db08e3fea7ef506ad85f627dc8005ec2f88f62f6dee27d7600eb558d4f66bc08011d23dee61bac297 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 -iQIcBAEBCAAGBQJUVJG7AAoJEPGu1DbS6WIA0H8P/Ar1tj+pZGdYuY43whHI8YsD -tamovCqVKvtEVPSiFkVj2rKqfTGHvZwU3OwIHWlVzewzbor6xWEgkzgVNMucCKWt -3n36TPNaPCQS+74js9rKHi4HRQ7JOCPd12sSnB29c9MWQpd/o+nXSM2LuafjwMOG -n3pinZwTOIcgQ2YHR6VwkvXgf8dPEKRcNHDZzFcysU1KEOtVYAVLIzgcfVzbORek -JtLUO6oSC5HNmqC5NdCzY8LOs6+jL2jy5ynbYTbtKb9RPOU7m/S1oZD7X+rDM+ui -LfFvkfGbxrt07gQyRDkiMIBw4Kci6IEG0/cKGMkMo5fh4G9pDdkxZh5IpcpJ26a9 -rd2OM1/XsoqqyHKx+JlVTnN0EvOW1JgehLJDRd3+F0ywEDAmWpTzqF9qeIvkUjLd -Xuj1vsuREtjDarKBI3MvUq9URE0Q/VN/S3x8HlteFW6UzFGBBjnYKjaJAK3yyY6a -cBPQOX1V1D6RYg2IU4Zlq2HfpHrf9FNlWZZK7hGq76uYWRPLYJBxPSzMRMht47uA -2I4TLWONY3qckDI9Qmrsmv6nlacJVmn4t0Lsm5IoGMPeFa1DSqvqkbgnqyyu/UwT -mnA3K26In1eY4vKgLnpyAwMl8nXgYAcwmhO2mGcgkj3HL1yWKqpeDoFtlg5sqPS9 -p9wU9jWMY1KhqdB5UJuk -=W50p +iQIcBAEBCAAGBQJUVJXDAAoJEPGu1DbS6WIAVZ8P/29ROzC2RpPkAbgTrTN/dgiQ +p8ZsWFUHBavKGFuEYMcN98Hh38xdvF/zabGJC/P2tQe7hKr+AaSn1RW7RzR+jHAi +wFpdzqSWt2y0uJiKzpBqjPHsII7m0pF/gdtpzgaqiktksDnJUAxzjVhtA5gwj29F +loyzjR3hVEiWcCVgFccAaeXtDk4V0kO9SrRuQl5U2UOAhRASBFLD2qlZezOGDXWk +lZHGjwbKD0gjYAd1qisVF6lbXlZR+sU5cmVggydUUsRFckQTqEF7yjRPzy7xDaQ/ +HbrrpIDaWm9TbCkmzPjJXwiAFXtentfu1frd4DZJmjEeSF5DAxW407vf71W9ZXsR +nj5ZWNAJaPsnTyKAj+qCLEdESqTpHmNTbAJfHKLQfQcIpj2QZV65T57tvPah6yMY +652rN2fzRNJseCL/CRBGVhSWiRe9aNlzf4G7DEr0lPo5/I3GLsDft8iTdftnCb3r +MZIyXfs6FetbbaHbNWvihHApq1w4rODw7/8JjsjVyz/gu2eDxxl51gCOMZmeQABt +s/Uffbunq+cM6F1/y6aPsO0ofBlnSZdqn+U3VdDmpp309ghBAgi4kmCFCyhypT6F +A7tY2QRI0Lasfq2mkU0t8qXOCZ6UmiUt5XJth5A+2nce0naU5Xm/fznEDYUSIlM/ +vrtDg+wJHMMCGGxxHYP2 +=U+iF -----END PGP SIGNATURE----- diff --git a/dev-util/ccache/ccache-3.1.10-r1.ebuild b/dev-util/ccache/ccache-3.1.10-r1.ebuild new file mode 100644 index 000000000000..0ec234981ef1 --- /dev/null +++ b/dev-util/ccache/ccache-3.1.10-r1.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-util/ccache/ccache-3.1.10-r1.ebuild,v 1.1 2014/11/01 08:11:46 vapier Exp $ + +EAPI="4" + +inherit eutils readme.gentoo + +DESCRIPTION="fast compiler cache" +HOMEPAGE="http://ccache.samba.org/" +SRC_URI="http://samba.org/ftp/ccache/${P}.tar.xz" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~x64-solaris ~x86-solaris" +IUSE="" + +RDEPEND="sys-libs/zlib" +DEPEND="${RDEPEND} + app-arch/xz-utils" + +src_prepare() { + # make sure we always use system zlib + rm -rf zlib + epatch "${FILESDIR}"/${PN}-3.1.7-no-perl.patch #421609 + epatch "${FILESDIR}"/${PN}-3.1.10-size-on-disk.patch #456178 + epatch "${FILESDIR}"/${PN}-3.1.10-real-temp-files.patch + sed \ + -e "/^EPREFIX=/s:'':'${EPREFIX}':" \ + "${FILESDIR}"/ccache-config-2 > ccache-config || die +} + +src_install() { + default + dodoc AUTHORS.txt MANUAL.txt NEWS.txt README.txt + + dobin ccache-config + + DOC_CONTENTS=" +To use ccache with **non-Portage** C compiling, add +${EPREFIX}/usr/lib/ccache/bin to the beginning of your path, before ${EPREFIX}usr/bin. +Portage 2.0.46-r11+ will automatically take advantage of ccache with +no additional steps. If this is your first install of ccache, type +something like this to set a maximum cache size of 2GB:\\n +# ccache -M 2G\\n +If you are upgrading from an older version than 3.x you should clear all of your caches like so:\\n +# CCACHE_DIR='${CCACHE_DIR:-${PORTAGE_TMPDIR}/ccache}' ccache -C\\n +ccache now supports sys-devel/clang and dev-lang/icc, too!" + + readme.gentoo_create_doc +} + +pkg_prerm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + "${EROOT}"/usr/bin/ccache-config --remove-links + "${EROOT}"/usr/bin/ccache-config --remove-links ${CHOST} + fi +} + +pkg_postinst() { + "${EROOT}"/usr/bin/ccache-config --install-links + "${EROOT}"/usr/bin/ccache-config --install-links ${CHOST} + + # nuke broken symlinks from previous versions that shouldn't exist + rm -f "${EROOT}"/usr/lib/ccache/bin/${CHOST}-cc + rm -rf "${EROOT}"/usr/lib/ccache.backup + + readme.gentoo_print_elog +} diff --git a/dev-util/ccache/files/ccache-3.1.10-real-temp-files.patch b/dev-util/ccache/files/ccache-3.1.10-real-temp-files.patch new file mode 100644 index 000000000000..45e654105170 --- /dev/null +++ b/dev-util/ccache/files/ccache-3.1.10-real-temp-files.patch @@ -0,0 +1,185 @@ +https://lists.samba.org/archive/ccache/2014q4/001246.html + +From 5d0f507a4162ac89e05ca633dbc8056454b798f5 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Mon, 15 Sep 2014 18:15:02 -0400 +Subject: [PATCH] do not rely on pids being unique + +Linux supports creating pid namespaces cheaply and running processes +inside of them. When you try to share a single cache among multiple +such runs, the fact that the code relies on pid numbers as globally +unique values quickly fails. Instead, switch to standard mkstemp to +generate temp files for us. + +Signed-off-by: Mike Frysinger <vapier@gentoo.org> +--- + ccache.c | 12 ++++++------ + ccache.h | 2 +- + manifest.c | 2 +- + stats.c | 10 +++++++++- + util.c | 13 ++++++++----- + 5 files changed, 25 insertions(+), 14 deletions(-) + +diff --git a/ccache.c b/ccache.c +index 02dbdfa..1dc0a06 100644 +--- a/ccache.c ++++ b/ccache.c +@@ -526,8 +526,11 @@ to_cache(struct args *args) + unsigned added_files = 0; + + tmp_stdout = format("%s.tmp.stdout.%s", cached_obj, tmp_string()); ++ create_empty_file(tmp_stdout); + tmp_stderr = format("%s.tmp.stderr.%s", cached_obj, tmp_string()); ++ create_empty_file(tmp_stderr); + tmp_obj = format("%s.tmp.%s", cached_obj, tmp_string()); ++ create_empty_file(tmp_obj); + + args_add(args, "-o"); + args_add(args, tmp_obj); +@@ -579,7 +582,7 @@ to_cache(struct args *args) + int fd_result; + char *tmp_stderr2; + +- tmp_stderr2 = format("%s.tmp.stderr2.%s", cached_obj, tmp_string()); ++ tmp_stderr2 = format("%s.2", tmp_stderr); + if (x_rename(tmp_stderr, tmp_stderr2)) { + cc_log("Failed to rename %s to %s: %s", tmp_stderr, tmp_stderr2, + strerror(errno)); +@@ -808,6 +808,7 @@ get_object_name_from_cpp(struct args *args, struct mdfour *hash) + } + + path_stderr = format("%s/tmp.cpp_stderr.%s", temp_dir, tmp_string()); ++ create_empty_file(path_stderr); + add_pending_tmp_file(path_stderr); + + time_of_compilation = time(NULL); +@@ -815,6 +816,7 @@ get_object_name_from_cpp(struct args *args, struct mdfour *hash) + if (!direct_i_file) { + path_stdout = format("%s/%s.tmp.%s.%s", + temp_dir, input_base, tmp_string(), i_extension); ++ create_empty_file(path_stdout); + add_pending_tmp_file(path_stdout); + + /* run cpp on the input file to obtain the .i */ +@@ -838,11 +843,6 @@ get_object_name_from_cpp(struct args *args, struct mdfour *hash) + can skip the cpp stage and directly form the + correct i_tmpfile */ + path_stdout = input_file; +- if (create_empty_file(path_stderr) != 0) { +- cc_log("Failed to create %s: %s", path_stderr, strerror(errno)); +- stats_update(STATS_ERROR); +- failed(); +- } + status = 0; + } + +diff --git a/ccache.h b/ccache.h +index 2bc7c87..43ef98d 100644 +--- a/ccache.h ++++ b/ccache.h +@@ -130,7 +130,7 @@ size_t file_size(struct stat *st); + int safe_open(const char *fname); + char *x_realpath(const char *path); + char *gnu_getcwd(void); +-int create_empty_file(const char *fname); ++int create_empty_file(char *fname); + const char *get_home_directory(void); + char *get_cwd(); + bool same_executable_name(const char *s1, const char *s2); +diff --git a/manifest.c b/manifest.c +index 7f02ede..47566d5 100644 +--- a/manifest.c ++++ b/manifest.c +@@ -633,7 +633,7 @@ manifest_put(const char *manifest_path, struct file_hash *object_hash, + } + + tmp_file = format("%s.tmp.%s", manifest_path, tmp_string()); +- fd2 = safe_open(tmp_file); ++ fd2 = mkstemp(tmp_file); + if (fd2 == -1) { + cc_log("Failed to open %s", tmp_file); + goto out; +diff --git a/stats.c b/stats.c +index 2111b65..4ed39c2 100644 +--- a/stats.c ++++ b/stats.c +@@ -126,11 +126,18 @@ stats_write(const char *path, struct counters *counters) + size_t i; + char *tmp_file; + FILE *f; ++ int fd; + + tmp_file = format("%s.tmp.%s", path, tmp_string()); +- f = fopen(tmp_file, "wb"); ++ fd = mkstemp(tmp_file); ++ if (fd == -1) { ++ cc_log("Failed to open %s", tmp_file); ++ goto end; ++ } ++ f = fdopen(fd, "wb"); + if (!f) { + cc_log("Failed to open %s", tmp_file); ++ close(fd); + goto end; + } + for (i = 0; i < counters->size; i++) { +@@ -138,6 +145,7 @@ stats_write(const char *path, struct counters *counters) + fatal("Failed to write to %s", tmp_file); + } + } ++ /* This also implicitly closes the fd. */ + fclose(f); + x_rename(tmp_file, path); + +diff --git a/util.c b/util.c +index 3b472de..cc630a6 100644 +--- a/util.c ++++ b/util.c +@@ -195,7 +195,7 @@ copy_file(const char *src, const char *dest, int compress_dest) + struct stat st; + int errnum; + +- tmp_name = format("%s.%s.XXXXXX", dest, tmp_string()); ++ tmp_name = format("%s.%s", dest, tmp_string()); + cc_log("Copying %s to %s via %s (%s)", + src, dest, tmp_name, compress_dest ? "compressed": "uncompressed"); + +@@ -427,7 +427,7 @@ tmp_string(void) + static char *ret; + + if (!ret) { +- ret = format("%s.%u", get_hostname(), (unsigned)getpid()); ++ ret = format("%s.%u.XXXXXX", get_hostname(), (unsigned)getpid()); + } + + return ret; +@@ -884,12 +884,13 @@ gnu_getcwd(void) + + /* create an empty file */ + int +-create_empty_file(const char *fname) ++create_empty_file(char *fname) + { + int fd; + +- fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_BINARY, 0666); ++ fd = mkstemp(fname); + if (fd == -1) { ++ cc_log("Failed to create %s: %s", fname, strerror(errno)); + return -1; + } + close(fd); +@@ -1134,7 +1135,9 @@ x_unlink(const char *path) + goto out; + } + if (unlink(tmp_name) == -1) { +- result = -1; ++ /* If it was released in a race, that's OK. */ ++ if (errno != ENOENT) ++ result = -1; + } + out: + free(tmp_name); +-- +2.1.2 + diff --git a/dev-util/ccache/files/ccache-3.1.10-size-on-disk.patch b/dev-util/ccache/files/ccache-3.1.10-size-on-disk.patch new file mode 100644 index 000000000000..5e502912bfa2 --- /dev/null +++ b/dev-util/ccache/files/ccache-3.1.10-size-on-disk.patch @@ -0,0 +1,21 @@ +https://bugs.gentoo.org/56178 + +stick to the size of files on disk rather than their byte size. +this func is only used for stats management, so this should be safe. + +--- a/util.c ++++ b/util.c +@@ -845,12 +845,7 @@ file_size(struct stat *st) + #ifdef _WIN32 + return (st->st_size + 1023) & ~1023; + #else +- size_t size = st->st_blocks * 512; +- if ((size_t)st->st_size > size) { +- /* probably a broken stat() call ... */ +- size = (st->st_size + 1023) & ~1023; +- } +- return size; ++ return st->st_blocks * 512; + #endif + } + |