Bugs & Fixes: Solving Safari cookie problems
#2
Posted 16 October 2009 - 06:04 AM
I fail to understand the author's attachment to cookies. I view them as nothing more than a convenience to the website designers and the advertisers who wish to track usage. They don't provide any benefit to me, and I routinely purge all cookies. Several times a day, sometimes after specific website visits. The Reset Safari function is good for this. I only wish there was a more convenient way to purge flash cookies--which I view as an insidious form of spyware.
#3
Posted 16 October 2009 - 06:48 AM
Then I discovered SafariCookies. I can set "favorite" domains, and delete all non-favorites with a single click. SC also optionally removes Flash cookies and Google analytics cookies when quitting Safari. (Works in Leopard and Snow Leopard; versions available for pre-Leopard operating systems.)
http://sweetpproduct.../safaricookies/
#4
Posted 16 October 2009 - 08:23 AM
#5
Posted 16 October 2009 - 10:39 AM
Time for a fundamental Unix lesson here: Deleting ("unlinking" in Unix terminology) a file only removes its entry from the directory so that no one else can find it to open. The file ("inode" in Unix terminology) is not released until closed by the last application that has it open.
A common Unix-y thing to do is create a temporary scratch file and immediately unlink(2) delete it. This way on exit or application crash one doesn't have to remember to clean up. The OS will do it for you. But meanwhile the temporary file is still perfectly usable until close(2).
Notice how a Mac will not complain about deleting a file that an application has open the way Windows will complain. Then again its impossible to tell from most applications if it has a file open or whether its a document cached in memory. Whether "Save" re-opens the file then closes or writes to an already opened file.
#6
Posted 16 October 2009 - 12:21 PM
It sounds like to improve performance, Safari isn't reading the cookie file every time a cookie is requested. Instead it must read the entire cookie file into memory at the beginning of the session. To ensure the cookies are saved in the event of a crash, it probably periodically writes the memory copy back to disk.
#7
Posted 16 October 2009 - 02:19 PM
Any plist file is merely an XML file consisting of a dictionary of name value pairs, most typically used for storing persistent settings for an application but now that you mention it, is an ideal format for storing web browser cookies as well. I know, even from being a very casual Cocoa hobbyist, that a plist can be read or saved by the NSDictionary class, which is a common enough Cocoa utility class.
So it follows from the behavior described in the article that Safari must instantiate a new NSDictionary object to hold cookies and initialize it with the contents of the cookies.plist file from the current user's Library. Then, as mschmitt already observed above, Safari would (naturally enough) periodically save the cookies back to file (probably each time a browser cookie changes value). Hence, when you deleted the file, it achieved nothing because the next time a cookie changed, the file you tried to create got overwritten.
The surprising part is the fact that you had used Safari itself to delete the cookie and didn't get a fix. That suggests that the in-memory cookie is not flushed (for some reason) when you delete the cookie in Safari and soon overwrites the files with the faulty cookie again.
The only explanation I can think of for behavior like this is if the preferences panel, rather than accessing the main in-memory dictionary of cookies instead loads its own temporary copy, let's you do your thing to it, then saves it again. If this is the case, the main browser would need to receive a notification of this event in order to know to reload its own cookies from file. If it doesn't (and it looks like it's not in this case), then the original in-memory version you didn't want is still lurking about waiting to clobber your freshly fixed file next time Safari feels its time to save cookies.
It definitely sounds like a minimal little bug in the way cookies work. Thanks for sharing the workaround you discovered!
#8 Guest_MarkElliot_*
Posted 16 October 2009 - 09:20 PM
I too don't understand the attachment to cookies. I'm horrified at the thought of MBs of this tracking tool!
#9
Posted 17 October 2009 - 05:23 PM
MarkElliot, on 16 October 2009 - 09:20 PM, said:
I too don't understand the attachment to cookies. I'm horrified at the thought of MBs of this tracking tool!
I like your solution - I keep cookies off, and erased, and only turn them on when needed. Your way solves the cookie problem with iTunes 9 - iTunes 9 won't let you buy anything from the iTunes Store if you have Safari cookies disabled (and don't have an old apple cookie residing there).The funny thing is, even if Safari is closed, as long as cookies are enabled it will allow iTunes to set cookies there. I don't know why Apple requires this in iTunes 9, and I don't like it.
TeaEarlGrey: As far as Flash cookies, there's a way to set preferences in Flash to not allow cookies. You do it through a website, where you can set the security preferences for your Flash plugin.
http://www.adobe.com...layer/security/
#12
Posted 20 October 2009 - 07:17 AM
TeaEarleGreyHot, on 16 October 2009 - 06:04 AM, said:
I fail to understand the author's attachment to cookies. I view them as nothing more than a convenience to the website designers and the advertisers who wish to track usage. They don't provide any benefit to me, and I routinely purge all cookies. Several times a day, sometimes after specific website visits. The Reset Safari function is good for this. I only wish there was a more convenient way to purge flash cookies--which I view as an insidious form of spyware.
There's a very easy way to get rid of flash cookies - Flush.app - check it out on http://machacks.tv
#13
Posted 06 November 2009 - 10:16 PM
2009-11-06 22:11:09.963 Safari[21257] Could not open cookie file "/Users/User/Library/Cookies/Cookies.plist" for reading.
2009-11-06 22:11:23.575 Safari[21257] Could not open cookie file "/Users/User/Library/Cookies/Cookies.plist" for reading.
2009-11-06 22:11:56.427 Safari[21257] Could not open cookie file "/Users/User/Library/Cookies/Cookies.plist" for reading.
etc.
I've tried making it read-only but I don't think that this has solved the issue. In addition, I notice that (unexpectedly) another app accesses the Safari cookie file:
2009-11-06 21:48:34.595 GimmeSomeTune[221] Could not open cookie file "/Users/user/Library/Cookies/Cookies.plist" for reading.
2009-11-06 21:59:38.419 GimmeSomeTune[221] Could not open cookie file "/Users/user/Library/Cookies/Cookies.plist" for reading.
I'm not sure what to make of it, but if suggestions abound, drop a few right here. This Safari cookie issue, already well-documented, is a real frustration and will drive me to Firefox eventually.
#14
Posted 07 November 2009 - 10:00 PM
"Hey Net Surfers,
For over a year now, EVERY time I log onto the internet
and click on "Safari," which is default set to Google, ALWAYS
the first thing that comes up in the box is the link below,
61.166.151.90/welcome etc. So I close the window, click
Safari again, and Google comes up.
I checked and there is no way to open the 'welcome site,'
nor track it down. So I looked on Chinese language google,
and there are dozens of blog complaints about this from
Chinese browsers, such as the one below, and no one has
any idea what it is.
Any of your cyberheads got any ideas on this?
Recently found that the use of surf the Internet, whenever the first double-click surf browser, the Internet, originally set the home page not open, but shifted to the http://61.166.151.90...come/index.html web page, the second set to open its own home page, I do not know why, reinstall systems can not be solved.
Please expert research to help resolve."



Sign In
Register
Help

MultiQuote
