diff --git a/default-rsync.lua b/default-rsync.lua index 3119142..bc3a202 100644 --- a/default-rsync.lua +++ b/default-rsync.lua @@ -59,7 +59,7 @@ rsync.checkgauge = { cvs_exclude = true, dry_run = true, executability = true, - group = true, + group = true, hard_links = true, ignore_times = true, ipv4 = true, @@ -78,10 +78,10 @@ rsync.checkgauge = { sparse = true, temp_dir = true, timeout = true, - times = true, + times = true, update = true, verbose = true, - whole_file = true, + whole_file = true, xattrs = true, _extra = true, }, @@ -299,9 +299,7 @@ rsync.prepare = function( skipTarget -- used by rsyncssh, do not check for target ) - -- -- First let default.prepare test the checkgauge - -- default.prepare( config, level + 6 ) if not skipTarget and not config.target then @@ -364,14 +362,10 @@ rsync.prepare = function( ) end - -- -- computes the rsync arguments into one list - -- local crsync = config.rsync; - -- -- everything implied by archive = true - -- local archiveFlags = { recursive = true, links = true, @@ -386,9 +380,7 @@ rsync.prepare = function( xattrs = false, } - -- - -- if archive given the implications are filled in - -- + -- if archive is given the implications are filled in if crsync.archive then for k, v in pairs( archiveFlags ) do if crsync[ k ] == nil then @@ -410,7 +402,7 @@ rsync.prepare = function( cvs_exclude = 'C', dry_run = 'n', executability = 'E', - group = 'g', + group = 'g', hard_links = 'H', ignore_times = 'I', ipv4 = '4', @@ -424,10 +416,10 @@ rsync.prepare = function( prune_empty_dirs = 'm', quiet = 'q', sparse = 'S', - times = 't', + times = 't', update = 'u', verbose = 'v', - whole_file = 'W', + whole_file = 'W', xattrs = 'X', } diff --git a/lsyncd.c b/lsyncd.c index 1bb0596..676b9ec 100644 --- a/lsyncd.c +++ b/lsyncd.c @@ -2085,12 +2085,15 @@ masterloop(lua_State *L) // queries the runner about the soonest alarm // load_runner_func( L, "getAlarm" ); + if( lua_pcall( L, 0, 1, -2 ) ) - { exit( -1 ); } + { + exit( -1 ); + } if( lua_type( L, -1 ) == LUA_TBOOLEAN) { - have_alarm = false; + have_alarm = false; force_alarm = lua_toboolean( L, -1 ); } else @@ -2098,6 +2101,7 @@ masterloop(lua_State *L) have_alarm = true; alarm_time = *( ( clock_t * ) luaL_checkudata( L, -1, "Lsyncd.jiffies" ) ); } + lua_pop( L, 2 ); if( @@ -2200,6 +2204,7 @@ masterloop(lua_State *L) { // walks through the observances calling ready/writey observance_action = true; + for( pi = 0; pi < observances_len; pi++ ) { struct observance *obs = observances + pi; @@ -2339,6 +2344,7 @@ masterloop(lua_State *L) /* | The effective main for one run. +| | HUP signals may cause several runs of the one main. */ int diff --git a/lsyncd.lua b/lsyncd.lua index fb87772..c0e1a3d 100644 --- a/lsyncd.lua +++ b/lsyncd.lua @@ -1454,7 +1454,7 @@ local Excludes = ( function( ) end )( ) -- --- Holds information about one observed directory inclusively subdirs. +-- Holds information about one observed directory including subdirs. -- local Sync = ( function( ) @@ -1486,6 +1486,7 @@ local Sync = ( function( ) -- Removes a delay. -- local function removeDelay( self, delay ) + if self.delays[ delay.dpos ] ~= delay then error( 'Queue is broken, delay not a dpos' ) end @@ -1494,9 +1495,13 @@ local Sync = ( function( ) -- free all delays blocked by this one. if delay.blocks then + for i, vd in pairs( delay.blocks ) do + vd.status = 'wait' + end + end end @@ -1507,18 +1512,25 @@ local Sync = ( function( ) -- not concerned if watch rootdir doesnt match if not path:starts( self.source ) then + return false + end -- a sub dir and not concerned about subdirs if self.config.subdirs == false and + path:sub( #self.source, -1 ):match( '[^/]+/?' ) + then + return false + end -- concerned if not excluded return not self.excludes:test( path:sub( #self.source ) ) + end -- @@ -1640,6 +1652,7 @@ local Sync = ( function( ) end table.insert( oldDelay.blocks, newDelay ) + end -- @@ -1661,6 +1674,7 @@ local Sync = ( function( ) local function recurse( ) if etype == 'Create' and path:byte( -1 ) == 47 then + local entries = lsyncd.readdir( self.source .. path ) if entries then @@ -2062,6 +2076,7 @@ local Sync = ( function( ) -- Creates a new Sync -- local function new( config ) + local s = { -- fields @@ -2111,6 +2126,7 @@ local Sync = ( function( ) else error( 'type for exclude must be table or string', 2 ) end + end if @@ -2124,7 +2140,9 @@ local Sync = ( function( ) end if config.excludeFrom then + s.excludes:loadFile( config.excludeFrom ) + end return s @@ -2133,7 +2151,9 @@ local Sync = ( function( ) -- -- Public interface -- - return { new = new } + return { + new = new + } end )( )