[BUG] run shell task error in worker server use idea
*For better global communication, please give priority to using English description, thx! *
i use apple as startup user, hdfs as tenant when running a shell task, there are some permission error:
[root@node2 dev]# sudo -u hdfs sh /tmp/dolphinscheduler/exec/process/1/1/111/206/1_111_206.command
/tmp/dolphinscheduler/exec/process/1/1/111/206/1_111_206.command: line 4: /home/apple/.bash_profile: Permission denied
version:dev
find out something here:

the configuration of env path in common.properties is not opened default. i think we should open the configuration in common.properties and cannot find 'envpath' from 'user.home'
It means execute command using user 'hdfs' when you use 'sudo -u hdfs', but this file owner is 'apple ', example, I use 'dolphinscheduler' as startup user, like this
the tenant you set is actual command execution user, but 'hdfs' is usually a special user about authority, try another user and it work fine?
i find the problem: the logic of this code is when the default 'env/dolphinscheduler.env' not exists, system would use the startup user home profile, because of the startup user is not same as the tenant, that can cause permissions problems. if we start worker server from command line normally, there is no problem, because 'env/dolphinsheduler.env' exists in the 'conf' folder. but i start worker server from idea, the 'env/dolphinscheduler.env' is not exists in 'common' moudle, so the permission problem arise.
This closed .#3137 https://github.com/apache/incubator-dolphinscheduler/pull/3137
This bug has been fixed. source code of branch dev: CommonUtils.java
/**
* @return get the path of system environment variables
*/
public static String getSystemEnvPath() {
String envPath = PropertyUtils.getString(Constants.DOLPHINSCHEDULER_ENV_PATH);
if (StringUtils.isEmpty(envPath)) {
URL envDefaultPath = CommonUtils.class.getClassLoader().getResource(Constants.ENV_PATH);
if (envDefaultPath != null){
envPath = envDefaultPath.getPath();
logger.debug("env path :{}", envPath);
}else{
envPath = "/etc/profile";
}
}
return envPath;
}