What’s your meaning, at?

A while ago I noticed that my home directory on my Macbook Pro wasn’t visible in the Finder. That is, if I opened a Finder window and browsed to /Users, there was no simon subdirectory, which was a bit odd. I could still browse to the stuff inside my home directory (Documents, Music, etc) using the shortcuts in the Finder’s left-hand panel, but my home directory itself was invisible.

Turning to the terminal, the first thing I discovered was an at symbol after the permissions string for my home directory:

$ ls -l /Users/
total 0
drwxrwxrwt   4 root   wheel   136  2 Nov 23:34 Shared
drwxr-xr-x@ 40 simon  staff  1360 23 Dec 12:05 simon

Hmm… that’s a bit weird. I couldn’t find any mention of a trailing @ in the ls manpage, and Google couldn’t help either. So my next step was to find out the hard way, by browsing Darwin’s source code. And here’s what I found, in print.c from the source for the ls command.

#ifdef __APPLE__

    // irrelevant stuff left out

    xattr = listxattr(filename, NULL, 0, XATTR_NOFOLLOW);
    if (xattr < 0)
        xattr = 0;
        str[1] = '\0';
    if (xattr > 0)
        str[0] = '@';
    else if (acl != NULL)
        str[0] = '+';
    else
        str[0] = ' ';
#endif /* __APPLE__ */

Note firstly that this stuff is in an #ifdef __APPLE__ block, which might explain why there’s no mention of it in the manpage, which appears to be the standard FreeBSD version. Anyway, according to this code, we’re appending an @ if the file has xattrs, or extended attributes.

Darwin has an xattr command that lists extended attributes for a given file, but it’s a bit cryptic:

$ xattr -l /Users/simon/
com.apple.FinderInfo:
0000   00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00    ........@.......
0010   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

Extended attributes are stored as key/value pairs, and in this instance the key is com.apple.FinderInfo, the value is the 32-byte blob that follows it. Presumably, byte 8 having a value of 0×40 means something to someone, but it doesn’t mean anything to me.

A regular Finder Info window doesn’t tell you much either, but fortunately Path Finder came up with the goods. Although my home directory doesn’t show up in Path Finder either, if I browse to, for example, my Music directory, again using the shortcuts in the left panel, I can then control-click on “simon” in the breadcrumb browse strip along the top of the main Path Finder window and choose Get Info, and Path Finder’s Info panel does show extended attributes. Attributes like this:

Path Finder Info panel

Invisible! Result!

No idea how that extended attribute ever got set, but that’s a different problem.

Update: MacFixIt has a good article on the invisible attribute, including how to set it at the command line.

1 comment so far ↓

#1 hugOh on 01.30.08 at 3:08 pm

I had 1 hour googling for that explanation hehehe… thanks man