Rpm creates an annoying temp file that vsys saw as a new script. Fool vsys once, ...
[vsys.git] / backend.ml
index d85ee7d..6743f8c 100644 (file)
@@ -46,7 +46,7 @@ class backendHandler dir_root (frontend_lst: frontendHandler list) =
 
      (** Regular expression that defines a legal script name. Filter out
        * temporary files using this *)
-     val file_regexp = Str.regexp "[a-zA-Z][a-zA-Z0-9_\.]*"
+     val file_regexp = Str.regexp "^[a-zA-Z][a-zA-Z0-9_\.]*$"
      val acl_file_regexp = Str.regexp ".*acl$"
 
      val dir_regexp = Str.regexp "^dir_";
@@ -84,7 +84,7 @@ class backendHandler dir_root (frontend_lst: frontendHandler list) =
              with _ -> None
            in
              match next_item with
-               | None -> cur_filter
+               | None -> close_in acl_file;cur_filter
                | Some(item) -> 
                    Hashtbl.add cur_filter item true;
                    read_acl cur_filter
@@ -93,6 +93,8 @@ class backendHandler dir_root (frontend_lst: frontendHandler list) =
        with _ ->
          None
 
+     method is_acl fname = Str.string_match acl_file_regexp fname 0
+
      (** Gets called every time there's an inotify event at the backend 
        @param dirname Name of the backend directory
        @param evlist Description of what happened
@@ -107,7 +109,7 @@ class backendHandler dir_root (frontend_lst: frontendHandler list) =
              let acl_filter = this#make_filter acl_fqp in
              let slice_list = 
                match acl_filter with
-                 | None -> frontend_lst 
+                 | None -> [] (* No ACL *) 
                  | Some(filter) -> List.filter (fun fe->Hashtbl.mem filter (fe#get_slice_name ())) frontend_lst 
              in 
              let is_event = list_check evlist in
@@ -152,16 +154,18 @@ class backendHandler dir_root (frontend_lst: frontendHandler list) =
        let cont = ref true in
          while (!cont) do
            try 
-             let curfile = readdir dir_handle  in
+             let curfile = readdir dir_handle in
+               if (not (this#is_acl curfile)) then
+                 begin
              let fqp = String.concat "/" [dir;curfile] in
              let acl_fqp = String.concat "." [fqp;"acl"] in
              let acl_filter = this#make_filter acl_fqp in
              let slice_list = 
                match acl_filter with
-                 | None -> frontend_lst 
+                 | None -> [] (*frontend_lst -> No ACL => No Show *)
                  | Some(filter) -> List.filter (fun fe->Hashtbl.mem filter (fe#get_slice_name ())) frontend_lst 
              in
-               if (Str.string_match file_regexp curfile 0 && not (Str.string_match acl_file_regexp curfile 0)) then
+               if (Str.string_match file_regexp curfile 0) then
                  let s = Unix.stat fqp in
                    begin
                      match s.st_kind with
@@ -173,8 +177,9 @@ class backendHandler dir_root (frontend_lst: frontendHandler list) =
                        | _ ->
                            fprintf logfd "Don't know what to do with %s\n" curfile;flush logfd
                    end
-           with 
-               _->cont:=false;()
+                 end
+           with _
+               ->cont:=false;()
          done 
      in
        begin