Issue1149

Title symlinks support on non-symlink fs broken
Priority urgent Status resolved
Superseder Nosy List abuehl, djc, dov, mpm, pmezard
Assigned To Topics patch, symlinks

Created on 2008-05-30.11:58:25 by dov, last changed 2008-08-11.06:28:53 by djc.

Files
File name Uploaded Type Edit Remove
fix_symlinks.patch dov, 2008-05-30.13:21:11 application/octet-stream
symlinks_supporting_os_nonsupporting_fs.patch.txt dov, 2008-06-08.16:08:58 text/plain
symlinks_supporting_os_nonsupporting_fs.v2.patch.txt dov, 2008-06-15.17:50:12 text/plain
Messages
msg6743 (view) Author: djc Date: 2008-08-11.06:28:53
Patch pushed to stable as 24fd94ed1cc0, resolving. dov, thanks for being
persistent on this.
msg6436 (view) Author: dov Date: 2008-06-28.21:34:22
ping

(patch still applies cleanly against latest crew 44c5157474e7)
msg6284 (view) Author: dov Date: 2008-06-15.17:50:12
new version of the patch, with caching. 

opener already caches this information; and on the other hand, util has no
state; so opener has to pass the cached information to util.set_flags as a new
argument.

I added the new argument to all calls of set_flags, but they should probably be
checked by someone who understands the context better...
msg6248 (view) Author: mpm Date: 2008-06-11.17:02:15
On Sun, 2008-06-08 at 16:09 +0000, Dov Feldstern wrote:
> Dov Feldstern <dfeldstern@fastimap.com> added the comment:
> 
> Attached find a patch as Matt suggested.
> 
> I also fixed set_flags itself, although in our current situation this will have
> no effect, since by the time set_flags sees the symlink it will already be a
> link. However, I think that set_flags should do the right thing, without relying
> on it's caller. Alternatively, the entire handling of symlinks in set_flags
> could perhaps be removed?

This is looking better. But I'd really like us to only call the
filesystem check functions once per hg invocation, caching their results
in localrepo.
msg6242 (view) Author: dov Date: 2008-06-10.19:11:51
Well, I wanted to do this; however, it is necessary to have a non-symlink fs in
order to test this. I'm working with a vfat image mounted through the loopback
device, but I don't know how to do this in a test. Any ideas?
msg6234 (view) Author: djc Date: 2008-06-09.12:47:12
dov, could you perhaps write a test for the current erratic behavior and add it
to your patch? That way, it may be easier to prevent this from happening again.
msg6228 (view) Author: dov Date: 2008-06-08.16:08:58
Attached find a patch as Matt suggested.

I also fixed set_flags itself, although in our current situation this will have
no effect, since by the time set_flags sees the symlink it will already be a
link. However, I think that set_flags should do the right thing, without relying
on it's caller. Alternatively, the entire handling of symlinks in set_flags
could perhaps be removed?
msg6220 (view) Author: dov Date: 2008-06-07.23:45:41
@pmezard: I can confirm that it works on Windows; however, it does *not* work on
linux on a non-symlinking fs mount...

@mpm: I'll look in the direction you're suggesting...
msg6216 (view) Author: mpm Date: 2008-06-07.16:35:09
Reverting the patch is a step in the wrong direction. The current code deletes
existing files, which simplifies various permission issues.

The -problem- is down in util.set_flags. For a symlink, we write out a -file-,
then read it back in and convert it to a symlink. Instead, we should just create
a symlink in the first place if that's allowed. Something like:

  if self._uselinks and "l" in flags:
     os.symlink(data, f)
  else:
     file("f", "w").write(data)
msg6198 (view) Author: pmezard Date: 2008-06-07.08:44:43
BTW, I have pywin32 installed
msg6197 (view) Author: pmezard Date: 2008-06-07.08:42:45
I cannot reproduce it on Windows as of 37eedb1a1848, built from sources.

I tried to add a clone test to tests/test-no-symlinks, and create a simple repo
with a symlink under MacOSX and clone it under Windows, with or without --pull.

Can you confirm the issue still exists ?
msg6140 (view) Author: dov Date: 2008-06-02.17:03:53
that would be great, thanks!
msg6135 (view) Author: djc Date: 2008-06-02.12:03:16
I might have a look at this.
msg6131 (view) Author: dov Date: 2008-05-30.13:21:11
The attached patch appears to fix the issue, and doesn't break any existing
tests. I basically just undid the offending changeset, with a minor update
(set_exec no longer exists).
msg6130 (view) Author: dov Date: 2008-05-30.11:58:21
Cloning a repo containing symlinks to a non-symlink-capable filesystem aborts
with message:
abort: Operation not permitted

bisect finds the following:

The first bad revision is:
changeset:   5703:14789f30ac11
user:        Matt Mackall <mpm@selenic.com>
date:        Thu Dec 27 22:27:47 2007 -0600
summary:     wwrite: simplify with util.set_flags
History
Date User Action Args
2008-08-11 06:28:53djcsetstatus: chatting -> resolved
nosy: mpm, pmezard, dov, djc, abuehl
messages: + msg6743
2008-06-28 21:34:23dovsetnosy: mpm, pmezard, dov, djc, abuehl
messages: + msg6436
2008-06-15 17:50:13dovsetfiles: + symlinks_supporting_os_nonsupporting_fs.v2.patch.txt
nosy: mpm, pmezard, dov, djc, abuehl
messages: + msg6284
2008-06-11 17:02:15mpmsetnosy: mpm, pmezard, dov, djc, abuehl
messages: + msg6248
2008-06-10 19:11:52dovsetnosy: mpm, pmezard, dov, djc, abuehl
messages: + msg6242
2008-06-09 12:47:13djcsetnosy: mpm, pmezard, dov, djc, abuehl
messages: + msg6234
2008-06-08 16:09:02dovsetfiles: + symlinks_supporting_os_nonsupporting_fs.patch.txt
nosy: mpm, pmezard, dov, djc, abuehl
messages: + msg6228
2008-06-07 23:45:43dovsetnosy: mpm, pmezard, dov, djc, abuehl
messages: + msg6220
2008-06-07 16:35:11mpmsetnosy: + mpm
messages: + msg6216
2008-06-07 08:44:43pmezardsetnosy: pmezard, dov, djc, abuehl
messages: + msg6198
2008-06-07 08:42:45pmezardsetnosy: + pmezard
messages: + msg6197
2008-06-02 17:03:53dovsetnosy: dov, djc, abuehl
messages: + msg6140
2008-06-02 12:03:18djcsettopic: + patch
nosy: + djc
messages: + msg6135
2008-05-30 13:21:11dovsettopic: + symlinks
files: + fix_symlinks.patch
status: unread -> chatting
messages: + msg6131
nosy: dov, abuehl
2008-05-30 12:45:51abuehlsetnosy: + abuehl
2008-05-30 11:58:25dovcreate