[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Setting x-bit on symlinks to dirs vs files.

From: Karl Fogel <kfogel_at_red-bean.com>
Date: 2007-09-18 02:49:16 CEST

Philip Martin <philip@codematters.co.uk> writes:
> Karl Fogel <kfogel@red-bean.com> writes:
> I think the permissions of a symbolic link are completely ignored on a
> Unix system.
>
>> I guess I lean toward Solution #1 right now, but would like to hear
>> others' thoughts.
>
> I think that setting svn:executable on a symbolic link should have no
> effect, perhaps even be an error, irrespective of whether the symbolic
> link points at a file or directory. I think it is wrong for the
> client to change the permission of a target outside the working copy,
> if that is where the symbolic link points, and if it points inside the
> working copy then we can require the user to set permissions on the
> target not the link.

Do you mean that setting the property should be a noop-or-error, or
that the consequent attempt to tweak the x-bit should noop-or-error?

I prefer the latter way, with no-op, partly because it's easier to
implement, and partly because it might give saner behavior when a
file's type changes.

It could be implemented entirely in io_set_file_perms(). You'd be
allowed to set/unset the property, it just won't have any effect on
the x-bit on platforms that care about the x-bit, because the calls to
change the x-bit will have no effect. As for saner behavior,
consider:

The x-bit behavior would be based on the working type, not the
versioned type. In other words, in this sequence of commands

   $ echo "I'm a regular file." > newfile
   $ svn add newfile
   $ svn commit -m "Add new file."
   $ rm newfile
   $ ln -s oldfile newfile
   $ svn propverb svn:executable newfile

the last command would set the property, but have no effect on the
x-bit. And in this sequence of commands

   $ ln -s oldfile newfile
   $ svn add newfile
   $ svn commit -m "Add new file."
   $ rm newfile
   $ echo "Now I'm a regular file." > newfile
   $ svn propverb svn:executable newfile

the last command could affect the x-bit. That way, one could commit a
single revision that changes a file to a regular file and sets the
x-bit on it; yet one would be prevented from simultaneously changing
it to a symlink and tweaking the x-bit on the symlink.

I understand the attraction of trying to keep the svn:executable
property's presence inextricably linked to the x-bit, but I think that
would be tricky to implement in practice. (On Windows, an svn:special
file is just a file, whose contents indicate that it's a link. Would
we read and parse those contents, just to make sure we've got the
right kind of specialness?) Whereas if we just punt on the x-bit
where it won't do any good, and let people set the property however
they want, I think we still get consistent results.

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Sep 18 02:49:26 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.