<< Back to previous view

[QB-1860] Build agent in service mode does not inherit PATH environment variable on Mac 10.8 and up
Created: 25/Nov/13  Updated: 02/Dec/13

Status: Open
Project: QuickBuild
Component/s: None
Affects Version/s: 5.0.29
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Irina Kotlova Assigned To: Robin Shen
Resolution: Unresolved Votes: 0
Remaining Estimate: Unknown Time Spent: Unknown
Original Estimate: Unknown
Environment: Mac OS X 10.8 (Mountain Lion)
Mac OS X 10.9 (Mavericks)


 Description   
Prerequisites:
- QuickBuild build agent 5.0.29 is installed on Mac OS X 10.8 Mountain Lion;
- agent.sh is updated with RUN_AS_USER="svcbuildm";
- the machine is rebooted.

Result:
After the reboot System Attributes tab displays the environment:
PATH /usr/bin:/bin:/usr/sbin:/sbin

'echo $PATH' in the shell displays:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/bullseye/bin:.:/Builds/QuickBuild/buildagent/bin:/Applications/Xcode.app/Contents/Developer/usr/subversion-1.6/bin:/Users/svcbuildm

Expected result:
The shell's PATH setting is expected instead of the one displayed.

Conclusion:
Shell's PATH environment is not preserved in QuickBuild build agent as expected.

NOTE: This behavior is not seen on earlier Mac OS X 10.6 and 10.7.

 Comments   
Comment by Irina Kotlova [ 26/Nov/13 04:21 PM ]
NOTE 2:
Actually the problem is seen on 3 newer MacOSX: 10.7, 10.8, 10.9.
The problem is not seen on 2 older MacOSX: 10.5 and 10.6.
Comment by Irina Kotlova [ 26/Nov/13 09:44 PM ]
Noticed that PATH set in /etc/launchd.conf is, indeed picked up by QuickBuild agent.
If specified with /etc/paths.d/* files, /etc/profile, .profile PATH is not picked up by QuickBuild agent.
Comment by Robin Shen [ 29/Nov/13 12:36 AM ]
See below reply from JSW support:

I did some more poking around and found the following two pages:
http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x
http://superuser.com/questions/476752/setting-environment-variables-in-os-x-for-gui-applications
As is true with most "experts" pages, there is a wide range of advice, but it looks like /etc/launchd.conf is the option which works. This appears to be in line with what you are seeing. There does indeed appear to be several differences between OS versions.

Are you seeing the problems after a reboot? new processes don't reliably pick up most env changes because of the way the environments are managed. It looks like an OS reboot or at least logging out and back in is usually needed.

I also came across this:
http://diaryproducts.net/EnvPane

Is there some specific behavior that you think the Wrapper should be doing differently? From what I have seen the behavior appears to be normal for each OS version. There may be some things we can do to make the Wrapper more convenient for users, but I would have to understand the issues very well to make sure we don't introduce any problems.
Comment by Irina Kotlova [ 02/Dec/13 05:27 PM ]
Thank you very much, Robin for the detailed response.

My main problem is that PATH is inconsistent while switching between service mode and console mode. This complicates debugging.
Generated at Tue May 21 18:11:40 UTC 2024 using JIRA 189.