Received: from mx1.mailbun.net (unknown [170.39.20.100]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 4DB53782D26 for <~alpine/devel@lists.alpinelinux.org>; Thu, 8 Apr 2021 00:08:31 +0000 (UTC) Received: from nanabozho.lan (unknown [107.125.25.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ariadne@dereferenced.org) by mx1.mailbun.net (Postfix) with ESMTPSA id B7E63144E16; Thu, 8 Apr 2021 00:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dereferenced.org; s=mailbun; t=1617840506; bh=UJRHvKuseVr+PS1vaWLEAC2AZXNfWEmXCz87UzfIneA=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=N69WoQ5TyVolASmZn9/XN73ZiDSg+vjxsFx6x4vC5v7BiTNsC1TugSg3HcRSrSesv wArt3/SFSWAbFVVDztFuebw9jxjUiS5zeRck4L3KSNDpDmt+jzqZskmtagEaIKOPTj 8Ickp7m0JY/i6cU5q+m1bWd9p1blLX2MMcBIja5JP949mqdTJZEhGZn1bow91fDdAV 2NWkADVZvYYQva8UQLy9ixbzZng3xjQtfUuX5c82gZuvE7p1KGWs5YdL4jRIf1Ylzr 1FBb4vaax2YJEK5yChtkQ6Dtte6Zwe+oTu+XnnB4m6/puchmJdqImTHbQ95Y84X0mI zvy9XdFHVTN4A== Date: Wed, 7 Apr 2021 18:08:25 -0600 (MDT) From: Ariadne Conill To: Wolf cc: ~alpine/devel@lists.alpinelinux.org Subject: Re: Why does apk fail to install packages with 0 size? In-Reply-To: <20210407225006.thogaepvkqq2ytbx@wolfsden.cz> Message-ID: References: <20210407225006.thogaepvkqq2ytbx@wolfsden.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Hello, On Thu, 8 Apr 2021, Wolf wrote: > 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 != 0) { > 2922 r = apk_db_unpack_pkg(db, ipkg, (oldpkg != 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 with > package function looking like: > > package() { > mkdir -p -- "$pkgdir" > touch -- "$pkgdir/test-foo" > } > > To be silently skipped with no errors nor warnings. That is highly confusing, > 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. I didn't think about the 0 installed-size at first. Yes, this is intentional: packages with a 0 installed-size are treated as virtuals. But, this can probably be fixed with a better design as part of apk-tools 3. Ariadne