From: Alex Riesen <hidden> Date: 2016-06-15 22:46:55
Windows, being a case-confused operating system, sometimes has
problems renaming directory entries with only change in the case
of their characters. Try to work the problem around by using an
intermediate file.
---
NOT TESTED. Can't. My Windows broke again. Not even compile-tested.
And sorry for somewhat extended Cc:. Thought the problem need a little
more experienced attention (then again, maybe it doesn't).
That's a response to Bug 228 (which is properly "WONTFIX",
if you ask my opinion):
http://code.google.com/p/msysgit/issues/detail?id=228
I don't like it, but it is the same what people usually forced to do
anyway, so here it is.
It has a racing problem which can cause the original file be renamed
into a temporary name (as returned by mkstemp):
- the rename of the source name to temp name succeeds
- the rename of temp name to destination name fails (i.e. it
exists and is open)
It is not fixable (because the atomicity of rename(2) is broken by the
intermediate name and two separate calls to rename involved).
I could have tried to rename back to source, but got fed up with
another Windows stupidity and gave up.
compat/mingw.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 55 insertions(+), 10 deletions(-)
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:46:55
Hi,
On Mon, 8 Jun 2009, Alex Riesen wrote:
Windows, being a case-confused operating system, sometimes has
problems renaming directory entries with only change in the case
of their characters. Try to work the problem around by using an
intermediate file.
---
NOT TESTED. Can't. My Windows broke again. Not even compile-tested.
Yes, that is pretty easy to see as you first used pold/pnew and then
src/dst.
I minimally fixed up your patch (it now uses strbuf), and added a
test-case.
This test-case is actually crucial: it shows that your patch is not
enough: the culprit is this code in builtin-mv.c:167--168:
else if (lstat(dst, &st) == 0) {
bad = "destination exists";
Ciao,
Dscho
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:46:55
Hi,
On Mon, 8 Jun 2009, Johannes Schindelin wrote:
On Mon, 8 Jun 2009, Alex Riesen wrote:
quoted
Windows, being a case-confused operating system, sometimes has
problems renaming directory entries with only change in the case
of their characters. Try to work the problem around by using an
intermediate file.
---
NOT TESTED. Can't. My Windows broke again. Not even compile-tested.
Yes, that is pretty easy to see as you first used pold/pnew and then
src/dst.
I minimally fixed up your patch (it now uses strbuf), and added a
test-case.
From: Alex Riesen <hidden> Date: 2016-06-15 22:46:55
2009/6/8 Johannes Schindelin [off-list ref]:
On Mon, 8 Jun 2009, Alex Riesen wrote:
quoted
NOT TESTED. Can't. My Windows broke again. Not even compile-tested.
Yes, that is pretty easy to see as you first used pold/pnew and then
src/dst.
Yep.
I minimally fixed up your patch (it now uses strbuf), and added a
test-case.
This test-case is actually crucial: it shows that your patch is not
enough: the culprit is this code in builtin-mv.c:167--168:
else if (lstat(dst, &st) == 0) {
bad = "destination exists";
From: Johannes Sixt <hidden> Date: 2016-06-15 22:46:55
Alex Riesen schrieb:
2009/6/8 Johannes Schindelin [off-list ref]:
quoted
On Mon, 8 Jun 2009, Alex Riesen wrote:
quoted
NOT TESTED. Can't. My Windows broke again. Not even compile-tested.
Yes, that is pretty easy to see as you first used pold/pnew and then
src/dst.
Yep.
quoted
I minimally fixed up your patch (it now uses strbuf), and added a
test-case.
This test-case is actually crucial: it shows that your patch is not
enough: the culprit is this code in builtin-mv.c:167--168:
else if (lstat(dst, &st) == 0) {
bad = "destination exists";
Ah, thanks. Missed that completely.
That's the reason why I think any work-around for this problem is not
worth it.
If you want to be cross-platfrom, make up your mind about file names in
advance.
-- Hannes
From: Alex Riesen <hidden> Date: 2016-06-15 22:46:55
2009/6/9 Johannes Sixt [off-list ref]:
Alex Riesen schrieb:
quoted
2009/6/8 Johannes Schindelin [off-list ref]:
quoted
On Mon, 8 Jun 2009, Alex Riesen wrote:
quoted
NOT TESTED. Can't. My Windows broke again. Not even compile-tested.
Yes, that is pretty easy to see as you first used pold/pnew and then
src/dst.
Yep.
quoted
I minimally fixed up your patch (it now uses strbuf), and added a
test-case.
This test-case is actually crucial: it shows that your patch is not
enough: the culprit is this code in builtin-mv.c:167--168:
else if (lstat(dst, &st) == 0) {
bad = "destination exists";
Ah, thanks. Missed that completely.
That's the reason why I think any work-around for this problem is not
worth it.
What is the lstat is for, anyway?
If you want to be cross-platfrom, make up your mind about file names in
advance.
I suspect it is the other way around. Some platforms just hate the idea
of being ported to. Or its designers have poor imagination and never
though about the fact that other platforms exist.
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:46:55
Hi,
On Tue, 9 Jun 2009, Alex Riesen wrote:
2009/6/9 Johannes Sixt [off-list ref]:
quoted
Alex Riesen schrieb:
quoted
2009/6/8 Johannes Schindelin [off-list ref]:
quoted
On Mon, 8 Jun 2009, Alex Riesen wrote:
quoted
NOT TESTED. Can't. My Windows broke again. Not even compile-tested.
Yes, that is pretty easy to see as you first used pold/pnew and then
src/dst.
Yep.
quoted
I minimally fixed up your patch (it now uses strbuf), and added a
test-case.
This test-case is actually crucial: it shows that your patch is not
enough: the culprit is this code in builtin-mv.c:167--168:
else if (lstat(dst, &st) == 0) {
bad = "destination exists";
Ah, thanks. Missed that completely.
That's the reason why I think any work-around for this problem is not
worth it.
What is the lstat is for, anyway?
It is to avoid overwriting existing files.
quoted
If you want to be cross-platfrom, make up your mind about file names
in advance.
I suspect it is the other way around. Some platforms just hate the idea
of being ported to. Or its designers have poor imagination and never
though about the fact that other platforms exist.
Actually, think about it as a brilliant business plan: make developers be
stuck with developing for your platform, then they lack the time to take
care of other platforms.
The bigger question with the patch is if the lstat() call can tell us
if this is the same file (really the same, not just a hardlink (= same
contents)).
Ciao,
Dscho