This patch fixes bug #376388
It ensure that .bazaar, .bazaar/bazaar.conf and .bzr.log when created
by bzr run under sudo, have the same usr/grp ownership as the containing
folder and not root.
copy_ownership(src, dst) function copies user and group ownership
from src to dst. copy_ownership does nothing on windows.
This function is used during creation of .bazaar, .bazaar/bazaar.conf
and .bzr.log.
.bzr.log location of /dev/null and NUL are ignored.
This was tested by creating a user 'sandbox' and running
'sudo bzr whoami a@b'. The latter creates the above files with
the correct ownership.
I am not sure what would be a good way to write a automated test case
for this. Any ideas/suggestion are welcome. I would be happy to
implement them.
Below is the log of the manual test run:
sandbox@parthm-laptop:~$ ls -la .bazaar .bzr.log .bazaar/bazaar.conf
ls: cannot access .bazaar: No such file or directory
ls: cannot access .bzr.log: No such file or directory
ls: cannot access .bazaar/bazaar.conf: No such file or directory
sandbox@parthm-laptop:~$ sudo /storage/parth/src/bzr.dev/2.0_376388_dot_bazaar_ownership/bzr whoami a@b
[sudo] password for sandbox:
This patch fixes bug #376388
It ensure that .bazaar, .bazaar/bazaar.conf and .bzr.log when created
by bzr run under sudo, have the same usr/grp ownership as the containing
folder and not root.
copy_ownership(src, dst) function copies user and group ownership
from src to dst. copy_ownership does nothing on windows.
This function is used during creation of .bazaar, .bazaar/bazaar.conf
and .bzr.log.
.bzr.log location of /dev/null and NUL are ignored.
This was tested by creating a user 'sandbox' and running
'sudo bzr whoami a@b'. The latter creates the above files with
the correct ownership.
I am not sure what would be a good way to write a automated test case
for this. Any ideas/suggestion are welcome. I would be happy to
implement them.
Below is the log of the manual test run:
sandbox@ parthm- laptop: ~$ ls -la .bazaar .bzr.log .bazaar/bazaar.conf bazaar. conf: No such file or directory
ls: cannot access .bazaar: No such file or directory
ls: cannot access .bzr.log: No such file or directory
ls: cannot access .bazaar/
sandbox@ parthm- laptop: ~$ sudo /storage/ parth/src/ bzr.dev/ 2.0_376388_ dot_bazaar_ ownership/ bzr whoami a@b
[sudo] password for sandbox:
sandbox@ parthm- laptop: ~$ ls -la .bazaar .bzr.log .bazaar/ bazaar. conf-rw- r--r-- 1 sandbox sandbox 22 2010-02-18 18:13 .bazaar/bazaar.conf
-rw-r--r-- 1 sandbox sandbox 727 2010-02-18 18:13 .bzr.log
.bazaar: parthm- laptop: ~$
total 12
drwxr-xr-x 2 sandbox sandbox 4096 2010-02-18 18:13 .
drwxr-xr-x 4 sandbox sandbox 4096 2010-02-18 18:13 ..
-rw-r--r-- 1 sandbox sandbox 22 2010-02-18 18:13 bazaar.conf
sandbox@