On Thu, Jul 21, 2011 at 9:31 PM, Andy Canfield <andy.canfield_at_pimco.mobi> wrote:
> I ran into a problem with a web site I am developing under Drupal; a problem
> related to user. And I suspect that the same problem arises witn Subversion.
>
> On my local copy of that site, sometimes the PHP code creates a directory
> and puts files into that directory. The directory had standard permissions
> - readable by all but writable only by owner. But that directory is owned by
> www-data because apache/PHP created the directory.
>
> But when I zip it up, upload it to the server in Hong Kong, and unzip it,
> all directories are owned by the user on the server who unzipped the
> directory. The permissions were preserved; still readable by all but
> writable only by the owner. But the owner was no longer the Apache user, it
> was the user who unzipped the directory. I had to invent two shell scripts;
> one to run on my computer finding all the directories owned by Apache on my
> machine, and the second run on the server making all those directories
> writable by all.
Well, yes. The person who unzips a file, or untars it, or does an
rsync, or restore, or cpio, or "svn checkout", or any kind of "extract
this file from that bunch of information about files and create it
locally" operation, normally only has permissions to create files
owned by them. This is built into most filesystems, and only local
"root" or certain administritive users will have permission to erset
ownership.
That's really basic to how Linux and UNIX filesystems work. NTFS and
ZFS and other network filesystems have their own ideas about this, but
"I can only create files owned by me unless I have extra special
privileges" is the rule.
> I suspect that if I were using Subversion I would still have that problem. I
> do not remember seeing anything in the manual about preserving directory and
> file attributes, such as readable by all and writable by all. I do not
> remember seeing anything in the manual about directory owners. I saw no
> warning, I saw no assurance.
Because it's not something Subversion even tries to record. It would
be very, very sensitive to filesystems and operating system and get
really nasty really fast, and it also wasn't really bult into CVS
(which is the spiritual ancestor of Subversion). And it would be a
*nightmare* to attempt to apply or enforce. Setting that kind of
permissions is part of what a software installer would do, not
typically part of what a source control would do.
> But, then again, I haven't finished the second manual yet. Maybe that's
> covered farther back in the book.
>
> So does Subversion preserve directory attributes?
Only the "svn:executable" bit for files, and Subversion specific
settings such as "svn:externals" referring to the contents of the
directory.
Received on 2011-07-22 03:56:00 CEST