Live data from Hacker News

Parsing the .DS_Store File Format (2018)

0day.work

81–90 of 91 posts

Re: Parsing the .DS_Store File Format (2018)

#81
post #65

This article makes me wonder: what tools do you use when reversing a custom file format? Personally, having done so recently to reverse a custom game archive format, I have only used the usual hexdump, strings, grep, sed, etc. I'm wondering if there are more powerful tools to do this kind of job?

You usually want something for which you can define a structure and parse the file with it. There are a bunch of commercial and free tools, I've used the following with success in the past:

- 010 Editor (commercial)

- Kaitai Struct (free & open source)

Also has the advantage of directly generating parsers from the defined structures.

Re: Parsing the .DS_Store File Format (2018)

#83
post #77
post #74

Is there a reliable way to make the os NOT create these `.DS_Store` files? I really don't like them and the fact that they pollute every folder. I'm on Big Sur (11.7.1) and I didn't find a way to make finder NOT create them. It's (one of the many) irritating idiosyncrasies of this OS

I don't think there's any way to do that, the files are needed by Finder to store per-folder layouts and settings. You can however create a cronjob that deletes the files as often as you want, the operation takes 11 seconds on my 1TB SSD with a fairly large home folder: fd -u --type file --fixed-strings .DS_Store $HOME -x echo rm {} obviously, remove the echo to actually delete the files

> I don't think there's any way to do that, the files are needed by Finder to store per-folder layouts and settings.

I've always hated this excuse from software developers (I know it's not your excuse, alin23).

User: How do I stop my computer from doing Unwanted Thing X?

Dev: You can't. Unwanted Thing X is needed so we can do Unwanted Thing Y.

Fucking A! Stop doing unwanted things on my computer! My computer should only be creating files I command it to create. It shouldn't be doing things I don't want it to do simply because it conveniences a developer living 1000 miles away in Silicon Valley. My filesystem is there to store my files not some developer's metadata. It should not contain this trash from my operating system. At least give me a DONT_CREATE_THIS_DS_STORE_CRAP environment variable or System Preference to set!

I'll be generous and grant one root directory tree to the OS for its litter. Linux can have /var, macOS can have /System and maybe /Library too. Windows can have C:/WINDOWS. Everywhere else in my OS, hands off, please!

Re: Parsing the .DS_Store File Format (2018)

#84
post #77
post #74

Is there a reliable way to make the os NOT create these `.DS_Store` files? I really don't like them and the fact that they pollute every folder. I'm on Big Sur (11.7.1) and I didn't find a way to make finder NOT create them. It's (one of the many) irritating idiosyncrasies of this OS

I don't think there's any way to do that, the files are needed by Finder to store per-folder layouts and settings. You can however create a cronjob that deletes the files as often as you want, the operation takes 11 seconds on my 1TB SSD with a fairly large home folder: fd -u --type file --fixed-strings .DS_Store $HOME -x echo rm {} obviously, remove the echo to actually delete the files

I don't want finder to store per-folder layouts and settings. I don't even care about the .DS_Store files very much. I just don't want the functionality that they exist to enable.

Re: Parsing the .DS_Store File Format (2018)

#85
post #78
post #2

>>Apple's operating system creates this file in apparently all directories to store meta information about its contents. In fact, it contains the names of all files (and also directories) in that folder. Anyone have an idea why modern versions of MacOS still uses a .DS_Store file? The OS could just as easily read and display the contents of a directory. And deleting a .DS_Store file doesn't seem to have any noticeabl…

The file is used for storing layouts (show as icons/list/grid etc.) and various settings (sorting, grouping etc.). Storing a local file inside the directory allows for moving that directory around while also keeping those settings. The file is invisible for users of Finder so it is still the best solution for this task. I have a .DS_Store line in a global .gitignore and don't notice it much but when I'm annoyed by DS…

i'm surprised that Apple doesn't do directory-level metadata directly in the filesystem itself, e.g. with xattrs on the directory inode.

Re: Parsing the .DS_Store File Format (2018)

#86
post #85
post #78

Earlier quoted context omitted.

The file is used for storing layouts (show as icons/list/grid etc.) and various settings (sorting, grouping etc.). Storing a local file inside the directory allows for moving that directory around while also keeping those settings. The file is invisible for users of Finder so it is still the best solution for this task. I have a .DS_Store line in a global .gitignore and don't notice it much but when I'm annoyed by DS…

i'm surprised that Apple doesn't do directory-level metadata directly in the filesystem itself, e.g. with xattrs on the directory inode.

It does store that metadata in the directing in Mac OS native file systems. The DS files are only for non-Mac file systems like FAT32.

Re: Parsing the .DS_Store File Format (2018)

#88

Curious what creative use cases people have around this bizarre file format. The only reason myself and millions of other people have to deal with this stupid file is adding it to .gitignore as part of the ritual of spinning up a new codebase

I instinctively delete these .DS_Store files whenever I see them but your "creative uses" comment makes me think given common .gitignore practice this might be a great place for AWS keys or whatever you never want checked into VCS /s

Re: Parsing the .DS_Store File Format (2018)

#89
post #86
post #85

Earlier quoted context omitted.

i'm surprised that Apple doesn't do directory-level metadata directly in the filesystem itself, e.g. with xattrs on the directory inode.

It does store that metadata in the directing in Mac OS native file systems. The DS files are only for non-Mac file systems like FAT32.

“Directory” not “Directing”

Re: Parsing the .DS_Store File Format (2018)

#90
post #86
post #85

Earlier quoted context omitted.

i'm surprised that Apple doesn't do directory-level metadata directly in the filesystem itself, e.g. with xattrs on the directory inode.

It does store that metadata in the directing in Mac OS native file systems. The DS files are only for non-Mac file systems like FAT32.

This is not true. My APFS volumes are absolutely littered with .DS_Stores. They're generated every time you open a directory in the Finder.
Post reply on HN