Skip to contentSkip to conversation

sudo: Modify ownership for dircetory "/var/lib"

PATCH In review Xiaofeng Yan 3 participants 8 messages May 21, 2011 – May 23, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

cover sudo: Modify ownership for dircetory "/var/lib"

From: Xiaofeng Yan <[email protected]>

Hi Saul,
I submit this patch to fix [YOCTO #1092].

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: xiaofeng/sudo
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=xiaofeng/sudo

Thanks,
Xiaofeng Yan <[email protected]>
---

Xiaofeng Yan (1):
sudo: Modify ownership for directory "/var/lib"

 meta/recipes-extended/sudo/sudo.inc |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
#1 lore raw

PATCH 1/1 sudo: Modify ownership for directory "/var/lib"

From: Xiaofeng Yan <[email protected]>

[YOCTO #1092]
Solve access permission for directory "/var/lib". Makefile from package sudo change the ownership incorrectly.

---
 meta/recipes-extended/sudo/sudo.inc |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
meta/recipes-extended/sudo/sudo.inc +1 -0
index 6a04a9c..5ea089c 100644
@@ -30,4 +30,5 @@ pkg_postinst_${PN} () {
 
 	chmod 4111 /usr/bin/sudo
 	chmod 0440 /etc/sudoers
+	chmod 0755 /var/lib
 }
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH 1/1] sudo: Modify ownership for directory "/var/lib"

Dear Xiaofeng Yan,

Quoted 16 lines · In message <d448b57c57fec346230d40fadc08625bd8c83224.1305972143.git.xiaofeng.ya…

From: Xiaofeng Yan <[email protected]>

[YOCTO #1092]
Solve access permission for directory "/var/lib". Makefile from package sudo change the ownership incorrectly.

---
 meta/recipes-extended/sudo/sudo.inc |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
meta/recipes-extended/sudo/sudo.inc +0 -0
index 6a04a9c..5ea089c 100644

meta/recipes-extended/sudo/sudo.inc pkg_postinst_${PN} () { · line 33

Quoted 4 lines
meta/recipes-extended/sudo/sudo.inc +1 -0
@@ -30,4 +30,5 @@ pkg_postinst_${PN} () {
 
 	chmod 4111 /usr/bin/sudo
 	chmod 0440 /etc/sudoers
+	chmod 0755 /var/lib

Sorry, but this commit message is misleading. You don't change the ownership here, but the file permissions.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
Never put off until tomorrow what you can put off indefinitely.
#3 lore raw

Re: [PATCH 1/1] sudo: Modify ownership for directory "/var/lib"

Quoted 20 lines · Wolfgang Denk

Dear Xiaofeng Yan,

Quoted 17 lines · In message<d448b57c57fec346230d40fadc08625bd8c83224.1305972143.git.xiaofeng.yan…

From: Xiaofeng Yan<[email protected]>

[YOCTO #1092]
Solve access permission for directory "/var/lib". Makefile from package sudo change the ownership incorrectly.

---
  meta/recipes-extended/sudo/sudo.inc |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
meta/recipes-extended/sudo/sudo.inc +0 -0
index 6a04a9c..5ea089c 100644
@@ -30,4 +30,5 @@ pkg_postinst_${PN} () {
 
Quoted 6 lines

meta/recipes-extended/sudo/sudo.inc pkg_postinst_${PN} () { · line 33

Quoted 3 lines
meta/recipes-extended/sudo/sudo.inc +1 -0
  	chmod 4111 /usr/bin/sudo
  	chmod 0440 /etc/sudoers
+	chmod 0755 /var/lib

Sorry, but this commit message is misleading. You don't change the ownership here, but the file permissions.

Hi Wolfgang Denk,
Thanks for your reply. I am make lsb test to pass LSB certification. LSB Test suite check /vat/lib, but failed with the following information.
/tset/LSB.fhs/var/lib/lib-tc 1 failed

Message from the test:

Reference 5.8-1(A)
The /var/lib directory exists and is searchable
Unexpected output written to stdout, as shown below:
stdout:lsb_test_dir: expected be able to search directory /var/lib, got an error stdout:ls: cannot open directory /var/lib: Permission denied

emenlow$ls /var/lib -l
drwx------ 10 root root 4096 May 20 19:21 lib

For general machine, the ownership of this directory is as follow:
ubuntu$ls /var/lib -l
drwxr-xr-x 67 root root 4096 2010-12-15 23:30 lib

In fact, many packages make a operation to directory "/var/lib". I find the Makefile from package "sudo" change the ownership. Please review the following patch.

Makefile 2011-05-21 16:36:47.979380106 +0800 renamed from Makefile.orj 2011-05-21 16:32:35.392833427 +0800 +1 -1
@@ -482,7 +482,7 @@
         $(DESTDIR)$(visudodir) $(DESTDIR)$(noexecdir) \
         $(DESTDIR)$(sudoersdir) $(DESTDIR)$(docdir) \
         $(DESTDIR)$(mandirsu) $(DESTDIR)$(mandirform)
-   $(SHELL) $(srcdir)/mkinstalldirs -m 0700 $(DESTDIR)$(timedir)
+   $(SHELL) $(srcdir)/mkinstalldirs -m 0755 $(DESTDIR)$(timedir)
 
  install-binaries: install-dirs $(PROGS)
     $(INSTALL) -b~ -O $(install_uid) -G $(install_gid) -M 04111 sudo

$(DESTDIR)$(sudodir)/sudo

So "0700" make this directory without access permission. Perhaps it could not be right method, I think you have a better method to solve this problem. If you have, Please share with me. Thanks for your suggestion again.

Thanks
Yan

Quoted 4 lines

Best regards,

Wolfgang Denk

#4 lore raw

Re: [PATCH 1/1] sudo: Modify ownership for directory "/var/lib"

Quoted 33 lines · Xiaofeng Yan
Quoted 20 lines · Wolfgang Denk

Dear Xiaofeng Yan,

Quoted 17 lines · In message<d448b57c57fec346230d40fadc08625bd8c83224.1305972143.git.xiaofeng.yan…

From: Xiaofeng Yan<[email protected]>

[YOCTO #1092]
Solve access permission for directory "/var/lib". Makefile from package sudo change the ownership incorrectly.

---
  meta/recipes-extended/sudo/sudo.inc |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
meta/recipes-extended/sudo/sudo.inc +0 -0
index 6a04a9c..5ea089c 100644
@@ -30,4 +30,5 @@ pkg_postinst_${PN} () {
 
Quoted 6 lines

meta/recipes-extended/sudo/sudo.inc pkg_postinst_${PN} () { · line 33

Quoted 3 lines
meta/recipes-extended/sudo/sudo.inc +1 -0
  	chmod 4111 /usr/bin/sudo
  	chmod 0440 /etc/sudoers
+	chmod 0755 /var/lib

Sorry, but this commit message is misleading. You don't change the ownership here, but the file permissions.

Hi Wolfgang Denk,
Thanks for your reply. I am make lsb test to pass LSB certification. LSB Test suite check /vat/lib, but failed with the following information.
/tset/LSB.fhs/var/lib/lib-tc 1 failed

Quoted 8 lines

Message from the test:

Reference 5.8-1(A)
The /var/lib directory exists and is searchable
Unexpected output written to stdout, as shown below:
stdout:lsb_test_dir: expected be able to search directory /var/lib, got an error stdout:ls: cannot open directory /var/lib: Permission denied

Xiaofeng,

This issue is that some other recipe or package is changing the permissions of /var/lib. If you build a minimal image, the permissions are correct. So some recipe is breaking them.

We need to investigate the cause, not just fix the problem.

Sau!

Quoted 44 lines

emenlow$ls /var/lib -l
drwx------ 10 root root 4096 May 20 19:21 lib

For general machine, the ownership of this directory is as follow:
ubuntu$ls /var/lib -l
drwxr-xr-x 67 root root 4096 2010-12-15 23:30 lib

In fact, many packages make a operation to directory "/var/lib". I find the Makefile from package "sudo" change the ownership. Please review the following patch.

Makefile 2011-05-21 16:36:47.979380106 +0800 renamed from Makefile.orj 2011-05-21 16:32:35.392833427 +0800 +1 -1
@@ -482,7 +482,7 @@
 $(DESTDIR)$(visudodir) $(DESTDIR)$(noexecdir) \
 $(DESTDIR)$(sudoersdir) $(DESTDIR)$(docdir) \
 $(DESTDIR)$(mandirsu) $(DESTDIR)$(mandirform)
- $(SHELL) $(srcdir)/mkinstalldirs -m 0700 $(DESTDIR)$(timedir)
+ $(SHELL) $(srcdir)/mkinstalldirs -m 0755 $(DESTDIR)$(timedir)
 
 install-binaries: install-dirs $(PROGS)

$(INSTALL) -b~ -O $(install_uid) -G $(install_gid) -M 04111 sudo $(DESTDIR)$(sudodir)/sudo

So "0700" make this directory without access permission. Perhaps it could not be right method, I think you have a better method to solve this problem. If you have, Please share with me.
Thanks for your suggestion again.

Thanks
Yan

Quoted 4 lines

Best regards,

Wolfgang Denk

_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky

#5 lore raw

Re: [PATCH 1/1] sudo: Modify ownership for directory "/var/lib"

In reply to Xiaofeng Yan

Dear Xiaofeng Yan,

Quoted 3 lines · In message <[email protected]> you wrote:

Thanks for your reply. I am make lsb test to pass LSB certification. LSB Test suite check /vat/lib, but failed with the following information.

I understand what you are doing.

Quoted 3 lines

So "0700" make this directory without access permission. Perhaps it could not be right method, I think you have a better method to solve this problem. If you have, Please share with me.

I'm not even trying to comment if your fix is a correct one or not.

The description of the patch (Modify ownership) does not match with code (where you do not modify the _ownership_, but the _permissions_).

From the subject I would expect to see a "chown" command, but instead I see a "chmod".

That's all I wanted to point out.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
panic: kernel trap (ignored)
#6 lore raw

Re: [PATCH 1/1] sudo: Modify ownership for directory "/var/lib"

In reply to Xiaofeng Yan
Quoted 10 lines · Xiaofeng Yan
Quoted 9 lines · Wolfgang Denk

Dear Xiaofeng Yan,

Quoted 6 lines · In message<d448b57c57fec346230d40fadc08625bd8c83224.1305972143.git.xiaofeng.yan…

From: Xiaofeng Yan<[email protected]>

[YOCTO #1092]
Solve access permission for directory "/var/lib". Makefile from package sudo change the ownership incorrectly.

Xiaofeng,

I would suggest you take a look at what nfs-utils is doing at rootfs build time. That might be the package that's causing problems.

Sau!

Quoted 75 lines
Quoted 11 lines
Quoted 11 lines
---
  meta/recipes-extended/sudo/sudo.inc |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
meta/recipes-extended/sudo/sudo.inc +0 -0
index 6a04a9c..5ea089c 100644
@@ -30,4 +30,5 @@ pkg_postinst_${PN} () {
 
Quoted 6 lines

meta/recipes-extended/sudo/sudo.inc pkg_postinst_${PN} () { · line 33

Quoted 3 lines
meta/recipes-extended/sudo/sudo.inc +1 -0
  	chmod 4111 /usr/bin/sudo
  	chmod 0440 /etc/sudoers
+	chmod 0755 /var/lib

Sorry, but this commit message is misleading. You don't change the ownership here, but the file permissions.

Hi Wolfgang Denk,
Thanks for your reply. I am make lsb test to pass LSB certification. LSB Test suite check /vat/lib, but failed with the following information.
/tset/LSB.fhs/var/lib/lib-tc 1 failed

Message from the test:

Reference 5.8-1(A)
The /var/lib directory exists and is searchable
Unexpected output written to stdout, as shown below:
stdout:lsb_test_dir: expected be able to search directory /var/lib, got an error stdout:ls: cannot open directory /var/lib: Permission denied

emenlow$ls /var/lib -l
drwx------ 10 root root 4096 May 20 19:21 lib

For general machine, the ownership of this directory is as follow:
ubuntu$ls /var/lib -l
drwxr-xr-x 67 root root 4096 2010-12-15 23:30 lib

In fact, many packages make a operation to directory "/var/lib". I find the Makefile from package "sudo" change the ownership. Please review the following patch.

Makefile 2011-05-21 16:36:47.979380106 +0800 renamed from Makefile.orj 2011-05-21 16:32:35.392833427 +0800 +1 -1
@@ -482,7 +482,7 @@
 $(DESTDIR)$(visudodir) $(DESTDIR)$(noexecdir) \
 $(DESTDIR)$(sudoersdir) $(DESTDIR)$(docdir) \
 $(DESTDIR)$(mandirsu) $(DESTDIR)$(mandirform)
- $(SHELL) $(srcdir)/mkinstalldirs -m 0700 $(DESTDIR)$(timedir)
+ $(SHELL) $(srcdir)/mkinstalldirs -m 0755 $(DESTDIR)$(timedir)
 
 install-binaries: install-dirs $(PROGS)

$(INSTALL) -b~ -O $(install_uid) -G $(install_gid) -M 04111 sudo $(DESTDIR)$(sudodir)/sudo

So "0700" make this directory without access permission. Perhaps it could not be right method, I think you have a better method to solve this problem. If you have, Please share with me.
Thanks for your suggestion again.

Thanks
Yan

Quoted 4 lines

Best regards,

Wolfgang Denk

_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky

#7 lore raw

Re: [PATCH 1/1] sudo: Modify ownership for directory "/var/lib"

Quoted 12 lines · Saul Wold
Quoted 10 lines · Xiaofeng Yan
Quoted 9 lines · Wolfgang Denk

Dear Xiaofeng Yan,

Quoted 6 lines · In message<d448b57c57fec346230d40fadc08625bd8c83224.1305972143.git.xiaofeng.yan…

From: Xiaofeng Yan<[email protected]>

[YOCTO #1092]
Solve access permission for directory "/var/lib". Makefile from package sudo change the ownership incorrectly.

Quoted 6 lines

Xiaofeng,

I would suggest you take a look at what nfs-utils is doing at rootfs build time. That might be the package that's causing problems.

Sau!

Hi Saul,

I remove package sudo from task-core-basic.bb and build a new lsb-image without sudo. After building successfully, I startup lsb image without sudo on emenlow. I check the access permission for directory "/var/lib"

root@emenlow:/# ls var/ -l
total 5
drwxr-xr-x  2 root root 1024 May 19 10:17 backups
lrwxrwxrwx  1 root root   14 May 23 20:22 cache -> volatile/cache
drwxr-xr-x 11 root root 1024 May 23 20:22 lib
drwxr-sr-x  2 root root 1024 May 19 10:17 local
lrwxrwxrwx  1 root root   13 May 23 20:22 lock -> volatile/lock
lrwxrwxrwx  1 root root   12 May 23 20:22 log -> volatile/log
drwxr-sr-x  2 root root 1024 May 19 10:17 mail
lrwxrwxrwx  1 root root   12 May 23 20:22 run -> volatile/run
drwxr-xr-x  5 root root 1024 May 23 05:54 spool
lrwxrwxrwx  1 root root   12 May 23 20:22 tmp -> volatile/tmp
drwxrwxrwt  7 root root  140 May 23 20:31 volatile

So I think package sudo change access permission for "/var/lib" finally. Also I checked file "install_solution.manifest"
.......
/media/D/poky/32/poky.e/build/tmp/deploy/rpm/core2/nfs-utils-1.2.3-r2.core2.rpm /media/D/poky/32/poky.e/build/tmp/deploy/rpm/core2/cronie-1.4.7-r2.core2.rpm /media/D/poky/32/poky.e/build/tmp/deploy/rpm/core2/gzip-1.4-r0.core2.rpm /media/D/poky/32/poky.e/build/tmp/deploy/rpm/core2/sudo-1.7.4p6-r0.core2.rpm
......
I don't know whether the packages are installed to image as the sequence or not.

Quoted 78 lines
Quoted 76 lines
Quoted 12 lines
Quoted 12 lines
---
  meta/recipes-extended/sudo/sudo.inc |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
meta/recipes-extended/sudo/sudo.inc +0 -0
index 6a04a9c..5ea089c 100644
@@ -30,4 +30,5 @@ pkg_postinst_${PN} () {
 
Quoted 6 lines

meta/recipes-extended/sudo/sudo.inc pkg_postinst_${PN} () { · line 33

Quoted 3 lines
meta/recipes-extended/sudo/sudo.inc +1 -0
      chmod 4111 /usr/bin/sudo
      chmod 0440 /etc/sudoers
+    chmod 0755 /var/lib

Sorry, but this commit message is misleading. You don't change the ownership here, but the file permissions.

Hi Wolfgang Denk,
Thanks for your reply. I am make lsb test to pass LSB certification. LSB Test suite check /vat/lib, but failed with the following information.
/tset/LSB.fhs/var/lib/lib-tc 1 failed

Message from the test:

Reference 5.8-1(A)
The /var/lib directory exists and is searchable
Unexpected output written to stdout, as shown below:
stdout:lsb_test_dir: expected be able to search directory /var/lib, got an error stdout:ls: cannot open directory /var/lib: Permission denied

emenlow$ls /var/lib -l
drwx------ 10 root root 4096 May 20 19:21 lib

For general machine, the ownership of this directory is as follow:
ubuntu$ls /var/lib -l
drwxr-xr-x 67 root root 4096 2010-12-15 23:30 lib

In fact, many packages make a operation to directory "/var/lib". I find the Makefile from package "sudo" change the ownership. Please review the following patch.

Makefile 2011-05-21 16:36:47.979380106 +0800 renamed from Makefile.orj 2011-05-21 16:32:35.392833427 +0800 +1 -1
@@ -482,7 +482,7 @@
 $(DESTDIR)$(visudodir) $(DESTDIR)$(noexecdir) \
 $(DESTDIR)$(sudoersdir) $(DESTDIR)$(docdir) \
 $(DESTDIR)$(mandirsu) $(DESTDIR)$(mandirform)
- $(SHELL) $(srcdir)/mkinstalldirs -m 0700 $(DESTDIR)$(timedir)
+ $(SHELL) $(srcdir)/mkinstalldirs -m 0755 $(DESTDIR)$(timedir)
 
 install-binaries: install-dirs $(PROGS)

$(INSTALL) -b~ -O $(install_uid) -G $(install_gid) -M 04111 sudo $(DESTDIR)$(sudodir)/sudo

So "0700" make this directory without access permission. Perhaps it could not be right method, I think you have a better method to solve this problem. If you have, Please share with me.
Thanks for your suggestion again.

Thanks
Yan

Quoted 4 lines

Best regards,

Wolfgang Denk

_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky