update_permissions in src/database.c does not check the return value of
fchmodat nor fchownat. There are a number of reasons it could fail:
- EIO, disk I/O error
- ENOMEM, memory was exhausted while apk was running
- others, though they are much more theoretical (abuild-apk shim hitting
EPERM, a bad package causing ELOOP, a filesystem corruption causing the
FS to go R/O while apk is running causing EROFS)
This also causes a build failure when building on glibc (because glibc
marks these functions as having return values that cannot be ignored).
I think it would be a good idea to ensure these calls succeed and set
the package as having an error if it isn't (so that a reinstallation can
be attempted). But I don't know if there is a reason they are ignored.
I also am not familiar enough with apk-tools to be confident in the
proper way to set error (don't even know if ipkg is accessible from
update_permissions which seems like the main way an error is set).
Thanks,
--arw
--
A. Wilcox (awilfox)
Project Lead, Adélie Linux
https://www.adelielinux.org
On Wed, 20 Feb 2019 12:18:57 -0600
"A. Wilcox" <awilfox@adelielinux.org> wrote:
> update_permissions in src/database.c does not check the return value of
> fchmodat nor fchownat. There are a number of reasons it could fail:
>
> - EIO, disk I/O error
>
> - ENOMEM, memory was exhausted while apk was running
>
> - others, though they are much more theoretical (abuild-apk shim hitting
> EPERM, a bad package causing ELOOP, a filesystem corruption causing the
> FS to go R/O while apk is running causing EROFS)
>
> This also causes a build failure when building on glibc (because glibc
> marks these functions as having return values that cannot be ignored).
>
> I think it would be a good idea to ensure these calls succeed and set
> the package as having an error if it isn't (so that a reinstallation can
> be attempted). But I don't know if there is a reason they are ignored.
>
> I also am not familiar enough with apk-tools to be confident in the
> proper way to set error (don't even know if ipkg is accessible from
> update_permissions which seems like the main way an error is set).
I think this is something we should fix.
Can you please create an issue on bugs.alpinelinux.org, and maybe send
a proposal for a patch (if you have any). I suspect it will be easier
to give feedback on a patch.
> Thanks,
> --arw
>