13 ms·
One thing I’ve been thinking about is that it would be nice to tag files with the program that created them. Aside from the clutter in my home directory, I have
by saagarjha 8y ago
One thing I’ve been thinking about is that it would be nice to tag files with the program that created them. Aside from the clutter in my home directory, I have a lot of files that I have to guess as to where they originated from based on metadata like modification timestamps or permissions, but it would be nice to see something like “~/.config was created by some-tool”.
- boreq 8y agoThat is the exact problem that the standard I talk about was designed to solve (apart from the clutter in the home directory).
- wool_gather 8y agoI think saagarjha's point was that an even simpler standard would be for the creating application to use file metadata to annotate the files. And a simpler standard is generally more likely to be followed, especially if it's unilateral. This doesn't help with installation, obviously, but it helps with cleanup.
- masklinn 8y agoThe classic MacOS had exactly this concept: Creator Code[0], similar to the Type Code[1] but storing a file's creator rather than its "mimetype". [0] https://en.wikipedia.org/wiki/Creator_code https://en.wikipedia.org/wiki/Creator_code [1] https://en.wikipedia.org/wiki/Type_code https://en.wikipedia.org/wiki/Type_code
- wool_gather 8y agoGood point, I had almost forgotten about those!
- lowry 8y agoI'd rather have minimal files in $HOME than megabytes or gigabytes in a deep hierarchy under $XDG_CONFIG_HOME In reality, I have both. In practice, I commit go the vesion control only the dotfiles I care about. And I ignore the rest.
- xfitm3 8y agoMacOS stores this for files I download through a browser. "Get Info" has a "Where from" property: http://osxdaily.com/2010/10/12/find-out-where-a-file-was-downloaded-from/ http://osxdaily.com/2010/10/12/find-out-where-a-file-was-dow...
- heywire 8y agoWindows does something similar with Alternate Data Streams [0] [0] https://textslashplain.com/2016/04/04/downloads-and-the-mark-of-the-web/ https://textslashplain.com/2016/04/04/downloads-and-the-mark...
- chatterbeak 8y agoAnd Windows did it first.
- nine_k 8y agoA general tagging mechanism, reasonably supported across filesystems, would be great to have. Not only for media collections. It's not easy to implement nicely, though.
- netsec_burn 8y agoWhy wouldn't it to be easy to implement? You could probably make a global LD_PRELOAD library that hooks into all open() CREAT calls and tags the inode's xattr with the program that created the file. You could use an attribute like, user.created_by.
- nine_k 8y agoAdding an interface to access the tag store won't be very hard. It would be harder to make it so that all the tag-oblivious programs, like mv or vi, to say nothing of rsync, would preserve the attributes when moving or modifying a file.
- netsec_burn 8y agoSounds like you might need to hook rename() if you'd like to add that feature too, but I would still say it's straightforward.
- nine_k 8y agoThe way most editors save a file is like this: f = open("the_file.new") write(f, new_contents); close(f); rename("the_file", "the_file~"); rename("the_file.new", "the_file"); So the old file is never modified, it's renamed to the backup copy, and an entirely new file is created to take its place. This has a number of advantages, but does not play well with any extended info the old file used to have, unless they are copied explicitly. And in a tagging-oblivious program, they won't be.
- netsec_burn 8y agoThanks for teaching me this! I wasn't aware. So, the original xattr (and the program that created it) would be deleted and replaced by vi for example. Still technically right, but I'm unsure how you'd keep a history.
- kazinator 8y agoApple's Macintosh did this in 1984. Files were tagged with 32 bit codes: one for the "creator" (the associated app) and one for the type. These were often made up out of readable characters: a so called "fourcc" (four character code). The "fourcc" persists in cross-platform media formats.
- mistercow 8y agoThe first software I ever sold online was an app that would change the creator code of a file to whatever application you wanted. For some reason, there was no obvious built-in way to do that in Mac OS 8 (besides opening the document in the other application and saving it, or changing it in ResEdit). I only ever sold one license, but I was 12, so I was pretty excited.
- OJFord 8y agoIf that can be done, doesn't it defeat the purpose here? Anything can create a file, and then change this tag to 'system' or whatever.
- Barrin92 8y agonot sure if this is the exact solution to your problem, but rcm (https://github.com/thoughtbot/rcm https://github.com/thoughtbot/rcm) allows you to create dedicated dotfiles in a .dotfiles directory which are being symlinked back to files, and it has a -t option to create and restore dotfiles with tags. mkrc -t emacs .emacs.d would create a .dotfiles/tag-emacs/ folder and rcup -t emacs restores it.
- bepvte 8y agoThis could be done with the audit subsystem of linux
- quotemstr 8y agoIf we start sandboxing applications and give each one its own UID, like Android does, we get this feature for free. It's kind of silly to associate exactly one security context with exactly one user.
- nabla9 8y agoNot a exact solution you are looking for, but a hack solutons: dpkg -S .foo apt-file search .foo rpm -qf /foo/bar
- AdmiralAsshat 8y ago>One thing I’ve been thinking about is that it would be nice to tag files with the program that created them. Isn't what you describe basically the file extension? Not so much what program created the file, so much as what program is meant to handle/open the file.
- saagarjha 8y agoFile extensions are trivial to fake, don’t really have a strong association with the application that is supposed to handle them, and in this case often doesn’t even apply because most of the files in my home directory seem to lack an extension.
- SllX 8y agoFile extensions are more nomenclature than file type indicator. More than one file type might share the same extension, more than one application might be used to open the file according to its extension. They mostly work, but file extensions != file types != file creators.