do not append a '/' to targets when there it ends with a ':'

This commit is contained in:
Axel Kittenberger 2018-02-27 10:09:28 +01:00
parent bbe9c5f38c
commit d72a59e70f
5 changed files with 50 additions and 87 deletions

View File

@ -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 2017-02-16: 2.2.2
fix: checkgauge 'insist' fix: checkgauge 'insist'
fix: no partial path exlusion tests fix: no partial path exlusion tests

View File

@ -647,11 +647,13 @@ rsync.prepare = function
end end
-- appends a / to target if not present -- 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 then
config.target = config.target..'/' config.target = config.target..'/'
end end
end end

View File

@ -91,10 +91,7 @@ local replaceRsyncFilter =
( (
path path
) )
if not path if not path then return end
then
return
end
return( return(
path path
@ -161,9 +158,7 @@ rsyncssh.action = function
-- Replaces what rsync would consider filter rules by literals -- Replaces what rsync would consider filter rules by literals
-- --
local function sub( p ) local function sub( p )
if not p then if not p then return end
return
end
return p: return p:
gsub( '%?', '\\?' ): gsub( '%?', '\\?' ):
@ -195,11 +190,7 @@ rsyncssh.action = function
-- adds one path to the filter -- adds one path to the filter
local function addToFilter( path ) local function addToFilter( path )
if filterP[ path ] then return end
if filterP[ path ]
then
return
end
filterP[ path ] = true filterP[ path ] = true
@ -453,18 +444,12 @@ rsyncssh.prepare = function
if not config.host if not config.host
then then
error( error( 'default.rsyncssh needs "host" configured', level )
'default.rsyncssh needs "host" configured',
level
)
end end
if not config.targetdir if not config.targetdir
then then
error( error( 'default.rsyncssh needs "targetdir" configured', level )
'default.rsyncssh needs "targetdir" configured',
level
)
end end
-- --
@ -472,18 +457,12 @@ rsyncssh.prepare = function
-- --
if config.ssh._computed if config.ssh._computed
then then
error( error( 'please do not use the internal rsync._computed parameter', level )
'please do not use the internal rsync._computed parameter',
level
)
end end
if config.maxProcesses ~= 1 if config.maxProcesses ~= 1
then then
error( error( 'default.rsyncssh must have maxProcesses set to 1.', level )
'default.rsyncssh must have maxProcesses set to 1.',
level
)
end end
local cssh = config.ssh; local cssh = config.ssh;
@ -578,10 +557,11 @@ rsyncssh.prepare = function
end end
-- appends a slash to the targetdir if missing -- appends a slash to the targetdir if missing
-- and is not ':' for home dir
if string.sub( config.targetdir, -1 ) ~= '/' if string.sub( config.targetdir, -1 ) ~= '/'
and string.sub( config.targetdir, -1 ) ~= ':'
then then
config.targetdir = config.targetdir = config.targetdir .. '/'
config.targetdir .. '/'
end end
end end

View File

@ -12,7 +12,7 @@
#define LSYNCD_H #define LSYNCD_H
// some older machines need this to see pselect // some older machines need this to see pselect
#define _BSD_SOURCE 1 #define _DEFAULT_SOURCE 1
#define _XOPEN_SOURCE 700 #define _XOPEN_SOURCE 700
#define _DARWIN_C_SOURCE 1 #define _DARWIN_C_SOURCE 1

View File

@ -550,7 +550,6 @@ Queue = ( function
return iterReverse, self, self[ k_nt ].last + 1 return iterReverse, self, self[ k_nt ].last + 1
end end
-- --
-- Creates a new queue. -- Creates a new queue.
-- --
@ -1582,10 +1581,7 @@ local InletFactory = ( function
if delay.etype ~= 'Move' if delay.etype ~= 'Move'
then then
if eu if eu then return eu end
then
return eu
end
local event = { } local event = { }
@ -1598,10 +1594,7 @@ local InletFactory = ( function
return event return event
else else
-- moves have 2 events - origin and destination -- moves have 2 events - origin and destination
if eu if eu then return eu[1], eu[2] end
then
return eu[1], eu[2]
end
local event = { move = 'Fr' } local event = { move = 'Fr' }
local event2 = { move = 'To' } local event2 = { move = 'To' }
@ -1628,10 +1621,7 @@ local InletFactory = ( function
) )
local eu = e2d2[ dlist ] local eu = e2d2[ dlist ]
if eu if eu then return eu end
then
return eu
end
local elist = { } local elist = { }
@ -1773,10 +1763,7 @@ local InletFactory = ( function
if not f if not f
then then
error( error( 'inlet does not have function "'..func..'"', 2 )
'inlet does not have function "'..func..'"',
2
)
end end
return function( ... ) return function( ... )
@ -1837,7 +1824,7 @@ end )( )
-- --
-- A set of exclude patterns -- A set of exclude patterns.
-- --
local Excludes = ( function( ) local Excludes = ( function( )
@ -1850,6 +1837,7 @@ local Excludes = ( function( )
p -- the rsync like pattern p -- the rsync like pattern
) )
local o = p local o = p
p = string.gsub( p, '%%', '%%%%' ) p = string.gsub( p, '%%', '%%%%' )
p = string.gsub( p, '%^', '%%^' ) p = string.gsub( p, '%^', '%%^' )
p = string.gsub( p, '%$', '%%$' ) p = string.gsub( p, '%$', '%%$' )
@ -1873,11 +1861,7 @@ local Excludes = ( function( )
p = '/' .. p; p = '/' .. p;
end end
log( log( 'Exclude', 'toLuaPattern "', o, '" = "', p, '"' )
'Exclude',
'toLuaPattern "',
o, '" = "', p, '"'
)
return p return p
end end
@ -1908,7 +1892,6 @@ local Excludes = ( function( )
self, -- self self, -- self
pattern -- the pattern to remove pattern -- the pattern to remove
) )
if not self.list[ pattern ] if not self.list[ pattern ]
then -- already in the list? then -- already in the list?
log( log(
@ -1948,11 +1931,7 @@ local Excludes = ( function( )
if not f if not f
then then
log( log( 'Error', 'Cannot open exclude file "', file,'": ', err )
'Error',
'Cannot open exclude file "', file,'": ',
err
)
terminate( -1 ) terminate( -1 )
end end
@ -2281,10 +2260,7 @@ local Sync = ( function
do do
local pd = path .. dirname local pd = path .. dirname
if isdir if isdir then pd = pd..'/' end
then
pd = pd..'/'
end
log( log(
'Delay', 'Delay',
@ -3082,13 +3058,16 @@ local Syncs = ( function
config.prepare( config, 4 ) config.prepare( config, 4 )
end end
if not config[ 'source' ] then if not config[ 'source' ]
then
local info = debug.getinfo( 3, 'Sl' ) local info = debug.getinfo( 3, 'Sl' )
log( log(
'Error', 'Error',
info.short_src,':', info.short_src,':',
info.currentline,': source missing from sync.' info.currentline,': source missing from sync.'
) )
terminate( -1 ) terminate( -1 )
end end
@ -3104,6 +3083,7 @@ local Syncs = ( function
'Cannot access source directory: ', 'Cannot access source directory: ',
config.source config.source
) )
terminate( -1 ) terminate( -1 )
end end
@ -3118,6 +3098,7 @@ local Syncs = ( function
and not config.onMove and not config.onMove
then then
local info = debug.getinfo( 3, 'Sl' ) local info = debug.getinfo( 3, 'Sl' )
log( log(
'Error', 'Error',
info.short_src, ':', info.short_src, ':',
@ -3553,14 +3534,12 @@ end)( )
-- --
local Fsevents = ( function local Fsevents = ( function
( ) ( )
-- --
-- A list indexed by syncs yielding -- A list indexed by syncs yielding
-- the root path the sync is interested in. -- the root path the sync is interested in.
-- --
local syncRoots = { } local syncRoots = { }
-- --
-- Adds a Sync to receive events. -- Adds a Sync to receive events.
-- --
@ -4036,8 +4015,6 @@ end )( )
-- --
local StatusFile = ( function local StatusFile = ( function
( ) ( )
-- --
-- Timestamp when the status file has been written. -- Timestamp when the status file has been written.
-- --