SVN: rc-scripts/trunk: man/run-parts.8 src/run-parts.c

glen glen at pld-linux.org
Sat Oct 26 22:15:54 CEST 2013


Author: glen
Date: Sat Oct 26 22:15:53 2013
New Revision: 12727

Modified:
   rc-scripts/trunk/man/run-parts.8
   rc-scripts/trunk/src/run-parts.c
Log:
run-parts: handle patterns like we did in pld


Modified: rc-scripts/trunk/man/run-parts.8
==============================================================================
--- rc-scripts/trunk/man/run-parts.8	(original)
+++ rc-scripts/trunk/man/run-parts.8	Sat Oct 26 22:15:53 2013
@@ -30,7 +30,7 @@
 letters, ASCII digits, ASCII underscores, and ASCII minus-hyphens.
 
 If the \-\-lsbsysinit option is given, then the names must not end
-in .dpkg\-old  or .dpkg\-dist or .dpkg\-new or .dpkg\-tmp, and must
+in rpm backups (.rpmsave, .rpmnew, .rpmorig), and must
 belong to one or more of the following namespaces: the
 LANANA-assigned namespace (^[a\-z0\-9]+$); the LSB hierarchical and
 reserved namespaces (^_?([a\-z0\-9_.]+\-)+[a\-z0\-9]+$);

Modified: rc-scripts/trunk/src/run-parts.c
==============================================================================
--- rc-scripts/trunk/src/run-parts.c	(original)
+++ rc-scripts/trunk/src/run-parts.c	Sat Oct 26 22:15:53 2013
@@ -157,8 +157,11 @@
 	else
             retval = !regexec(&tradre, s, 0, NULL, 0);
 
-    } else
-        retval = !regexec(&classicalre, s, 0, NULL, 0);
+    } else {
+        if (!regexec(&classicalre, s, 0, NULL, 0)) {
+            retval = regexec(&excsre, s, 0, NULL, 0);
+		}
+	}
 
     return retval;
 }
@@ -579,7 +582,7 @@
                     REG_EXTENDED | REG_NOSUB)) != 0)
             pt_regex = &hierre;
 
-        else if ( (err = regcomp(&excsre, "^[a-z0-9-].*dpkg-(old|dist|new|tmp)$",
+        else if ( (err = regcomp(&excsre, "^[a-z0-9-].*(\.rpm(save|new|orig)|~|,v)$",
                     REG_EXTENDED | REG_NOSUB)) != 0)
             pt_regex = &excsre;
 
@@ -587,9 +590,12 @@
                     != 0)
             pt_regex = &tradre;
 
-    } else if ( (err = regcomp(&classicalre, "^[a-zA-Z0-9_-]+$",
+    } else if ( (err = regcomp(&classicalre, "^.+$",
+                    REG_EXTENDED | REG_NOSUB)) != 0)
+			pt_regex = &classicalre;
+        else if ( (err = regcomp(&excsre, "^[.]|(\.rpm(save|new|orig)|~|,v)$",
                     REG_EXTENDED | REG_NOSUB)) != 0)
-        pt_regex = &classicalre;
+            pt_regex = &excsre;
 
     if (err != 0) {
         fprintf(stderr, "Unable to build regexp: %s", \
@@ -642,6 +648,8 @@
         regfree(&excsre);
         regfree(&tradre);
 
-    } else
+    } else {
         regfree(&classicalre);
+        regfree(&excsre);
+	}
 }


More information about the pld-cvs-commit mailing list