You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Rick Mann <rm...@latencyzero.com> on 2005/08/01 19:17:39 UTC
Serious incompatibility between Subversion and Metrowerks CodeWarrior
This is on Mac OS X 10.4.2. I suspect I should post to the dev list,
but I thought I'd start here.
We just switched to Subversion source control. I just lost quite a
bit of work due to a serious problem using Subversion (svn) with
CodeWarrior. I'd like to describe what's happening, and get some info
about how Subversion commits files.
Follow these steps (mentally if you don't have CW installed):
1. Open a source file under Subversion control in CW 8.3 or 9.4.
2. Make a minor change to the file. Save, but do not close the window.
3. Commit it to the repo (svn commit).
4. Go back to CW and make another minor change.
5. Save. Note that no error indication occurs.
6. Close the window
7. Re-open the file. Not that your second set of changes is not present.
svn commit seems to delete the old file and create a new one, as
evidenced by the inode reported by ls -i changing.
CodeWarrior seems to keep a file open via it's file descriptor, and
so it doesn't notice that the old file went away. However, I'm not
sure why it doesn't report an error when one attempts to save (and
internally, why id doesn't get that error, find and re-open the file,
and save its current contents to the new file).
Note that performing the same steps above with TextWrangler results
in the file being properly handled, no lost data. It even notices
that the file's been modified and reads it back in. If you've made
changes, it even says "[The file] was changed on disk, but could not
be reloaded because it has unsaved changes.
Now, perhaps CodeWarrior needs to do a better job of keeping track of
files. Obviously, the problem can be dealt with, as demonstrated by
TextWrangler.
I checked out the subversion source and tried to figure out just
where it creates the new files during a commit. Mac OS X (Darwin)
supports exchangedata(), a way of doing safe saves of data and
keeping the same file ID, so that open file handles don't totally
disconnect (and all atomically). I don't think any other Unix does
this, but I suspect there's a workaround that would be good. I think
svn first puts the new pristine copy in the .svn directory, then
modifies the working copy by creating a new one and deleting the old
one. Maybe it could instead open the old wc, truncate it, and write
the new data out.
The next save in CW would immediately overwrite it, but at least it's
buffers wouldn't go into a black hole.
Any suggestions? Thanks!
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Serious incompatibility between Subversion and Metrowerks CodeWarrior
Posted by Dave Camp <da...@thinbits.com>.
On Aug 1, 2005, at 12:17 PM, Rick Mann wrote:
> CodeWarrior seems to keep a file open via it's file descriptor, and
> so it doesn't notice that the old file went away. However, I'm not
> sure why it doesn't report an error when one attempts to save (and
> internally, why id doesn't get that error, find and re-open the
> file, and save its current contents to the new file).
That would be a bug in CodeWarrior. Other Mac text editors get this
right. Xcode gets it right. And it's legal file system behavior.
Subversion is not doing anything wrong.
> Note that performing the same steps above with TextWrangler results
> in the file being properly handled, no lost data. It even notices
> that the file's been modified and reads it back in. If you've made
> changes, it even says "[The file] was changed on disk, but could
> not be reloaded because it has unsaved changes.
Yes. Many other text editors handle this properly.
> Now, perhaps CodeWarrior needs to do a better job of keeping track
> of files. Obviously, the problem can be dealt with, as demonstrated
> by TextWrangler.
>
> I checked out the subversion source and tried to figure out just
> where it creates the new files during a commit. Mac OS X (Darwin)
> supports exchangedata(), a way of doing safe saves of data and
> keeping the same file ID, so that open file handles don't totally
> disconnect (and all atomically). I don't think any other Unix does
> this, but I suspect there's a workaround that would be good. I
> think svn first puts the new pristine copy in the .svn directory,
> then modifies the working copy by creating a new one and deleting
> the old one. Maybe it could instead open the old wc, truncate it,
> and write the new data out.
>
> The next save in CW would immediately overwrite it, but at least
> it's buffers wouldn't go into a black hole.
Subversion isn't a Mac specific product... I wouldn't expect it to
use Mac specific APIs, especially since it's not doing anything wrong.
> Any suggestions? Thanks!
You could write Metrowerks a bug report, but I wouldn't expect much
of it. They publicly announced CW 10 will be the final release of the
product and they will not be supporting Mac OS X on Intel. As Apple
stated at WWDC, you'll need to move to Xcode to continue developing
for the Mac.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Serious incompatibility between Subversion and Metrowerks CodeWarrior
Posted by Steve Williams <st...@kromestudios.com>.
Rick Mann wrote:
> This is on Mac OS X 10.4.2. I suspect I should post to the dev list,
> but I thought I'd start here.
>
> We just switched to Subversion source control. I just lost quite a
> bit of work due to a serious problem using Subversion (svn) with
> CodeWarrior. I'd like to describe what's happening, and get some info
> about how Subversion commits files.
>
> Follow these steps (mentally if you don't have CW installed):
>
> 1. Open a source file under Subversion control in CW 8.3 or 9.4.
> 2. Make a minor change to the file. Save, but do not close the window.
> 3. Commit it to the repo (svn commit).
> 4. Go back to CW and make another minor change.
> 5. Save. Note that no error indication occurs.
> 6. Close the window
> 7. Re-open the file. Not that your second set of changes is not present.
Doesn't happen with at least two versions of CodeWarrior on Windows. I
use CodeWarrior for Playstation2 and CodeWarrior for Gamecube every day.
I just tried your replication recipe above and it works fine in these
versions. These versions notify you when the file changed on disk and
offer to reload it.
> CodeWarrior seems to keep a file open via it's file descriptor, and
> so it doesn't notice that the old file went away. However, I'm not
> sure why it doesn't report an error when one attempts to save (and
> internally, why id doesn't get that error, find and re-open the file,
> and save its current contents to the new file).
CodeWarrior is a horrible, horrible piece of work in my belief. I
detest using it, but I have no choice.
--
Sly
This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.
Re: Serious incompatibility between Subversion and Metrowerks CodeWarrior
Posted by Ben Collins-Sussman <su...@collab.net>.
On Aug 1, 2005, at 3:27 PM, Rick Mann wrote:
>
> On Aug 1, 2005, at 1:17 PM, Ben Collins-Sussman wrote:
>
>
>> I've never heard of an editor which didn't notice that a file's
>> inode (or contents) had changed. That sounds like a serious bug
>> in the editor.
>>
>
> Yes, well, one might argue that it's a shortcoming of an editor,
> but hardly a bug to notice that a file's inode has changed. I mean,
> it's got an open file handle, it shouldn't expect the file to be
> deleted. However, why a subsequent save doesn't at least report an
> error, I don't know. That's definitely a bug, and would be enough
> to prevent me, generally from losing work.
Yeah, that's what I meant. In something like emacs, you get the
error as soon as you try to save: "file changed on disk! are you
sure you want to save??"
>
> Is there any reason why subversion couldn't just write the new
> contents to the old file? (I suppose this is really a question for
> the dev list.)
Yes, writing directly to the file wouldn't be an atomic change.
Moving a new file on top is atomic.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Serious incompatibility between Subversion and Metrowerks CodeWarrior
Posted by Ryan Schmidt <su...@ryandesign.com>.
On 01.08.2005, at 23:37, Dale Worley wrote:
>> Yes, well, one might argue that it's a shortcoming of an editor, but
>> hardly a bug to notice that a file's inode has changed. I mean, it's
>> got an open file handle, it shouldn't expect the file to be deleted.
>
> It's really an oddity for an editor to keep an open handle on a
> file. All
> (other) editors that I know of do open-read-close or open-write-
> close. In
> particular, this allows you to "rename away" the file while it is
> being
> edited, and the editor's save will create a new file (with the
> right name).
That is not what a Macintosh user [1] would expect. A Macintosh user
expects that if a file is open in an editor, and the file is then
renamed or moved in the Finder, that the editor would notice the
move / rename and remain attached to the file under its new identity.
[1] Old-time Macintosh user. Since System 6. Did a quick check, and
TextWrangler on OS X still behaves in this way.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Serious incompatibility between Subversion and Metrowerks CodeWarrior
Posted by Stephen Davis <st...@mac.com>.
On Aug 1, 2005, at 2:59 PM, Rick Mann wrote:
> On Aug 1, 2005, at 2:37 PM, Dale Worley wrote:
>
>> It's really an oddity for an editor to keep an open handle on a
>> file. All
>> (other) editors that I know of do open-read-close or open-write-
>> close. In
>> particular, this allows you to "rename away" the file while it is
>> being
>> edited, and the editor's save will create a new file (with the
>> right name).
As noted in another email, a long-time Mac user would expect his open
file to follow the rename. It's a feature, one that I personally
like a lot. YMMV.
>> Under the assumption that other processes might be mucking with the
>> filesystem at the same time, it's inherently erroneous to keep an
>> open
>> handle and assume that it will continue to refer to the same file
>> name.
>>
>
> I may be wrong when I claim CW keeps the file open. It may,
> instead, keep a Mac OS Alias to the file, which is The Right Thing
> to Do on the Mac. The Alias maintains a link to the file based on
> it's file ID (inode #) and Volume Ref, and allows the file to be
> tracked no matter what happens to its meta data (name, location, etc).
> Note that this works in conjunction with the Mac OS practice of
> conducting "safe saves" by atomically swapping the contents of a
> new file with the old file, thereby preserving the Aliases that
> pointed to the file.
>
> Part of the problem in all this is that I still need to use
> CodeWarrior 8.3, and it's becoming evident that there's no way in
> hell I'll get a fix to "such an old" version.
Rick, not that this will solve your problem directly but you might
want to check out my Subversion plugin for CodeWarrior. Since it
notifies the IDE before running a subversion operation, the IDE will
close any open files and re-open them which should solve your problem.
http://www.soundgeek.org/Software/SubversionPlugin/
I have not yet updated it for Subversion 1.2.1 (I've been swamped at
work) but that release was mostly locking fixes from the client's
perspective so it may not be relevant to you. Lemme know if you
desperately need the fixes in 1.2.1 and I'll see about getting a new
version out.
stephen
P.S. Ignore the part of the release notes that say it might not work
on Panther, it does.
Re: Serious incompatibility between Subversion and Metrowerks CodeWarrior
Posted by Rick Mann <rm...@latencyzero.com>.
On Aug 1, 2005, at 2:37 PM, Dale Worley wrote:
> It's really an oddity for an editor to keep an open handle on a
> file. All
> (other) editors that I know of do open-read-close or open-write-
> close. In
> particular, this allows you to "rename away" the file while it is
> being
> edited, and the editor's save will create a new file (with the
> right name).
>
> Under the assumption that other processes might be mucking with the
> filesystem at the same time, it's inherently erroneous to keep an open
> handle and assume that it will continue to refer to the same file
> name.
I may be wrong when I claim CW keeps the file open. It may, instead,
keep a Mac OS Alias to the file, which is The Right Thing to Do on
the Mac. The Alias maintains a link to the file based on it's file ID
(inode #) and Volume Ref, and allows the file to be tracked no matter
what happens to its meta data (name, location, etc).
Note that this works in conjunction with the Mac OS practice of
conducting "safe saves" by atomically swapping the contents of a new
file with the old file, thereby preserving the Aliases that pointed
to the file.
Part of the problem in all this is that I still need to use
CodeWarrior 8.3, and it's becoming evident that there's no way in
hell I'll get a fix to "such an old" version.
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
RE: Serious incompatibility between Subversion and Metrowerks CodeWarrior
Posted by Dale Worley <dw...@pingtel.com>.
> From: Rick Mann [mailto:rmann@latencyzero.com]
>
> Yes, well, one might argue that it's a shortcoming of an editor, but
> hardly a bug to notice that a file's inode has changed. I mean, it's
> got an open file handle, it shouldn't expect the file to be deleted.
It's really an oddity for an editor to keep an open handle on a file. All
(other) editors that I know of do open-read-close or open-write-close. In
particular, this allows you to "rename away" the file while it is being
edited, and the editor's save will create a new file (with the right name).
Under the assumption that other processes might be mucking with the
filesystem at the same time, it's inherently erroneous to keep an open
handle and assume that it will continue to refer to the same file name.
Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Serious incompatibility between Subversion and Metrowerks CodeWarrior
Posted by Rick Mann <rm...@latencyzero.com>.
On Aug 1, 2005, at 1:17 PM, Ben Collins-Sussman wrote:
> I've never heard of an editor which didn't notice that a file's
> inode (or contents) had changed. That sounds like a serious bug in
> the editor.
Yes, well, one might argue that it's a shortcoming of an editor, but
hardly a bug to notice that a file's inode has changed. I mean, it's
got an open file handle, it shouldn't expect the file to be deleted.
However, why a subsequent save doesn't at least report an error, I
don't know. That's definitely a bug, and would be enough to prevent
me, generally from losing work.
It's also a shortcoming, but not a bug, that it doesn't notice the
file contents have changed. Handling such a change is non-trivial
(what to do with the change? what do do with unsaved changes in the
buffer? etc.). However, this is not really the problem, as it's the
file being deleted that causes trouble.
Is there any reason why subversion couldn't just write the new
contents to the old file? (I suppose this is really a question for
the dev list.)
--
Rick
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Serious incompatibility between Subversion and Metrowerks CodeWarrior
Posted by Ben Collins-Sussman <su...@collab.net>.
On Aug 1, 2005, at 2:17 PM, Rick Mann wrote:
>
> svn commit seems to delete the old file and create a new one, as
> evidenced by the inode reported by ls -i changing.
Correct. The client needs to replace the file because it's
responsible for mangling the file contents: substituting end-of-
lines, or expanding keywords. It does this atomically by first
creating the 'mangled' file in .svn/tmp/, then moving it on top of
the working file.
I've never heard of an editor which didn't notice that a file's inode
(or contents) had changed. That sounds like a serious bug in the
editor.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org