[Rpm-maint] [Suse patch] Deal with bad lines in --setperms and --setugids.

Panu Matilainen pmatilai at redhat.com
Tue May 22 07:45:55 UTC 2007


Without the patch you'll get silly errors like this:
[root at dhcp115 ~]# rpm --setperms doesntexist
sh: line 1: package: command not found

Already applied.

 	- Panu -

---

Deal with bad lines in --setperms and --setugids. Happens for example if
a package is not installed (--pipe also captures stderr). [#52122]

--- ./rpmpopt.in.orig	2005-02-16 19:05:36.000000000 +0000
+++ ./rpmpopt.in	2006-03-21 17:58:43.000000000 +0000
@@ -37,12 +37,12 @@ rpm	alias --scripts --qf '\
  	--POPTdesc=$"list install/erase scriptlets from package(s)"

  rpm	alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] || chmod %7.7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \
-		   --pipe "grep -v \(none\) | sed 's/chmod .../chmod /' | sh" \
+		   --pipe "grep -v \(none\) | grep '^. -L ' | sed 's/chmod .../chmod /' | sh" \
  	--POPTdesc=$"set permissions of files in a package"

  rpm	alias --setugids -q --qf \
          '[ch %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape} %{FILENAMES:shescape}\n]' \
-        --pipe "(echo 'ch() { chown -- \"$1\" \"$3\";chgrp -- \"$2\" \"$3\"; }';grep -v \(none\))|sh" \
+        --pipe "(echo 'ch() { chown -h -- \"$1\" \"$3\";chgrp -h -- \"$2\" \"$3\"; }';grep '^ch '|grep -v \(none\))|sh" \
  	--POPTdesc=$"set user/group ownership of files in a package"

  rpm	alias --conflicts	--qf \



More information about the Rpm-maint mailing list