-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
update-file-header changes file permissions: clears executable bit #166
Comments
For those with automation pipelines, this workflow is a workaround:
|
An integration test reproducing the issue in https://github.com/mojohaus/license-maven-plugin/tree/master/src/it would be highly welcome. |
I tried to make an integration test but I cannot... Furthermore, I only noticed that the file permission is changed only when the contents is changed (a new header is applied). |
As far as I can understand the code, the UpdateFileHeaderMojo works, by making a copy of the original file, adding the header to the copy, and finally deleting the original file and renaming the copy : license-maven-plugin/src/main/java/org/codehaus/mojo/license/AbstractFileHeaderMojo.java Lines 737 to 764 in e427a5c
So it is not surprising that file permissions get lost in the processing. After some debugging I think the fix has to be done in this method license-maven-plugin/src/main/java/org/codehaus/mojo/license/utils/FileUtil.java Lines 156 to 176 in e427a5c
I am not familiar with manipulating file attributes in Java, but after some stackoverflow search I think you could use
I develop in Windows and the combination git+windows makes painful for me to provide a test, but I hope this helps |
I just tested Perhaps the solution could be just to override the content of the original file (without deleting it, so that it keeps the permissions). Starting from JDK1.7 you can use the convenient method |
Fix #166 update-file-header changes file permissions: clears executab…
I am running
license:update-file-header
; one of the files is a.sh
with mode 755. After running, even though there is no change to the contents, the permissions are changed:Note the permissions changed, but the contents did not! (Because the file is already correct)
The text was updated successfully, but these errors were encountered: