3

I need to edit extended attributes of directories that are symbolic links.

xattr that comes on OSX 10.5 unfortunately writes to the link target instead of the link itself.

I discovered a different version that supports a "-s" option to suppress following symbolic links. I checked it out of the repository, but there is no installer file that I can make out and I think I need one: https://xattr.svn.sourceforge.net/svnroot/xattr

Then I found another version and also checked it out, and was finally able to install it after installing Xcode:

http://svn.red-bean.com/bob/xattr/releases/xattr-0.6.1/

However when I run this version I don't appear to get the magic "-s" option to suppress following symbolic links. In fact this version didn't appear to have any other options that the original xattr had.

Does anyone have a version of xattr running on OSX 10.5 that will support not following symbolic links, or any other app that will allow me to write extended attributes and not follow symbolic links ?

studiohack
  • 13,477
timoto
  • 161

1 Answers1

1

The variation at https://github.com/jwodder/xattr1 has the -P option that suppresses the usual behavior of following symbolic links (i.e. passes the XATTR_NOFOLLOW option to listxattr(2), etc.). The included documentation indicates that this “operate on the symlink, not the target” mode is the default (it used to default to operating on the target, but the code was recently updated to match the documentation).

The options and modes of operation are different from the usual xattr(1), so you will probably have to adapt any scripts that you already have in place.

Since you said you have already installed the Developer Tools (i.e. Xcode), a simple make should build the program. I compiled and lightly tested it on a machine running Mac OS X 10.6.7 (I have also previously used it on a 10.4 machine, so it should work fine on 10.5).


Note about “directories that are symbolic links”: A directory entry can either be a directory or a symbolic link (or a plain file, etc.), but not both. It is not accurate to say either “a directory that is a symbolic link” or “a symbolic link that is a directory”. Properly, it just “a symbolic link that ultimately2 points to a directory”.

1 You can use the Downloads button on the right side of the GitHub page to download a .tar.gz or .zip if you do not have Git installed.

2 “Ultimately” because symbolic links can point to other symbolic links. They can even point to a non-existent pathname (creating a “dangling” symbolic link).

Chris Johnsen
  • 42,029