]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
run-parts: handle patterns like we did in pld trunk
authorElan Ruusamäe <glen@pld-linux.org>
Sat, 26 Oct 2013 20:15:53 +0000 (20:15 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Sat, 26 Oct 2013 20:15:53 +0000 (20:15 +0000)
svn-id: @12727

man/run-parts.8
src/run-parts.c

index 3b5d4a894d529d9482d5db3d41bcc3518e4e70c8..7e762a2ce50107ea7862ad6c2aebc2b4443efd4d 100644 (file)
@@ -30,7 +30,7 @@ then the names must consist entirely of ASCII upper- and lower-case
 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]+$);
index a4f0c65a82a0a9a404d46b954e293158e93480a3..89b7d1c68cbf40878027203c21ec44df388a51c4 100644 (file)
@@ -157,8 +157,11 @@ int valid_name(const struct dirent *d)
        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 @@ regex_compile_pattern (void)
                     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 @@ regex_compile_pattern (void)
                     != 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 @@ regex_clean(void)
         regfree(&excsre);
         regfree(&tradre);
 
-    } else
+    } else {
         regfree(&classicalre);
+        regfree(&excsre);
+       }
 }
This page took 0.320064 seconds and 4 git commands to generate.