Merge lp:~parthm/bzr/2.0_376388_dot_bazaar_ownership into lp:bzr/2.0
| Status: | Rejected |
|---|---|
| Rejected by: | Martin Pool on 2010-02-19 |
| Proposed branch: | lp:~parthm/bzr/2.0_376388_dot_bazaar_ownership |
| Merge into: | lp:bzr/2.0 |
| Diff against target: |
124 lines (+56/-3) 4 files modified
NEWS (+5/-0) bzrlib/config.py (+4/-2) bzrlib/osutils.py (+42/-0) bzrlib/trace.py (+5/-1) |
| To merge this branch: | bzr merge lp:~parthm/bzr/2.0_376388_dot_bazaar_ownership |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Martin Pool | 2010-02-18 | Needs Fixing on 2010-02-18 | |
|
Review via email:
|
|||
| Parth Malwankar (parthm) wrote : | # |
| Martin Pool (mbp) wrote : | # |
Having a special case for /dev/null and NUL is a bit gross and probably unnecessary.
I think we should set the permissions only when the files are first created; changing the perms on existing files is more dangerous and more likely to cause nasty surprises.
I think we should catch errors in doing the chmod and turn them into user warnings to avoid bzr crashing entirely if you do have a strange situation.
I'd like to see the 'create a thing inheriting permissions' factored out; probably you need a variation for mkdir and for making a file.
Once that is split out, the cleanest way to test it is probably to monkeypatch os.chmod and then run that function. You can use overrideAttr to do this.
| Martin Pool (mbp) wrote : | # |
An interesting followon from this would be that we could also do this when creating a .bzr directory.
Also, you should perhaps do the chown and chgrp separately, as the chown may fail when the chgrp can succeed. (Common for non-root users.)
I think overall this is a reasonable change though it might be considered a bit magical.
| Martin Pool (mbp) wrote : | # |
btw I don't think this is appropriate for 2.0: it's not a severe bug and there is some risk of it having surprising fallout. trunk only.
- 4736. By Parth Malwankar on 2010-02-19
-
added parent_dir and mkdir to osutils. osutils.mkdir optionally
supports copying ownership for a specified file or dir. - 4737. By Parth Malwankar on 2010-02-19
-
added osutils.open which optionally takes ownership_src and
uses that to set usr/grp ownership of the opened file.
| Parth Malwankar (parthm) wrote : | # |
> Having a special case for /dev/null and NUL is a bit gross and probably
> unnecessary.
>
> I think we should set the permissions only when the files are first created;
> changing the perms on existing files is more dangerous and more likely to
> cause nasty surprises.
>
> I think we should catch errors in doing the chmod and turn them into user
> warnings to avoid bzr crashing entirely if you do have a strange situation.
>
> I'd like to see the 'create a thing inheriting permissions' factored out;
> probably you need a variation for mkdir and for making a file.
>
> Once that is split out, the cleanest way to test it is probably to monkeypatch
> os.chmod and then run that function. You can use overrideAttr to do this.
Thanks for your comments Martin. I have updated the patch.
| Parth Malwankar (parthm) wrote : | # |
> An interesting followon from this would be that we could also do this when
> creating a .bzr directory.
>
> Also, you should perhaps do the chown and chgrp separately, as the chown may
> fail when the chgrp can succeed. (Common for non-root users.)
>
> I think overall this is a reasonable change though it might be considered a
> bit magical.
Filed bug #524306 to track this.
| Parth Malwankar (parthm) wrote : | # |
> btw I don't think this is appropriate for 2.0: it's not a severe bug and there
> is some risk of it having surprising fallout. trunk only.
I have proposed a merge based of trunk due to the above and also because overrideAttr was not available in the 2.0 line.
Please consider this mp obsolte.
The new merge proposal is https:/
| Parth Malwankar (parthm) wrote : | # |
Does launchpad have a way of setting this as obsolete?
| John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Parth Malwankar wrote:
> Does launchpad have a way of setting this as obsolete?
>
Change the setting to Rejected.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkt
ZmsAoNWf7m3aOVK
=WOeF
-----END PGP SIGNATURE-----
Unmerged revisions
- 4737. By Parth Malwankar on 2010-02-19
-
added osutils.open which optionally takes ownership_src and
uses that to set usr/grp ownership of the opened file. - 4736. By Parth Malwankar on 2010-02-19
-
added parent_dir and mkdir to osutils. osutils.mkdir optionally
supports copying ownership for a specified file or dir. - 4735. By Parth Malwankar on 2010-02-18
-
updated NEWS
- 4734. By Parth Malwankar on 2010-02-18
-
fixed test cases to handle special .bzr.log files
i.e. NUL or /dev/null.
also handle the case where the caller uses os.path.dirname
and that returns '' - 4733. By Parth Malwankar on 2010-02-18
-
default .bazaar, .bzr.log and .bazaar/bazaar.conf retain
the ownershup of the containing directory.

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@