|Home » Industry Watch » The Technological
You think you've been low before?
A lot of people are wondering how Apple's new 'Put Back' feature works. For those not familiar with the feature: it's the same thing Microsoft have had for the past fifteen years in Windows - it lets you restore files in the trash (recycle bin) to their original locations.
Microsoft manage this by making their recycle bins special locations. As a file is deleted it's renamed with a serial number and this serial number along with the original location is put in a type of 'dictionary' at the same location.
The original name of the file (sans path) is displayed in the Explorer view. Simple and elegant.
Apple's implementation of the 'trash' in OS X has functioned along the lines of a mail trash: you can delete things, whereby they go into a special folder. From there you can do what you want. At the most you get one 'undo' - after that you're on your own.
The trash is just another directory like any other on OS X - '~/.Trash'. Its name starts with a dot ('.') so most of the time it'll stay out of the way. You can (manually and at your discretion) move things in and out. It's just another folder like any other.
But now with OS X 10.6 Snow Leopard users are finally supposed to get the same opportunity to organise their dumpings as their inferior brethren on Windows. The new feature is called 'Put Back'.
Developers may search in vain for a new API in NSWorkspace or NSFileManager. It's not there. NSWorkspace takes care of 'recycling' and 'destroying' file system items and calls appropriate APIs in NSFileManager to do so - but here you're not going to find anything. For despite Finder supposedly being Cocoa, Cocoa isn't necessarily Finder.
The suspense is killing you - admit it! How did those geniuses at Apple - walking in the footsteps and standing on the shoulders of the likes of Arno Gourdol - ever manage to pull it off?
Ah but you probably guessed it by now - they used .DS_Store!!1!
There is also an unfortunate bug that is not fixed to this day that results in an excessive creation of .DS_Store files. Those files should only be created if the user actually makes adjustments to the view settings or sets a manual location for icons in a folder. That's unfortunately not what happens and visiting a folder pretty much guarantees a .DS_Store file will get created.
- Arno Gourdol December 2006
.DS_Store can and should be used in the situation where an individual folder is to be displayed in a manner not identical with the global settings; why then will a system become littered with them, even though no folder display deviates from the global norm?
- Rixstep to John Geleynse, Apple 'software evangelist', 27 May 2003
I was not thinking about security related issues at all.
- John Geleynse, Apple 'software evangelist', 27 May 2003
The only way to test this is to - ugh - do the Doctor Frankenstein number on TFF. Once TFF is artificially brought back to life, one creates an empty file in '~/Documents' aptly titled 'Arno Lives!!1!'. Then one trashes this valuable file, scoots over to ~/.Trash (in TFF natch) and 'puts it back'.
One then copies the .DS_Store in ~/.Trash to a secure location, obliterates ~/.Trash, puts TFF back in its coffin, reboots and clears away the dozen or so .DS_Store files this incurable disease known as TFF managed to litter in record time, and then one finally can inspect the damage.
0110 00 41 00 72 00 6e 00 6f 00 20 00 4c 00 69 00 76 |.A.r.n.o. .L.i.v|
0120 00 65 00 73 00 21 00 21 00 31 00 21 70 74 62 4c |.e.s.!.!.1.!ptbL|
0130 75 73 74 72 00 00 00 18 00 55 00 73 00 65 00 72 |ustr.....U.s.e.r|
0140 00 73 00 2f 00 6d 00 61 00 63 00 75 00 73 00 65 |.s./.m.a.c.u.s.e|
0150 00 72 00 2f 00 44 00 6f 00 63 00 75 00 6d 00 65 |.r./.D.o.c.u.m.e|
0160 00 6e 00 74 00 73 00 2f 00 00 00 0e 00 41 00 72 |.n.t.s./.....A.r|
0170 00 6e 00 6f 00 20 00 4c 00 69 00 76 00 65 00 73 |.n.o. .L.i.v.e.s|
0180 00 21 00 21 00 31 00 21 70 74 62 4e 75 73 74 72 |.!.!.1.!ptbNustr|
0190 00 00 00 0e 00 41 00 72 00 6e 00 6f 00 20 00 4c |.....A.r.n.o. .L|
01a0 00 69 00 76 00 65 00 73 00 21 00 21 00 31 00 21 |.i.v.e.s.!.!.1.!|
Note the ever-so-clever 'ptb' (for 'put back' 'technology') and the use of Unicode. Note as well they still can't begin a path with a slash or a tilde after 12+ years using Unix. And talk about a crap-arse implementation. It only works through the monster; there's no API as there should be; it won't work from myriad other locations on the desktop; it needs a Gojira that can create .DS_Store to make things happen. The only thing that made this nightmare worse than even conceivable was the use of - the dependency on - the most hated file in the world.
Industry Watch: .DS_Store
Industry Watch: .DS_Insecure
Learning Curve: .DS_Store Redux
The Technological: Desktop Services Store
Security Focus: Apple Macintosh OS X .DS_Store Directory Listing Disclosure Vulnerability