Received: from wolfsden.cz (wolfsden.cz [37.205.8.62]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 89F96782CE2 for <~alpine/devel@lists.alpinelinux.org>; Wed, 7 Apr 2021 22:50:08 +0000 (UTC) Received: by wolfsden.cz (Postfix, from userid 110) id C4BEF4B01C9; Wed, 7 Apr 2021 22:50:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on wolfsden X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_ALL autolearn=no autolearn_force=no version=3.4.2 Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 920284B01C8 for <~alpine/devel@lists.alpinelinux.org>; Wed, 7 Apr 2021 22:50:06 +0000 (UTC) Date: Thu, 8 Apr 2021 00:50:06 +0200 From: Wolf To: ~alpine/devel@lists.alpinelinux.org Subject: Why does apk fail to install packages with 0 size? Message-ID: <20210407225006.thogaepvkqq2ytbx@wolfsden.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="lhfdjvw6jzcb7mpg" Content-Disposition: inline --lhfdjvw6jzcb7mpg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, To follow up on my original mail thread (apk not installing a file), I've dived into apk's source code and managed to track the problem to: src/database.c: 2920 2921 if (newpkg->installed_size !=3D 0) { 2922 r =3D apk_db_unpack_pkg(db, ipkg, (oldpkg !=3D NULL), 2923 cb, cb_ctx, script_args); Which I guess means that if installed size of the new package is zero, the unpacking is skipped. That might sound reasonable, but leads to packages wi= th package function looking like: package() { mkdir -p -- "$pkgdir" touch -- "$pkgdir/test-foo" } To be silently skipped with no errors nor warnings. That is highly confusin= g, because there is not reason this should not work. For the time being, my workaround is: package() { mkdir -p -- "$pkgdir" echo >"$pkgdir/test-foo" } Which is bit sad result given how much time I've spent on this. :/ So, my question is: Is this behaviour intentional? If so, why? And if it is not, what would be nice way to fix this? I can work on patch, however I'm not sure what would be the best angle. W. --=20 There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --lhfdjvw6jzcb7mpg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE7BIrb0FxyZaks1p7hTP5S2N55TgFAmBuNx0ACgkQhTP5S2N5 5Tj+FA//SNfpCuUWtEheQ7eAok4+Hb8O26nDAS9pOvxNEbatuD58LjbVHzKiG8NK I+VAm6QyIqNSBKDxFANkr+/+7RV9fAvfdyhYVzHivFA2sUS40IB+RaKnn6bSg6xG YeJRO7JS9Gyx3ifJdaK44d3N5GPv6G+nX/07jUfnRng9YKT8PKEuT+5foyfdiceY naVQ0IRNEjJ2O6zrz1qmN+ZCukgN/Rm2TrQsv/KvXQvpaFM1vuz2pRcimBybcL6n JmIPvdE98h4xfbK+lAXnnvNeZg48vymSlABw+7OYocE/XuJnIG50wIMH6o7c4d4I Jnk4ZEQGpnckJQks3WbklXg0wvBWQwDe/0QAS2zDiVM7cxLw7BsCDvUxaD/92B1m vtiE5jtQcMh0L61mGFoy3FvYN8FyY6iYHgwroAUaJVBTxQ4ccwkmJqT73CAwcjuC YI7C11AzzHJhkQku3EyUnw1RaScdSs6HQde8e5jQyPGb7TEVxY60b3wqkdXwFRf+ pYln7sij/hyUJ68yFzgVR9cigbpl7krluD5GEpAEzPQhVUC0W1D9lX1nuENVTFLZ 822/jRjmt+RzOR46/bLNypjvDUebDrfhzhJmUYmyeP8b+14UYa/ysPXfPQBbrpQn S38kAN/WKYojEZ4NEitwAIq5c/qsAPPeg14ZOKw8G1A/CYdztD8= =bzhm -----END PGP SIGNATURE----- --lhfdjvw6jzcb7mpg--