Yousong Zhou [Thu, 9 Apr 2015 13:48:47 +0000 (21:48 +0800)]
file: reset parsing position on starting over a newline.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Thu, 9 Apr 2015 13:48:46 +0000 (21:48 +0800)]
tests: add test coverage for comment lines within batch commands.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Wed, 1 Apr 2015 12:44:23 +0000 (20:44 +0800)]
delta: fix adding new savedir.
Newly added savedir should be at the last position while
uci_add_delta_path() will add it to the position second to the last.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Wed, 1 Apr 2015 12:44:22 +0000 (20:44 +0800)]
tests: add test coverage for uci export with -P option.
- With "uci -P xxx/ export", changes in "xxx/" should be applied last.
- With "uci -p xxx/ commit", changes in "xxx/" should be applied before
ctx->savedir.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 31 Mar 2015 16:20:18 +0000 (00:20 +0800)]
Fix delta path handling.
- Make ctx->savedir sit at the end of ctx->delta_path.
- Add notes to uci_set_savedir() and uci_add_delta_path() to document
the behaviour changes.
Yousong Zhou [Tue, 31 Mar 2015 16:20:17 +0000 (00:20 +0800)]
tests: add test cases for -P and -p options.
Yousong Zhou [Wed, 18 Mar 2015 04:44:45 +0000 (12:44 +0800)]
lua: restore return value of require('uci') to module table.
Before commit "b121dd lua: add lua 5.2 compatibility changes", the
module table was filled by luaL_register() which would leave the table
at the top of the stack. But in current code the module table will be
popped by lua_setglobal() causing the return value defaulting to boolean
value true.
Also fix the return value of luaopen_uci() to 1 to indicate the number
of return value on stack.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Wed, 18 Mar 2015 04:44:44 +0000 (12:44 +0800)]
cli: fix return value of package_cmd().
It's a bug revealed by commit
446e774 "cli: properly unload package
before quit". The current code would exit with value 1 even if
uci_export() succceeded.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Wed, 18 Mar 2015 04:44:43 +0000 (12:44 +0800)]
testenv: test for exit status of "uci export".
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Sat, 24 Jan 2015 15:07:53 +0000 (23:07 +0800)]
Add a few notes on the return value of uci_lookup_ptr().
While at it, use UCI_OK instead of literal integer 0 for return value of
uci_lookup_ptr().
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Sat, 24 Jan 2015 15:07:52 +0000 (23:07 +0800)]
cli: enhance "uci show" command on nonexistent sections and options.
When doing "uci show network.nilsection", the current behaviour is that
uci will emit a error message complaining "Entry not found", then
continue to show all content of the package network itself. This is
couter-intuition.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Sat, 24 Jan 2015 15:07:51 +0000 (23:07 +0800)]
cli: properly unload package before quit.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Sat, 24 Jan 2015 15:07:50 +0000 (23:07 +0800)]
tests: add test cases for showing nonexistent section and option.
Also fix the false error message about absence of uci-static.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Felix Fietkau [Thu, 18 Dec 2014 15:49:16 +0000 (16:49 +0100)]
lua: add lua 5.2 compatibility changes
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 18 Dec 2014 14:19:47 +0000 (15:19 +0100)]
allow "-" in package names
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Yousong Zhou [Tue, 16 Dec 2014 07:00:17 +0000 (15:00 +0800)]
delta: fix outputing of delta entries occupying multiple lines.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:16 +0000 (15:00 +0800)]
delta: use a table for converting between UCI_CMD_XXX and prefixes.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:15 +0000 (15:00 +0800)]
delta: preprocess delta line with uci_parse_argument().
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:14 +0000 (15:00 +0800)]
delta: add a simple duplication check when adding delta path.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:13 +0000 (15:00 +0800)]
cli: fix printing option values occupying multiple lines.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:12 +0000 (15:00 +0800)]
tests: add test coverage for uci list related commands.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:11 +0000 (15:00 +0800)]
tests: add test coverage for `uci revert' command.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:10 +0000 (15:00 +0800)]
tests: add test coverage for `uci batch' command.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:09 +0000 (15:00 +0800)]
tests: add more test coverage for `uci show' command.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:08 +0000 (15:00 +0800)]
tests: remove straying echo in 020_get.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:07 +0000 (15:00 +0800)]
file: fix error string about "unterminated XXX".
- Remove unreachable call to uci_parse_error().
- Fix false claim of unterminated double quote to single quote.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:06 +0000 (15:00 +0800)]
file: fix EOF check.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:05 +0000 (15:00 +0800)]
file: fix use-after-free bug.
Currently, it's possible that pointers returned by next_arg() could be
invalidated by another call to next_arg() due to uci_realloc().
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:04 +0000 (15:00 +0800)]
Fix memory leaks found by using valgrind on test cases.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Tue, 16 Dec 2014 07:00:03 +0000 (15:00 +0800)]
Fix a few style issues.
- Remove deprecated uci-static and ucimap-example from .gitignore.
- Minor code formatting fix.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Felix Fietkau [Tue, 25 Nov 2014 10:54:09 +0000 (11:54 +0100)]
fix a few formatting issues
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 25 Nov 2014 10:50:25 +0000 (11:50 +0100)]
tests: use uci instead of uci-static
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Yousong Zhou [Thu, 6 Nov 2014 20:21:48 +0000 (04:21 +0800)]
Add test coverage for multi-line option value.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Thu, 6 Nov 2014 20:21:47 +0000 (04:21 +0800)]
Use offset into parser buffer to avoid potential heap overflow.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Thu, 6 Nov 2014 20:21:46 +0000 (04:21 +0800)]
Sync ref test result with current implementation.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Yousong Zhou [Thu, 6 Nov 2014 20:21:45 +0000 (04:21 +0800)]
Drop test cases for deprecated ucimap-example.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Jo-Philipp Wich [Fri, 11 Apr 2014 16:02:51 +0000 (18:02 +0200)]
Preserve original permissions when rewriting config files on commit
Patch provided by Patrick Grimm <patrick@lunatiki.de>
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Yegor Yefremov [Sun, 6 Apr 2014 19:41:32 +0000 (21:41 +0200)]
uci: fix Lua finding
If ${LUAPATH} is not quoted and Lua is not provided, then following
error occurs:
"NOT" "No such file or directory" "EQUAL" "0" "OR" "EQUAL" ""
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Alexander Couzens [Wed, 19 Mar 2014 12:50:01 +0000 (13:50 +0100)]
fix `uci import` with not yet existing packages
uci_file_commit() tries to open and lock a package file (e.g.
/etc/config/system)
before writing into. When the package file doesn't exist, uci fails with
'Entry not found'.
Steven Barth [Tue, 18 Feb 2014 09:15:49 +0000 (10:15 +0100)]
blob: add support for u64
John Crispin [Mon, 17 Feb 2014 12:15:17 +0000 (12:15 +0000)]
uci_blob: add an element to uci_blob_param_list to allow the tracking of validation info
Signed-off-by: John Crispin <blogic@openwrt.org>
Felix Fietkau [Mon, 2 Dec 2013 10:11:21 +0000 (11:11 +0100)]
blob: use BLOBMSG_TYPE_STRING as a fallback type for arrays if no type was specified
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 2 Dec 2013 07:36:33 +0000 (08:36 +0100)]
remove ucimap-example, as ucimap is deprecated
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 4 Nov 2013 15:43:49 +0000 (16:43 +0100)]
blob: allow values to be added to blobmsg using multiple different types, but suppress duplicates
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 29 Oct 2013 15:50:47 +0000 (16:50 +0100)]
ucimap: get rid of duplicate initialization warnings
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 29 Oct 2013 15:48:23 +0000 (16:48 +0100)]
parse: remove a check that is always true (due to unsigned data type)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 24 Oct 2013 21:25:02 +0000 (23:25 +0200)]
file: add missing return code check for mktemp()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 24 Oct 2013 21:24:32 +0000 (23:24 +0200)]
file: fix memleak on mktemp() errors
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Luka Perkov [Tue, 15 Oct 2013 10:57:14 +0000 (12:57 +0200)]
style: fix whitespace errors
Signed-off-by: Luka Perkov <luka@openwrt.org>
Luka Perkov [Tue, 15 Oct 2013 10:44:19 +0000 (12:44 +0200)]
style: free(NULL) is perfectly valid so we can drop some checks
Signed-off-by: Luka Perkov <luka@openwrt.org>
Luka Perkov [Thu, 10 Oct 2013 14:48:07 +0000 (16:48 +0200)]
file: make uci commits atomic
Avoids issues with UBIFS file system.
http://www.linux-mtd.infradead.org/faq/ubifs.html#L_atomic_change
Signed-off-by: Luka Perkov <luka@openwrt.org>
Reported-by: Tim Harvey <tharvey@gateworks.com>
Felix Fietkau [Sun, 29 Sep 2013 11:20:34 +0000 (13:20 +0200)]
uci_delete: check ptr->o and its type before checking ptr->value
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 11 Jun 2013 12:50:57 +0000 (14:50 +0200)]
uci: fix excessive reorder delta entry duplication
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 10 Jun 2013 12:00:02 +0000 (14:00 +0200)]
blob: add uci<->blob conversion library code
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 10 Jun 2013 11:19:45 +0000 (13:19 +0200)]
util: fix compile error
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Jo-Philipp Wich [Sun, 26 May 2013 16:55:20 +0000 (18:55 +0200)]
lua: emit a proper deletion when setting an existing list to a new list with only a single item
Krzysztof Kuźnik [Thu, 28 Feb 2013 13:44:00 +0000 (13:44 +0000)]
uci: Fix uci_delete() when ptr->value is empty string
After fix for deleting list elements by index this function was
broken and didn't allow to invoke from command line:
uci set some.fancy.list=''
i.e. list wasn't cleared
Signed-off-by: Krzysztof Kuźnik <k.kuznik@avsystem.com>
Etienne CHAMPETIER [Tue, 5 Feb 2013 17:09:34 +0000 (17:09 +0000)]
uci: copy permisions of /etc/config/ files for temp files
Hi
Using uci as a non root user i can get network configuration but not network state (for exemple).
The idea of this patch is to copy permission from config file, or if it doesn't exist use UCI_FILEMODE / UCI_DIRMODE
Tested on tplink wr1043nd. (you have to remove some mkdir from /etc/init.d/boot to fully see this patch work)
If you apply this patch (or a modified version), please also backport to AA
Signed-off-by: Etienne CHAMPETIER <etienne.champetier@free.fr>
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Jo-Philipp Wich [Mon, 22 Apr 2013 13:50:08 +0000 (15:50 +0200)]
Change delta encoding of list deletions
When encoding list_del commands in delta files, '_' is used as prefix but this
breaks any command operating on files starting with an underscore since the
command prefix becomes indistinguishable from the filename.
The regression was introduced with
ec8cbbbe0f20e67cbd3bd471b9ac55ceacaef7b8.
Avoid this problem by using '~' as command prefix for list deletions.
Jérôme Poulin [Wed, 6 Feb 2013 18:10:17 +0000 (18:10 +0000)]
Add multiple free for each call to lookup_args()
This memory leak can be reproduced using a tight loop to uci:get() a config.
lua -e 'require("posix"); require("uci");
function getconf()
local tmp, uc = uci.cursor();
tmp = uc:get("system", "ntp", "enable_server");
end;
while 1
do
for i=0,1000 do getconf() end;
print("gc");
print(collectgarbage("count"));
collectgarbage();
print(collectgarbage("count"));
print("sleep 1");
posix.sleep(1);
end'
Krzysztof Kuznik [Wed, 22 Aug 2012 08:11:23 +0000 (10:11 +0200)]
uci: libuci leaking memory on non-existent config file
In file file.c function uci_file_load() allocates memory for filename.
When uci_open_stream() failed with exception this memory was never freed.
This patch makes call to uci_open_stream() wrapped in exception handling
inside uci_file_load() where filename is freed.
Signed-off-by: Krzysztof Kuznik <k.kuznik@avsystem.com>
Jo-Philipp Wich [Tue, 5 Mar 2013 14:48:04 +0000 (15:48 +0100)]
ignore trailing carriage returns in file parser
Thomas Gstädtner [Sun, 3 Mar 2013 15:20:13 +0000 (16:20 +0100)]
add main directory to include path
Felix Fietkau [Wed, 23 Jan 2013 14:21:53 +0000 (15:21 +0100)]
build: remove install prefix override
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 4 Jan 2013 16:24:35 +0000 (17:24 +0100)]
get rid of -rdynamic on link
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 4 Jan 2013 16:16:41 +0000 (17:16 +0100)]
remove unused hook support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 4 Jan 2013 16:12:39 +0000 (17:12 +0100)]
remove the libdl dependency
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 4 Jan 2013 16:07:59 +0000 (17:07 +0100)]
remove plugin support, it has been unused for a long time and should not be used for any new code
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 31 Dec 2012 15:56:27 +0000 (16:56 +0100)]
remove static libraries/binaries
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Luka Perkov [Fri, 9 Nov 2012 10:44:11 +0000 (11:44 +0100)]
extend delete command so it can delete list elemets using index
Luka Perkov [Fri, 9 Nov 2012 10:40:10 +0000 (11:40 +0100)]
add new command del_list
Felix Fietkau [Thu, 4 Oct 2012 14:04:46 +0000 (16:04 +0200)]
lua: include /opt/local/lib and /opt/local/include in the search path on mac os x
Felix Fietkau [Wed, 28 Mar 2012 10:29:09 +0000 (13:29 +0300)]
cli: return non-zero status on errors
Jo-Philipp Wich [Fri, 24 Feb 2012 14:08:34 +0000 (15:08 +0100)]
Do quote section names to keep the same style as option values
Jo-Philipp Wich [Fri, 24 Feb 2012 11:24:17 +0000 (12:24 +0100)]
Section names, option names, list names can only be identifiers, so they don't need to be quoted.
Strip quotes except from values.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Jo-Philipp Wich [Tue, 20 Dec 2011 16:06:50 +0000 (17:06 +0100)]
lua: properly handle corner cases in changes
The previous rework of the change serialization caused some deltas to incorrectly
get promoted to list appends. Rework the code to explicitely check for an add list
change type, in all other cases simply overwrite existing fields with the current
string value instead of coercing existing values into a table and append to that.
This hopefully sorts out the remaining issues.
Jo-Philipp Wich [Mon, 19 Dec 2011 18:25:00 +0000 (19:25 +0100)]
lua: expose completely new lists in changes() as well
Since the first delta of a new list is of type UCI_CMD_CHANGE and
not UCI_CMD_LIST_ADD, the current code does not start a new table
and subsequent items are silently disacarded. Expose all items of
new list by coercing the existing string element into a table when
encountering subsequent items.
Jo-Philipp Wich [Mon, 19 Dec 2011 18:10:07 +0000 (19:10 +0100)]
Merge branch 'master' of git://nbd.name/uci
Jo-Philipp Wich [Sat, 12 Nov 2011 14:16:31 +0000 (15:16 +0100)]
lua: simplify add_list changes handling, always create a table for LIST_ADD commands
Jo-Philipp Wich [Sat, 12 Nov 2011 13:35:12 +0000 (14:35 +0100)]
lua: expose add_list change items as table values
Jo-Philipp Wich [Sat, 12 Nov 2011 14:16:31 +0000 (15:16 +0100)]
lua: simplify add_list changes handling, always create a table for LIST_ADD commands
Jo-Philipp Wich [Sat, 12 Nov 2011 13:35:12 +0000 (14:35 +0100)]
lua: expose add_list change items as table values
Felix Fietkau [Fri, 21 Oct 2011 20:48:01 +0000 (22:48 +0200)]
fix segfault on import of anonymous sections
Felix Fietkau [Fri, 21 Oct 2011 13:15:53 +0000 (15:15 +0200)]
lua: always return after calling luaL_error (patch by Stanislav Fomichev)
Felix Fietkau [Fri, 21 Oct 2011 13:15:24 +0000 (15:15 +0200)]
cli: check against multiple -f invocations to avoid leaks (patch by Stanislav Fomichev)
Felix Fietkau [Fri, 21 Oct 2011 13:14:30 +0000 (15:14 +0200)]
ucimap: initialize an uninitialized pointer (patch by Stanislav Fomichev)
Felix Fietkau [Fri, 21 Oct 2011 13:14:03 +0000 (15:14 +0200)]
ucimap: fix a memory leak (patch by Stanislav Fomichev)
Felix Fietkau [Fri, 21 Oct 2011 13:13:32 +0000 (15:13 +0200)]
add a few missing null pointer checks, and fix check vs dereference order in some cases (patch by Stanislav Fomichev)
Felix Fietkau [Fri, 21 Oct 2011 13:12:04 +0000 (15:12 +0200)]
check result of memory allocations (patch by Stanislav Fomichev)
Felix Fietkau [Fri, 21 Oct 2011 13:09:11 +0000 (15:09 +0200)]
ucimap: fix use-after-free on cleanup (patch by Stanislav Fomichev)
Felix Fietkau [Fri, 23 Sep 2011 13:12:47 +0000 (07:12 -0600)]
free memory for uci hooks
Felix Fietkau [Thu, 15 Sep 2011 14:41:57 +0000 (16:41 +0200)]
lua: allow overriding of LUA_CFLAGS
Felix Fietkau [Thu, 15 Sep 2011 14:39:05 +0000 (16:39 +0200)]
lua: use pkg-config to find the correct lua cflags
Felix Fietkau [Wed, 31 Aug 2011 14:55:25 +0000 (16:55 +0200)]
fix lgpl license headers
Felix Fietkau [Tue, 19 Jul 2011 20:39:56 +0000 (22:39 +0200)]
fix one more unused-but-set variable
Felix Fietkau [Mon, 18 Jul 2011 10:05:42 +0000 (12:05 +0200)]
fix more unused-but-set errors
Felix Fietkau [Mon, 18 Jul 2011 06:25:27 +0000 (08:25 +0200)]
remove unused but set variable to fix a compiler warning
Felix Fietkau [Wed, 6 Apr 2011 23:13:57 +0000 (01:13 +0200)]
do not attempt to build lua if disabled
Felix Fietkau [Tue, 5 Apr 2011 01:33:38 +0000 (03:33 +0200)]
constify arguments to parser function
Felix Fietkau [Tue, 5 Apr 2011 01:29:17 +0000 (03:29 +0200)]
add parser helpers similar to the blobmsg parser in libubox