Questions tagged [xattr]

Use the xattr tag for questions about extended attributes on files in a (Linux or macOS) file system.

Extended attributes are descriptions of the file stored separately from the file data. They are read by special system calls. People often first encounter them as a result of seeing an @ after the permissions in the output from ls -l. (The related symbol, a +, indicates that there are ACLs — access control lists — associated with the file.)

On macOS (or Mac OS X), you find out about the extended attributes with the @ option to ls. For example, a file might have the extra attribute:

$ ls -l@d Cscope
drwxr-xr-x@ 3 someuser  staff  102 Mar  8 21:49 Cscope
    com.apple.quarantine     30 
$

indicating that the directory had been copied from the internet and had not yet been marked as clean/safe. The Time Machine software makes extensive use of extended attributes too.

For macOS, the system calls are listxattr(), flistxattr() getxattr(), fgetxattr(), removexattr(), setxattr(). Linux adds lgetxattr() to this set.

96 questions
2
votes
1 answer

locate extended attributes

Is there a simple way to write a kind of wrapper script or patch for updatedb (or locate) such that locate can find user defined extended attributes (tags) (suppose in an ext3 filesystem, mounted with user_xattr option), too?
student
  • 1,636
  • 3
  • 29
  • 53
2
votes
0 answers

'xattr' command not working inside sandbox app

We were working on an IDE for a long time and it has com.apple.security.app-sandbox mode. User can download requisite SDK from internet (out of the box) and use in our IDE for development. Prior to use those SDK file we many time noticed files have…
Santanu Karar
  • 1,034
  • 1
  • 12
  • 27
2
votes
2 answers

xattr/extended attributes not settable for file in /tmp while in $home on same mount works fine

I am playing with extended file attributes under Linux/Fedora and I am currently stumbling a bit since I cannot add/change attributes for files in /tmp while in my home it is working fine - while both paths are on the same mount point, i.e.,…
THX
  • 553
  • 2
  • 8
  • 18
2
votes
0 answers

How can I manipulate extended attributes with PHP?

So I have a huge list of text files inside a folder that I must process using a PHP script, and if processing is successful, I need to discard the file. However I only want to attempt 3 times each file, at most. If after the 3rd attempt it fails,…
user3617863
  • 91
  • 1
  • 5
2
votes
2 answers

Old Mac extended attributes in Snow Leopard

Last year I had to convert and old Mac font from around OS 9 for someone to use on a PC. I discovered that back then the font data was stored in the extended attribute com.apple.ResourceFork. The actual file size will show up as 0 in terminal. I was…
dmertl
  • 805
  • 8
  • 13
1
vote
0 answers

Using pseudo to retain xattrs when extracting tar

I'm trying the following: use pseudo to pack an archive (bz2) which has files with security xattr set. use pseudo again to unpack the archive and keep the security xattr of the files. Unfortunately, the extraction fails with the following message…
emmerich
  • 512
  • 1
  • 5
  • 14
1
vote
1 answer

output hex data from xattr to create icns file

I'm trying to extract the icon from an xattr of a file. Using xattr to get the "com.apple.ResourceFork" in hex format i use: xattr -px com.apple.ResourceFork file and save the output to a variable var="$(xattr -px com.apple.ResourceFork…
asamahy
  • 15
  • 4
1
vote
0 answers

Object to object ACL with xattr in Security Namespace

I want to create an access rule in Linux so that only files with a certain eXtended attribute can be moved, copied or created in a certain directory regardless of my priviledges in that directory. The xattr should be created in system or security…
1
vote
0 answers

Sharing a dmg file without recipient having to do xattr -d

I've made a dmg out of my java project and when I try sharing it, the recipient gets "This application is damaged, move it to the bin". To get around this, xattr -d com.apple.quarantine on the command line can be used on the dmg and the following…
1
vote
0 answers

Opening a text file with no xattr gives "Operation not permitted" under macOS Catalina and Python 2

I've been having trouble getting Python (embarassingly, Python 2 in this case) to open some files on my machine, running macOS Catalina 10.15.6. I've boiled down the issue down to the following. I have two apparently identical text files except with…
kuzzooroo
  • 6,788
  • 11
  • 46
  • 84
1
vote
1 answer

How to use an executable I wrote while browsing files in directories

I wrote an executable that checks the presence of combinations of xattr tags. I want to use that executable on all the files of a directory, that means I want to execute it on every files I find in that directory and every files of the directories…
VDS-Atomic
  • 115
  • 1
  • 11
1
vote
2 answers

Checking if macOS App Has Ever Been Un-Quarantined and Fully Launched

I'm trying to check whether an app downloaded from the internet has ever been fully launched. I'm trying to use xattr -p com.apple.quarantine for this, but the return value from this command, doesn't appear to be consistent. On one Mac, I get these…
1
vote
0 answers

How do I modify advanced MP3 metadata on Mac?

I want to strip/change some extended attributes from some mp3 files that I have, but cannot seem to find any way how. I used mdls to list out the full metadata of a file, and get a number of items beyond the average metadata, such as kMDItemComment…
jmglynn
  • 31
  • 1
  • 4
1
vote
0 answers

How to set and get extended attributes using ?

I am investigating different methods of maintaining state between sessions [of my application running]. One [non-portable] method that was suggested to me [from the #ubuntu IRC chat] was to take advantage of man xattr: Extended attributes are…
Anon
  • 2,267
  • 3
  • 34
  • 51
1
vote
0 answers

Repair broken xattr on macOS?

I don't know what happened, but it seems my xattr is broken. % which xattr /usr/bin/xattr % xattr -h Traceback (most recent call last): File "/usr/bin/xattr-2.7", line 7, in from pkg_resources import load_entry_point ImportError: No…
Nomis101
  • 31
  • 1
  • 4