This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 854425

Summary: XmlClean alters file permissions
Product: [Community] Publican Reporter: David O'Brien <daobrien>
Component: publicanAssignee: Jeff Fearn <jfearn>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: rglasz, rlandman, xma
Target Milestone: 3.1Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.1.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-05 22:40:48 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description David O'Brien 2012-09-04 21:42:02 EDT
Description of problem:

When I run publican clean-ids it changes the permissions of xml files to 600.

I purposely use specific user and group ownership for sharing purposes, but every time I run clean_ids these permissions are reset.

e.g.
Required perms:
-rw-rw-r--. 1     1000 shared  3786 Jul 13 14:04 Application_Commands.xml

Post clean_ids perms:
-rw-------. 1 daobrien shared  3816 Sep  5 11:15 Application_Commands.xml

Version-Release number of selected component (if applicable):
3.0

How reproducible:
Always

Steps to Reproduce:
1. Set perms to 664
2. Run publican clean_ids
3.
  
Actual results:
Perms are reset to 600

Expected results:
Perms should not be affected at all

Additional info:

Refer to:
http://www.perlmonks.org/?node_id=603102

Only seems to affect xml files. Dirs, .png, .svg, .ent files, etc., appear not to suffer.
Comment 1 Jeff Fearn 2012-09-13 00:41:35 EDT
Added call to read and reset file perms.

To ssh://git.fedorahosted.org/git/publican.git
   d57ac25..bc11c60  master -> master
Comment 2 Andrew Ross 2012-10-03 00:28:31 EDT
Build from upstream source on a RHEL6.3 workstation: publican-3.0-0.el6.t226.noarch

Here's the steps I took to test the fix:

1. Create a new book:

publican create --name Test_Book

