mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-06-06 02:10:51 +00:00
do not append a '/' to targets when there it ends with a ':'
This commit is contained in:
parent
bbe9c5f38c
commit
d72a59e70f
|
@ -1,3 +1,7 @@
|
|||
2018-??-??: 2.2.3
|
||||
change: if the target/targetdir ands with a ':' do not append
|
||||
a trailing '/' to it, since that would change it from homedir to rootdir!
|
||||
|
||||
2017-02-16: 2.2.2
|
||||
fix: checkgauge 'insist'
|
||||
fix: no partial path exlusion tests
|
||||
|
|
|
@ -647,11 +647,13 @@ rsync.prepare = function
|
|||
end
|
||||
|
||||
-- appends a / to target if not present
|
||||
if not skipTarget and string.sub(config.target, -1) ~= '/'
|
||||
-- and not a ':' for home dir.
|
||||
if not skipTarget
|
||||
and string.sub( config.target, -1 ) ~= '/'
|
||||
and string.sub( config.target, -1 ) ~= ':'
|
||||
then
|
||||
config.target = config.target..'/'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -91,10 +91,7 @@ local replaceRsyncFilter =
|
|||
(
|
||||
path
|
||||
)
|
||||
if not path
|
||||
then
|
||||
return
|
||||
end
|
||||
if not path then return end
|
||||
|
||||
return(
|
||||
path
|
||||
|
@ -161,9 +158,7 @@ rsyncssh.action = function
|
|||
-- Replaces what rsync would consider filter rules by literals
|
||||
--
|
||||
local function sub( p )
|
||||
if not p then
|
||||
return
|
||||
end
|
||||
if not p then return end
|
||||
|
||||
return p:
|
||||
gsub( '%?', '\\?' ):
|
||||
|
@ -195,11 +190,7 @@ rsyncssh.action = function
|
|||
|
||||
-- adds one path to the filter
|
||||
local function addToFilter( path )
|
||||
|
||||
if filterP[ path ]
|
||||
then
|
||||
return
|
||||
end
|
||||
if filterP[ path ] then return end
|
||||
|
||||
filterP[ path ] = true
|
||||
|
||||
|
@ -453,18 +444,12 @@ rsyncssh.prepare = function
|
|||
|
||||
if not config.host
|
||||
then
|
||||
error(
|
||||
'default.rsyncssh needs "host" configured',
|
||||
level
|
||||
)
|
||||
error( 'default.rsyncssh needs "host" configured', level )
|
||||
end
|
||||
|
||||
if not config.targetdir
|
||||
then
|
||||
error(
|
||||
'default.rsyncssh needs "targetdir" configured',
|
||||
level
|
||||
)
|
||||
error( 'default.rsyncssh needs "targetdir" configured', level )
|
||||
end
|
||||
|
||||
--
|
||||
|
@ -472,18 +457,12 @@ rsyncssh.prepare = function
|
|||
--
|
||||
if config.ssh._computed
|
||||
then
|
||||
error(
|
||||
'please do not use the internal rsync._computed parameter',
|
||||
level
|
||||
)
|
||||
error( 'please do not use the internal rsync._computed parameter', level )
|
||||
end
|
||||
|
||||
if config.maxProcesses ~= 1
|
||||
then
|
||||
error(
|
||||
'default.rsyncssh must have maxProcesses set to 1.',
|
||||
level
|
||||
)
|
||||
error( 'default.rsyncssh must have maxProcesses set to 1.', level )
|
||||
end
|
||||
|
||||
local cssh = config.ssh;
|
||||
|
@ -578,10 +557,11 @@ rsyncssh.prepare = function
|
|||
end
|
||||
|
||||
-- appends a slash to the targetdir if missing
|
||||
-- and is not ':' for home dir
|
||||
if string.sub( config.targetdir, -1 ) ~= '/'
|
||||
and string.sub( config.targetdir, -1 ) ~= ':'
|
||||
then
|
||||
config.targetdir =
|
||||
config.targetdir .. '/'
|
||||
config.targetdir = config.targetdir .. '/'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
2
lsyncd.h
2
lsyncd.h
|
@ -12,7 +12,7 @@
|
|||
#define LSYNCD_H
|
||||
|
||||
// some older machines need this to see pselect
|
||||
#define _BSD_SOURCE 1
|
||||
#define _DEFAULT_SOURCE 1
|
||||
#define _XOPEN_SOURCE 700
|
||||
#define _DARWIN_C_SOURCE 1
|
||||
|
||||
|
|
53
lsyncd.lua
53
lsyncd.lua
|
@ -550,7 +550,6 @@ Queue = ( function
|
|||
return iterReverse, self, self[ k_nt ].last + 1
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Creates a new queue.
|
||||
--
|
||||
|
@ -1582,10 +1581,7 @@ local InletFactory = ( function
|
|||
|
||||
if delay.etype ~= 'Move'
|
||||
then
|
||||
if eu
|
||||
then
|
||||
return eu
|
||||
end
|
||||
if eu then return eu end
|
||||
|
||||
local event = { }
|
||||
|
||||
|
@ -1598,10 +1594,7 @@ local InletFactory = ( function
|
|||
return event
|
||||
else
|
||||
-- moves have 2 events - origin and destination
|
||||
if eu
|
||||
then
|
||||
return eu[1], eu[2]
|
||||
end
|
||||
if eu then return eu[1], eu[2] end
|
||||
|
||||
local event = { move = 'Fr' }
|
||||
local event2 = { move = 'To' }
|
||||
|
@ -1628,10 +1621,7 @@ local InletFactory = ( function
|
|||
)
|
||||
local eu = e2d2[ dlist ]
|
||||
|
||||
if eu
|
||||
then
|
||||
return eu
|
||||
end
|
||||
if eu then return eu end
|
||||
|
||||
local elist = { }
|
||||
|
||||
|
@ -1773,10 +1763,7 @@ local InletFactory = ( function
|
|||
|
||||
if not f
|
||||
then
|
||||
error(
|
||||
'inlet does not have function "'..func..'"',
|
||||
2
|
||||
)
|
||||
error( 'inlet does not have function "'..func..'"', 2 )
|
||||
end
|
||||
|
||||
return function( ... )
|
||||
|
@ -1837,7 +1824,7 @@ end )( )
|
|||
|
||||
|
||||
--
|
||||
-- A set of exclude patterns
|
||||
-- A set of exclude patterns.
|
||||
--
|
||||
local Excludes = ( function( )
|
||||
|
||||
|
@ -1850,6 +1837,7 @@ local Excludes = ( function( )
|
|||
p -- the rsync like pattern
|
||||
)
|
||||
local o = p
|
||||
|
||||
p = string.gsub( p, '%%', '%%%%' )
|
||||
p = string.gsub( p, '%^', '%%^' )
|
||||
p = string.gsub( p, '%$', '%%$' )
|
||||
|
@ -1873,11 +1861,7 @@ local Excludes = ( function( )
|
|||
p = '/' .. p;
|
||||
end
|
||||
|
||||
log(
|
||||
'Exclude',
|
||||
'toLuaPattern "',
|
||||
o, '" = "', p, '"'
|
||||
)
|
||||
log( 'Exclude', 'toLuaPattern "', o, '" = "', p, '"' )
|
||||
|
||||
return p
|
||||
end
|
||||
|
@ -1908,7 +1892,6 @@ local Excludes = ( function( )
|
|||
self, -- self
|
||||
pattern -- the pattern to remove
|
||||
)
|
||||
|
||||
if not self.list[ pattern ]
|
||||
then -- already in the list?
|
||||
log(
|
||||
|
@ -1948,11 +1931,7 @@ local Excludes = ( function( )
|
|||
|
||||
if not f
|
||||
then
|
||||
log(
|
||||
'Error',
|
||||
'Cannot open exclude file "', file,'": ',
|
||||
err
|
||||
)
|
||||
log( 'Error', 'Cannot open exclude file "', file,'": ', err )
|
||||
|
||||
terminate( -1 )
|
||||
end
|
||||
|
@ -2281,10 +2260,7 @@ local Sync = ( function
|
|||
do
|
||||
local pd = path .. dirname
|
||||
|
||||
if isdir
|
||||
then
|
||||
pd = pd..'/'
|
||||
end
|
||||
if isdir then pd = pd..'/' end
|
||||
|
||||
log(
|
||||
'Delay',
|
||||
|
@ -3082,13 +3058,16 @@ local Syncs = ( function
|
|||
config.prepare( config, 4 )
|
||||
end
|
||||
|
||||
if not config[ 'source' ] then
|
||||
if not config[ 'source' ]
|
||||
then
|
||||
local info = debug.getinfo( 3, 'Sl' )
|
||||
|
||||
log(
|
||||
'Error',
|
||||
info.short_src,':',
|
||||
info.currentline,': source missing from sync.'
|
||||
)
|
||||
|
||||
terminate( -1 )
|
||||
end
|
||||
|
||||
|
@ -3104,6 +3083,7 @@ local Syncs = ( function
|
|||
'Cannot access source directory: ',
|
||||
config.source
|
||||
)
|
||||
|
||||
terminate( -1 )
|
||||
end
|
||||
|
||||
|
@ -3118,6 +3098,7 @@ local Syncs = ( function
|
|||
and not config.onMove
|
||||
then
|
||||
local info = debug.getinfo( 3, 'Sl' )
|
||||
|
||||
log(
|
||||
'Error',
|
||||
info.short_src, ':',
|
||||
|
@ -3553,14 +3534,12 @@ end)( )
|
|||
--
|
||||
local Fsevents = ( function
|
||||
( )
|
||||
|
||||
--
|
||||
-- A list indexed by syncs yielding
|
||||
-- the root path the sync is interested in.
|
||||
--
|
||||
local syncRoots = { }
|
||||
|
||||
|
||||
--
|
||||
-- Adds a Sync to receive events.
|
||||
--
|
||||
|
@ -4036,8 +4015,6 @@ end )( )
|
|||
--
|
||||
local StatusFile = ( function
|
||||
( )
|
||||
|
||||
|
||||
--
|
||||
-- Timestamp when the status file has been written.
|
||||
--
|
||||
|
|
Loading…
Reference in New Issue
Block a user