RFR: 8336498: [macos] [build]: install-file macro may run into permission denied error

Lutz Schmidt lucy at openjdk.org
Thu Jul 18 14:18:33 UTC 2024


On Wed, 17 Jul 2024 20:35:04 GMT, Christoph Langer <clanger at openjdk.org> wrote:

>> On MacOS, files may have extended attributes attached. These attributes are copied together with the files. To prevent issues during further processing, the extended attributes of the copies must be removed. This action was implemented as solution of an older bug.
>> 
>> The solution is incomplete because it does not handle files with read-only permissions correctly. Without write permission, matter cannot remove the extended attributes. The action is rejected with a "permission denied" error.
>> 
>> The issue is present in all releases. I reproduced it in 11, 17, ... 23, head
>> 
>> The solution is to "chmod u+w" only those files which need to have their extended attributes removed.
>> 
>> Backport note: in releases prior to jdk23, the change needs to go into file MakeBase.gmk.
>> 
>> Testing @SAP completed without any related issues.
>
> Looks trivial. Can you hint on how to reproduce the issue? E.g. for which file I should remove the user write permission to get the build failing?

Thank you for the review, @RealCLanger !

Creating a reproducer is not completely trivial. There are two file properties that must be true at the same time:

1. The destination file must be read-only after copying
2. The destination file must have extended attributes attached. 

You can prepare any source file accordingly (file mode and attributes are copied with the command parameters used). In my setup, `make/langtools/tools/propertiesparser/resources/templates.properties` has an extended attribute, but r/w permissions. If I change those to r/o, the build will fail without the fix.

According to my experience, it is unpredictable which files will satisfy the above requirements. On good days, no file has attributes attached while being r/o. On bad days, there are multiple such files.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20203#issuecomment-2236652622


More information about the build-dev mailing list