We use Perforce in our organization for Source Control. I was trying to get the latest revision for some of the files that were updated by other developers. and noticed the following error:
Can’t clobber writable file
I knew for a fact that files under source control were marked as read-only and when a file is checked out, then it removes the read-only attribute. So deciding to check on that I found that all the files under my perforce folder were not read-only. I went ahead and marked every file as read-only, and was able to get the latest revision without any errors. Cool, another problem solved.
Hi Balaji, do you know why not all the files under your perforce were readonly?
I have encountered the same problem, but changing the attribute manually is not acceptable because this needs to be automated (I am trying to sync perforce on a continuous integration server).
I’d like to root cause this issue so I can prevent it from breaking our automated builds. Thanks!
Hi Ben,
I am not sure as to what is the root cause of this. A possible workaround is to stop perforce from making the files read-only on submit. This can be accomplished by changing the Client Specification and setting the “allwrite” flag. This way the files never go to readonly mode and you should be able to write to it always.
I encountered the same problem. Making the files readable fixed it.
I did a “Get latest revision” and for some files I got the can’t clobber message. I had not touched these files at all. It turned out that these files were deleted and added again to perforce before.
The clobber flag was unchecked in my workspace.
That is, these files were deleted first by someone else, then I did a “Get latest revision” and then these files were added back again by someone else and then I did a “Get latest revision” again. Peforce was configured to delete deleted files after the first “Get latest revision”.
i had the same problem. this is because when i wanted to make a chage in a synced file i was asked if i needed to make it writeble in visual studio. i made the file writeble but after that i couldnt find an option to make is readable again. and changing the attribue to read only did not help either.
help needed!!1
i had the same problem. Then I figured that you must change all offending files to be readonly in your workspace.
I know this is a very late reply to an almost dead post, but since its the first hit on google I am adding a reply for those of you googlers out there who may end up here.
If you encounter a can’t clobber message like this, and ur afraid to loose what u did here is a neat trick:
copy ur existing file to another file like file_carbon_copy.cpp
and then remove the file causing the problem.
Do a p4 sync, and the clobber message will go away.
The latest revision will now be in ur directory. do a move (mv) of ur copy back into the same name of that file which u should have open for edit. The mv command does a replace, and then u can nicely submit.
This said, if u have a branch and want to integrate with the root source, ur better off changing its readonly.
Cheers.
look like it is not an automatin trick, why we need to use perforce when you have to copy and use all of that tricks ???
Thanks! To save time on the VPN with perforce I had used an old copy of a project that was 200MB+. Of course, the versions I copied into my local workspace were “NOT” read-only. So when I set the parent folder to “read only” (right click + properties), and applied the read-only permissions to all items in the workspace, I was able to get the latest revision of the project.
Too bad it decided it wanted to download almost every file again