This is related to the previous post, where I had a lot of checked out Subversion working copies in my disk. They came from a Windows machine I used before I bought myself a Mac.
For your information, in a Subversion working copy, there will always be a hidden folder named .svn in each directory, and a bunch of files in them. Many files in there are read-only on Windows, and on UNIX or Mac systems they have read permissions set (-r–r–r–). They are supposed to be that way and only a Subversion client can work on them.
When attempting to update my working directory, my Subversion client refused to update the files because it can’t write to .svn/entries
Tested on: Snow Leopard 10.6.6
Known to work as early as: Tiger 10.4.x
The issue is not related to permissions or even Subversion. For some kind of unknown reasons, when read-only files are transferred from Windows, there is a special flag set on Mac OS X – the user immutable flag. When this happens, you will be receiving these:
$ chmod u+w entries chmod: Unable to change file mode on entries: Operation not permitted
$ sudo chmod u+w entries Password: chmod: Unable to change file mode on entries: Operation not permitted
However, root can delete the files. But I don’t want the files to be deleted. I merely wanted to update (and later add new and modified files to the repository) my working copy.
The simple solution to this is to use the chflags command to unset the user immutable flag:
$ chflags -R nouchg *
As simple as that, and you will be able to operate on the files again. In my case, my “svn update” operation went as smooth as silk.
Remember, the permissions of the file does not even matter. Even if it’s world-writable -rwxrwxrwx
For the record, I transferred the file via a USB drive (NTFS file system), and I have received reports that this is the same case if you transfer from a file share (Samba or Windows File Sharing).
I hope this saved you some time.