Can Ant's tar task set a Linux file permission even when the task is used on other platforms?

。_饼干妹妹 提交于 2020-01-15 11:41:34

问题


Starting with Ant 1.7, the TarFileSet is available which seems to allow file permission modifications in the tar archive.

Does this feature work platform-independent, so that I can for example create a tar file on Windows and set execution permissions for script files in this archive which will have this flag if the file is unpacked on Linux?


回答1:


Yes, you can set permissions using tarfileset, using the filemode and dirmode attributes. This works when creating tar archives, even on windows.

Rather annoyingly though, the untar task does not support the reverse operation that you might want:

File permissions will not be restored on extracted files.

But the permisions are restored fine if you use tar -xf, for example.



来源:https://stackoverflow.com/questions/3678403/can-ants-tar-task-set-a-linux-file-permission-even-when-the-task-is-used-on-oth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!