xcode-select -switch sets wrong permissions on /usr/share/xcode-select/xcode_dir

Originator:raimue
Number:rdar://10893107 Date Originated:19-Feb-2012 11:22 PM
Status:Closed Resolved:02-Nov-2013 03:43 PM
Product:Developer Tools Product Version:Xcode 4.3 4E109
Classification:Serious Bug Reproducible:Always
 
Summary:

When using a umask value, xcode-select -switch sets wrong permissions on /usr/share/xcode-select/xcode_dir_path, where the current developer directory is saved.


Steps to Reproduce:

Delete existing xcode_dir_path to reproduce (this file did not exist on a fresh install):
$ sudo rm /usr/share/xcode-select/xcode_dir_path

Set umask value:
$ umask 0077

Select default developer directory:
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

After this, xcrun, xcodebuild etc. fail to run:
$ xcrun -find clang
xcode-select: Error: Incorrect permissions for xcode-select data. Run xcode-select -switch <xcode_folder_path> to reset the path to the Xcode folder.
Error: /usr/bin/xcode-select returned unexpected error.

Obviously, these permissions are wrong:
$ ls -l /usr/share/xcode-select/xcode_dir_path 
-rw-------  1 root  wheel  43 Feb 19 23:07 /usr/share/xcode-select/xcode_dir_path


Expected Results:

The path /usr/share/xcode-select/xcode_dir_path needs to be readable for all users:
$ ls -l /usr/share/xcode-select/xcode_dir_path 
-rw-r--r--  1 root  wheel  43 Feb 19 23:07 /usr/share/xcode-select/xcode_dir_path


Actual Results:

xcrun, xcodebuild etc. fail to run and quit with an error message about incorrect permissions. It does not indicate which file actually cannot be read. Running xcode-select -switch again does not correct the permissions on this file, even when using a different umask value.


Workaround:

Manually adjust permissions of the xcode_dir_path file:
$ sudo chmod a+r /usr/share/xcode-select/xcode_dir_path

Or, delete existing xcode_dir_path as otherwise it will not be created with new permissions; set umask value to be more permissive and run xcode-select -switch again:
$ sudo rm /usr/share/xcode-select/xcode_dir_path
$ umask 0022
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
$ ls -l /usr/share/xcode-select/xcode_dir_path 
-rw-r--r--  1 root  wheel  43 Feb 19 23:07 /usr/share/xcode-select/xcode_dir_path


Notes:

(none)

Comments

This issue has been verified as resolved and can be closed.

Tested with OS X 13A603 and Xcode 5A2053.

Apple Developer Relations 22-Oct-2013 11:22 PM

We believe this issue has been addressed in OS X Mavericks GM build 13A603. Please verify with this release, and update this report with your results.

Follow the link below to download build OS X Mavericks from the Mac App Store:

https://itunes.apple.com/us/app/os-x-mavericks/id675248567?mt=12

OS X Mavericks GM Build 13A603 Post Date: October 22, 2013


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!