-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #5451 - Private Work Dir #5457
Conversation
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
… directory. Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
Do we need the start module for the configuration of the posix perms? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janbartel and I have reviewed. We are OK with the general behaviour, but we don't like all the extra getters and setters and would prefer to use attributes.
API is forever!
if (fileStore.supportsFileAttributeView(PosixFileAttributeView.class)) | ||
{ | ||
String workDirPerms = context.getTempDirectoryPosixPermissions(); | ||
Set<PosixFilePermission> permSet = PosixFilePermissions.fromString(workDirPerms); | ||
tmpDir = Files.createTempDirectory(parentPath, temp, PosixFilePermissions.asFileAttribute(permSet)).toFile(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need to create a lot of new API for this. Can we just do it with attributes: context, server then system
if (fileStore.supportsFileAttributeView(PosixFileAttributeView.class)) | |
{ | |
String workDirPerms = context.getTempDirectoryPosixPermissions(); | |
Set<PosixFilePermission> permSet = PosixFilePermissions.fromString(workDirPerms); | |
tmpDir = Files.createTempDirectory(parentPath, temp, PosixFilePermissions.asFileAttribute(permSet)).toFile(); | |
} | |
if (fileStore.supportsFileAttributeView(PosixFileAttributeView.class)) | |
{ | |
String workDirPerms = (String) context.getAttribute(TEMP_DIRECTORY_POSIX_PERMISSIONS); | |
if (workDirPerms == null) | |
workDirPerms = (String) context.getServer().getAttribute(TEMP_DIRECTORY_POSIX_PERMISSIONS); | |
if (workDirPerms == null) | |
workDirPerms = (String) System.getProperty(TEMP_DIRECTORY_POSIX_PERMISSIONS, "rwx------"); | |
Set<PosixFilePermission> permSet = PosixFilePermissions.fromString(workDirPerms); | |
tmpDir = Files.createTempDirectory(parentPath, temp, PosixFilePermissions.asFileAttribute(permSet)).toFile(); | |
} |
We've changed tmp dir stuff a number of times... once a thing is said in API it is forever! So I think we just lean towards to loose attributes rather than API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the String you see for TEMP_DIRECTORY_POSIX_PERMISSIONS
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The biggest issue with attributes is making them friendly for start modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, where does TEMP_DIRECTORY_POSIX_PERMISSIONS
exist?
Not the WebAppContext
, how about IO
? or the Server
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is closed, but will answer so record my thoughts.
I see these attributes as hints to the implementation, so the string should be "org.eclipse.jetty.webapp.WebInfConfiguration.TEMP_DIRECTORY_POSIX_PERMISSIONS" and defined as a constant in WebInfConfiguration.
It is easy to make friendly for start modules, because we write the XML for those modules, thus we write the XML like:
<Call name="setAttribute">
<Arg>org.eclipse.jetty.webapp.WebInfConfiguration.TEMP_DIRECTORY_POSIX_PERMISSIONS</arg>
<Arg><Property name="jetty.webapp.tmpDirPosixPermissions"/></Arg>
</Call>
and then we just add to the ini-template of webapp.mod
:
## Set the permissions of temporary directory on POSIX file systems
# jetty.webapp.tmpDirPosixPermissions=rwx------
Ultimately, this is no different at the start module level than if we had dedicated APIs
if (context.getServer().isWorkDirectoryPersistent()) | ||
{ | ||
context.setPersistTempDirectory(true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should also do this with an attribute so we don't commit to a forever API:
if (context.getServer().isWorkDirectoryPersistent()) | |
{ | |
context.setPersistTempDirectory(true); | |
} | |
Object workNotPersistent = context.getServer().getAttribute(WORK_DIRECTORY_NOT_PERSISTENT); | |
if (workNotPersistent != null && Boolean.valueOf(workNotPersistent)) | |
context.setPersistTempDirectory(true); |
Closing in favor of replacement PR #5458 |
No description provided.