Wednesday, January 9, 2013

@ in file attributes - What does it mean?

While working today I noticed @ sign in the file permission attributes while listing files under folder by 'ls -la'

e.g. 

J-MacBook-Pro:hooks temp$ ls -la .git/hooks/
total 80
drwxr-xr-x  11 J  staff   374 Jan  9 13:10 .
drwxr-xr-x  16 J  staff   544 Jan  8 18:33 ..
-rwxr-xr-x   1 J  staff   452 May 19  2012 applypatch-msg.sample
-rwxr-xr-x   1 J  staff   896 May 19  2012 commit-msg.sample
-rwxr-xr-x@  1 J  staff   160 Aug  8 23:06 post-commit.sample
......

Have you ever seen it? What does it mean?

@ signifies that the file has some extended attributes apart from what you are seeing while listing. e.g. it came from some remote package, or part of any build, downloaded from net, added by text editor which can result into corrupt file.

In order to check what those extended attributes are -


J-MacBook-Pro:hooks temp$ ls -la@ ../.git/hooks/
total 88
drwxr-xr-x  12 J  staff   408 Jan  9 13:11 .
drwxr-xr-x  16 J  staff   544 Jan  8 18:33 ..
-rwxr-xr-x   1 J  staff   452 May 19  2012 applypatch-msg.sample
-rwxr-xr-x   1 J  staff   896 May 19  2012 commit-msg.sample
-rwxr-xr-x@  1 J  staff   160 Aug  8 23:06 post-commit.sample
com.macromates.caret  32 

.......

Here its added by TextMate, and it result into corrupt file. Further doing more search on it - 


$ xattr -l post-commit.sample 
com.macromates.caret: {
    column = 19;
    line = 144;
}

In order to remove it, run below command -

$xattr -d com.macromates.caret post-commit.sample


All set!