2. Check current permissions. They are rw-rw-r-- (as per comment#0)

ls -la en-US/
[...]
-rw-rw-r--. 1 anross anross  584 Oct  3 14:22 Author_Group.xml
-rw-rw-r--. 1 anross anross 1174 Oct  3 14:22 Book_Info.xml
-rw-rw-r--. 1 anross anross  850 Oct  3 14:22 Chapter.xml
[...]

3. Run clean_ids

publican clean_ids

4. Check permissions - they are unchanged (good).

ls -la en-US/
[...]
-rw-rw-r--. 1 anross anross  590 Oct  3 14:24 Author_Group.xml
-rw-rw-r--. 1 anross anross 1186 Oct  3 14:24 Book_Info.xml
-rw-rw-r--. 1 anross anross  863 Oct  3 14:24 Chapter.xml
[...]

5. As an additional check, I changed permission to 660 on en-US/Book_Info.xml, ran clean_ids again. Permissions unchanged (good).


Based on this testing I'm moving the bug to VERIFIED.
Comment 3 David O'Brien 2012-10-31 02:38:52 EDT
This is better, but it still doesn't work properly. See below (only an extract included to demonstrate issue):

[daobrien@daobrien API_Guide]$ ll en-US/ 
total 56 
 
-rwxrwxr--. 1 daobrien shared 16003 May  1  2012 API_Commands.xml                 
-rwxrwxr--. 1 daobrien shared   117 May  1  2012 API_Guide.ent                  
-rwxrwxr--. 1 daobrien shared   754 May  1  2012 API_Guide.xml 
-rwxrwxr--. 1 daobrien shared   484 May  1  2012 Author_Group.xml 
              
[daobrien@daobrien API_Guide]$ publican clean_ids

[daobrien@daobrien API_Guide]$ ll en-US/ 
total 56 
 
-rwxrwxr--. 1 daobrien daobrien 16003 May  1  2012 API_Commands.xml                  
-rwxrwxr--. 1 daobrien shared   117 May  1  2012 API_Guide.ent                  
-rwxrwxr--. 1 daobrien daobrien   754 May  1  2012 API_Guide.xml 
-rwxrwxr--. 1 daobrien daobrien   484 May  1  2012 Author_Group.xml 

Files and directories that have been touched by publican have their group ownership reset. This makes the files r/o for other users.
Comment 4 Jeff Fearn 2013-01-07 16:28:37 EST
This fix has been committed to the devel branch for inclusion in Publican 3.1.
Comment 5 xuezhi ma 2013-01-31 03:12:21 EST
Verify version: publican-3.1.0-0.el6eng.noarch -> FAIL

Verify steps:
1. $pubican create --name=Test_Book
2. $ cd Test_Book/en-US/
3. $chmod 774 *.xml.
4. $chgrp test *.xml
5. $ll
total 32
-rwxrwxr--. 1 xma test  596 Jan 31 16:01 Author_Group.xml
-rwxrwxr--. 1 xma test 1192 Jan 31 16:01 Book_Info.xml
-rwxrwxr--. 1 xma test  869 Jan 31 16:01 Chapter.xml
drwxrwxr-x. 2 xma xma  4096 Jan 31 15:57 images
-rwxrwxr--. 1 xma test  680 Jan 31 16:01 Preface.xml
-rwxrwxr--. 1 xma test  820 Jan 31 16:01 Revision_History.xml
-rw-rw-r--. 1 xma xma   177 Jan 31 15:57 Test_Book.ent
-rwxrwxr--. 1 xma test  586 Jan 31 16:01 Test_Book.xml
6. $publican clean_ids
7. $ll en-US/
total 32
-rwxrwxr--. 1 xma xma  596 Jan 31 16:05 Author_Group.xml
-rwxrwxr--. 1 xma xma 1192 Jan 31 16:05 Book_Info.xml
-rwxrwxr--. 1 xma xma  869 Jan 31 16:05 Chapter.xml
drwxrwxr-x. 2 xma xma 4096 Jan 31 15:57 images
-rwxrwxr--. 1 xma xma  680 Jan 31 16:05 Preface.xml
-rwxrwxr--. 1 xma xma  820 Jan 31 16:05 Revision_History.xml
-rw-rw-r--. 1 xma xma  177 Jan 31 15:57 Test_Book.ent
-rwxrwxr--. 1 xma xma  586 Jan 31 16:05 Test_Book.xml

Actul result:
The group ownership are reset.
Comment 6 Jeff Fearn 2013-02-01 01:06:00 EST
I cannot duplicate this result.

[test]$ publican create --name=Test_Book
	Processing file en-US/Author_Group.xml -> en-US/Author_Group.xml
	Processing file en-US/Book_Info.xml -> en-US/Book_Info.xml
	Processing file en-US/Chapter.xml -> en-US/Chapter.xml
	Processing file en-US/Preface.xml -> en-US/Preface.xml
	Processing file en-US/Revision_History.xml -> en-US/Revision_History.xml
	Processing file en-US/Test_Book.xml -> en-US/Test_Book.xml
[test]$ cd Test_Book/
[Test_Book]$ chmod 774 en-US/*.xml
[Test_Book]$ chgrp mock en-US/*.xml
[Test_Book]$ ll en-US/
total 32
-rwxrwxr--. 1 jfearn mock    590 Feb  1 15:56 Author_Group.xml
-rwxrwxr--. 1 jfearn mock   1180 Feb  1 15:56 Book_Info.xml
-rwxrwxr--. 1 jfearn mock    856 Feb  1 15:56 Chapter.xml
drwxrwxr-x. 2 jfearn jfearn 4096 Feb  1 15:56 images
-rwxrwxr--. 1 jfearn mock    676 Feb  1 15:56 Preface.xml
-rwxrwxr--. 1 jfearn mock    807 Feb  1 15:56 Revision_History.xml
-rw-rw-r--. 1 jfearn jfearn  177 Feb  1 15:56 Test_Book.ent
-rwxrwxr--. 1 jfearn mock    582 Feb  1 15:56 Test_Book.xml
[Test_Book]$ publican clean_ids
	Processing file en-US/Author_Group.xml -> en-US/Author_Group.xml
	Processing file en-US/Book_Info.xml -> en-US/Book_Info.xml
	Processing file en-US/Chapter.xml -> en-US/Chapter.xml
	Processing file en-US/Preface.xml -> en-US/Preface.xml
	Processing file en-US/Revision_History.xml -> en-US/Revision_History.xml
	Processing file en-US/Test_Book.xml -> en-US/Test_Book.xml
[Test_Book]$ ll en-US/
total 32
-rwxrwxr--. 1 jfearn mock    596 Feb  1 15:57 Author_Group.xml
-rwxrwxr--. 1 jfearn mock   1192 Feb  1 15:57 Book_Info.xml
-rwxrwxr--. 1 jfearn mock    869 Feb  1 15:57 Chapter.xml
drwxrwxr-x. 2 jfearn jfearn 4096 Feb  1 15:56 images
-rwxrwxr--. 1 jfearn mock    680 Feb  1 15:57 Preface.xml
-rwxrwxr--. 1 jfearn mock    819 Feb  1 15:57 Revision_History.xml
-rw-rw-r--. 1 jfearn jfearn  177 Feb  1 15:56 Test_Book.ent
-rwxrwxr--. 1 jfearn mock    586 Feb  1 15:57 Test_Book.xml
[Test_Book]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Workstation release 6.3 (Santiago)
[Test_Book]$ rpm -q publican
publican-3.1.0-0.el6eng.noarch
Comment 7 xuezhi ma 2013-02-01 04:03:29 EST
This is my steps:

[xma@localhost book]$ publican create --name=Test_Book
	Processing file en-US/Author_Group.xml -> en-US/Author_Group.xml
	Processing file en-US/Book_Info.xml -> en-US/Book_Info.xml
	Processing file en-US/Chapter.xml -> en-US/Chapter.xml
	Processing file en-US/Preface.xml -> en-US/Preface.xml
	Processing file en-US/Revision_History.xml -> en-US/Revision_History.xml
	Processing file en-US/Test_Book.xml -> en-US/Test_Book.xml
[xma@localhost book]$ cd Test_Book/
[xma@localhost Test_Book]$ chmod 774 en-US/*.xml
[xma@localhost Test_Book]$ sudo chgrp test en-US/*.xml
[sudo] password for xma: 
[xma@localhost Test_Book]$ ll en-US/
total 32
-rwxrwxr--. 1 xma test  590 Feb  1 16:36 Author_Group.xml
-rwxrwxr--. 1 xma test 1180 Feb  1 16:36 Book_Info.xml
-rwxrwxr--. 1 xma test  856 Feb  1 16:36 Chapter.xml
drwxrwxr-x. 2 xma xma  4096 Feb  1 16:36 images
-rwxrwxr--. 1 xma test  676 Feb  1 16:36 Preface.xml
-rwxrwxr--. 1 xma test  807 Feb  1 16:36 Revision_History.xml
-rw-rw-r--. 1 xma xma   177 Feb  1 16:36 Test_Book.ent
-rwxrwxr--. 1 xma test  582 Feb  1 16:36 Test_Book.xml
[xma@localhost Test_Book]$ publican clean_ids
	Processing file en-US/Author_Group.xml -> en-US/Author_Group.xml
	Processing file en-US/Book_Info.xml -> en-US/Book_Info.xml
	Processing file en-US/Chapter.xml -> en-US/Chapter.xml
	Processing file en-US/Preface.xml -> en-US/Preface.xml
	Processing file en-US/Revision_History.xml -> en-US/Revision_History.xml
	Processing file en-US/Test_Book.xml -> en-US/Test_Book.xml
[xma@localhost Test_Book]$ ll en-US/
total 32
-rwxrwxr--. 1 xma xma  596 Feb  1 16:51 Author_Group.xml
-rwxrwxr--. 1 xma xma 1192 Feb  1 16:51 Book_Info.xml
-rwxrwxr--. 1 xma xma  869 Feb  1 16:51 Chapter.xml
drwxrwxr-x. 2 xma xma 4096 Feb  1 16:36 images
-rwxrwxr--. 1 xma xma  680 Feb  1 16:51 Preface.xml
-rwxrwxr--. 1 xma xma  819 Feb  1 16:51 Revision_History.xml
-rw-rw-r--. 1 xma xma  177 Feb  1 16:36 Test_Book.ent
-rwxrwxr--. 1 xma xma  586 Feb  1 16:51 Test_Book.xml
[xma@localhost Test_Book]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[xma@localhost Test_Book]$ rpm -q publican
publican-3.1.0-0.el6eng.noarch
Comment 8 Jeff Fearn 2013-02-03 17:12:43 EST
(In reply to comment #7)
> [xma@localhost Test_Book]$ sudo chgrp test en-US/*.xml
> [sudo] password for xma: 

If you need to use sudo then you are not a member of the group and obviously no normal command will be able to set group ownership to a group you don't belong to.
Comment 9 xuezhi ma 2013-02-03 21:39:39 EST
(In reply to comment #8)
> If you need to use sudo then you are not a member of the group and obviously
> no normal command will be able to set group ownership to a group you don't
> belong to.
I tried again,
[xma@localhost book]$ publican create --name=Test_Book
	Processing file en-US/Author_Group.xml -> en-US/Author_Group.xml
	Processing file en-US/Book_Info.xml -> en-US/Book_Info.xml
	Processing file en-US/Chapter.xml -> en-US/Chapter.xml
	Processing file en-US/Preface.xml -> en-US/Preface.xml
	Processing file en-US/Revision_History.xml -> en-US/Revision_History.xml
	Processing file en-US/Test_Book.xml -> en-US/Test_Book.xml
[xma@localhost book]$ cd Test_Book/
[xma@localhost Test_Book]$ chmod 774 en-US/*.xml
[xma@localhost Test_Book]$ chgrp test en-US/*.xml
[xma@localhost Test_Book]$ ll en-US/
total 32
-rwxrwxr--. 1 xma test  590 Feb  4 10:37 Author_Group.xml
-rwxrwxr--. 1 xma test 1180 Feb  4 10:37 Book_Info.xml
-rwxrwxr--. 1 xma test  856 Feb  4 10:37 Chapter.xml
drwxrwxr-x. 2 xma xma  4096 Feb  4 10:37 images
-rwxrwxr--. 1 xma test  676 Feb  4 10:37 Preface.xml
-rwxrwxr--. 1 xma test  807 Feb  4 10:37 Revision_History.xml
-rw-rw-r--. 1 xma xma   177 Feb  4 10:37 Test_Book.ent
-rwxrwxr--. 1 xma test  582 Feb  4 10:37 Test_Book.xml
[xma@localhost Test_Book]$ publican clean_ids
	Processing file en-US/Author_Group.xml -> en-US/Author_Group.xml
	Processing file en-US/Book_Info.xml -> en-US/Book_Info.xml
	Processing file en-US/Chapter.xml -> en-US/Chapter.xml
	Processing file en-US/Preface.xml -> en-US/Preface.xml
	Processing file en-US/Revision_History.xml -> en-US/Revision_History.xml
	Processing file en-US/Test_Book.xml -> en-US/Test_Book.xml
[xma@localhost Test_Book]$ ll en-US/
total 32
-rwxrwxr--. 1 xma xma  596 Feb  4 10:38 Author_Group.xml
-rwxrwxr--. 1 xma xma 1192 Feb  4 10:38 Book_Info.xml
-rwxrwxr--. 1 xma xma  869 Feb  4 10:38 Chapter.xml
drwxrwxr-x. 2 xma xma 4096 Feb  4 10:37 images
-rwxrwxr--. 1 xma xma  680 Feb  4 10:38 Preface.xml
-rwxrwxr--. 1 xma xma  819 Feb  4 10:38 Revision_History.xml
-rw-rw-r--. 1 xma xma  177 Feb  4 10:37 Test_Book.ent
-rwxrwxr--. 1 xma xma  586 Feb  4 10:38 Test_Book.xml
[xma@localhost Test_Book]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[xma@localhost Test_Book]$ rpm -q publican
publican-3.1.0-0.el6eng.noarch
Comment 10 xuezhi ma 2013-02-04 02:05:23 EST
Verify version: publican-3.1.0-2.el6eng.noarch -> PASS

Verify steps:
[xma@localhost book]$ publican create --name=Test_Book
	Processing file en-US/Author_Group.xml -> en-US/Author_Group.xml
	Processing file en-US/Book_Info.xml -> en-US/Book_Info.xml
	Processing file en-US/Chapter.xml -> en-US/Chapter.xml
	Processing file en-US/Preface.xml -> en-US/Preface.xml
	Processing file en-US/Revision_History.xml -> en-US/Revision_History.xml
	Processing file en-US/Test_Book.xml -> en-US/Test_Book.xml
[xma@localhost book]$ cd Test_Book/
[xma@localhost Test_Book]$ chmod 774 en-US/*.xml
[xma@localhost Test_Book]$ chgrp test en-US/*.xml
[xma@localhost Test_Book]$ ll en-US/
total 32
-rwxrwxr--. 1 xma test  590 Feb  4 15:05 Author_Group.xml
-rwxrwxr--. 1 xma test 1180 Feb  4 15:05 Book_Info.xml
-rwxrwxr--. 1 xma test  856 Feb  4 15:05 Chapter.xml
drwxrwxr-x. 2 xma xma  4096 Feb  4 15:05 images
-rwxrwxr--. 1 xma test  676 Feb  4 15:05 Preface.xml
-rwxrwxr--. 1 xma test  807 Feb  4 15:05 Revision_History.xml
-rw-rw-r--. 1 xma xma   177 Feb  4 15:05 Test_Book.ent
-rwxrwxr--. 1 xma test  582 Feb  4 15:05 Test_Book.xml
[xma@localhost Test_Book]$ publican clean_ids
	Processing file en-US/Author_Group.xml -> en-US/Author_Group.xml
	Processing file en-US/Book_Info.xml -> en-US/Book_Info.xml
	Processing file en-US/Chapter.xml -> en-US/Chapter.xml
	Processing file en-US/Preface.xml -> en-US/Preface.xml
	Processing file en-US/Revision_History.xml -> en-US/Revision_History.xml
	Processing file en-US/Test_Book.xml -> en-US/Test_Book.xml
[xma@localhost Test_Book]$ ll en-US/
total 32
-rwxrwxr--. 1 xma test  596 Feb  4 15:06 Author_Group.xml
-rwxrwxr--. 1 xma test 1192 Feb  4 15:06 Book_Info.xml
-rwxrwxr--. 1 xma test  869 Feb  4 15:06 Chapter.xml
drwxrwxr-x. 2 xma xma  4096 Feb  4 15:05 images
-rwxrwxr--. 1 xma test  680 Feb  4 15:06 Preface.xml
-rwxrwxr--. 1 xma test  819 Feb  4 15:06 Revision_History.xml
-rw-rw-r--. 1 xma xma   177 Feb  4 15:05 Test_Book.ent
-rwxrwxr--. 1 xma test  586 Feb  4 15:06 Test_Book.xml
[xma@localhost Test_Book]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.3 (Santiago)
[xma@localhost Test_Book]$ rpm -q publican
publican-3.1.0-2.el6eng.noarch