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

Re: [TSVN] Apache 2 / Samba permission problems on file copy

From: SteveKing <steveking_at_gmx.ch>
Date: 2005-01-26 15:10:44 CET

Steve Pavarno wrote:
> I'm having problems with Apache, Samba and Tortoise SVN working together. Do
> you have a moment to help / advise?

Time? Yes.
But I'm not sure if I can really help, I've just some suggestions to
make about what you can try...

> Setup:
> - My development PC runs Win2k service pack 4 and Tortoise SVN 1.1.3 build
> 2502
> - Apache web server running Debian Sarge:
> Apache/2.0.52 (Debian GNU/Linux) mod_python/3.1.3 Python/2.3.4
> PHP/5.0.3-0.2 mod_perl/1.999.20 Perl/v5.8.4
> - A Samba share publishes a /var/www/audit directory so I can access it from
> my windows box as a mapped network drive
> This manifests itself in two ways:
> 1 - if I use Tortoise to checkout the project through the samba share, none
> of the files are readable by the web server. I get a permissions errors in
> several variants including HTTP403 errors and the one below (which looks
> like it comes from PHP?)
> Warning: Unknown: failed to open stream: Permission denied in Unknown on
> line 0
> Warning: Unknown: Failed opening '/var/www/audit/p2.php' for inclusion
> (include_path='.:/usr/share/php') in Unknown on line 0

That means you check out your working copy _to_ the samba share?
That's not a very good idea. Sharing working copies between Windows and
Linux machines almost certainly will cause problems. Not just
permissions but also lineendings of files.

I would suggest that you check out your working copy locally. Then, you
can install a post-commit hook script which updates a local working copy
on the Linux machine automatically after every commit (so it will always
be up-to-date). That working copy is then served by apache/PHP/... (make
sure to exclude the .svn directories from the browsable folders!).
Such a script is available from the Subversion project - somewhere in
their sourcetree.

> This problem seems to go away if I competely delete the directory and do a
> checkout from the linux command line on the server. Apache is able to serve
> the files correctly.

That's either a permission problem or a lineending problem. Don't know
if apache (on linux) can read files with CR/LF lineendings or not, or
PHP for that matter.
About the permissions: AFAIK there's an option in samba which states
which permissions a file/folder automatically get's when it's
modified/created. Make sure that option is set so that your apache can
access those files.

> 2 - Doing copy/paste in windows explorer on a file in a repository. I use
> this is a quick and easy way to create a new file with the standard header
> comments included. The result is a file called "Copy of MyFile.php" which I
> then rename. The renamed file has the same permissions problems, even when
> the original works fine. If I copy the file form the linux command line, it
> all works fine. I have done this often on this server before installing
> Tortoise and it worked fine then.

Ok, so it seems it's not a lineendings problem but really a permission

> For both of the above, file ownership and permissions all look fine. There
> is perhaps some hidden property of the file that I cannot see from Windows
> Explorer or the linux command line?

On linux, the must either be readable/executable and maybe even writable
by 'O'thers, if only for 'G'roups the files must belong to the same
usergroup the apache is in (usually 'nobody' or 'www' or ...).

But as I mentioned above: the best solution to this is to _not_ share
the working copy at all. Use a post-commit script to keep a separate
working copy up-to-date on the linux machine which you then use as the
source for your web.
Scripts which do exactly that are widely used. I'm sure you'll find one
which works for you in no time - just search the Subversion website
(FAQ, Docs) and/or their mailing list.


   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Wed Jan 26 15:11:35 2005

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