summaryrefslogtreecommitdiffstats
path: root/aconf/persistence
diff options
context:
space:
mode:
Diffstat (limited to 'aconf/persistence')
-rw-r--r--aconf/persistence/backends/augeas.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/aconf/persistence/backends/augeas.lua b/aconf/persistence/backends/augeas.lua
index eb954e8..b3bcd2c 100644
--- a/aconf/persistence/backends/augeas.lua
+++ b/aconf/persistence/backends/augeas.lua
@@ -1,5 +1,5 @@
--[[
-Copyright (c) 2012-2015 Kaarle Ritvanen
+Copyright (c) 2012-2019 Kaarle Ritvanen
See LICENSE file for license details
--]]
@@ -236,10 +236,16 @@ function backend:set(mods)
local ord = order(path)
for _, sibling in ipairs(matches) do
- local sord = order(array_join(parent, basename(sibling)))
- if sord and sord > ord then
- self.aug:insert(sibling, name, true)
- return apath, keys
+ local sname = basename(sibling)
+ local sord = order(array_join(parent, sname))
+ if sord then
+ local snum = tonumber(sname)
+ if sord > ord or (
+ sord == ord and snum and type(name) == 'number' and snum > name
+ ) then
+ self.aug:insert(sibling, name, true)
+ return apath, keys
+ end
end
end
end