Modify

Opened 14 months ago

Last modified 14 months ago

#24919 new defect

uci config enumeration flaw

Reported by: bolvan Owned by: developers
Priority: normal Milestone:
Component: packages Version: Trunk
Keywords: uci Cc:

Description

Original visible issue is seeing always "Changes: 0" in LUCI UI.
https://github.com/openwrt/luci/issues/856#issuecomment-266218003

I traced the reason to libuci.so.
(file.c) uci_list_config_files enumerates all files in /etc/config including directories
if directory is found then get_filename returns null
configs[i] remains unset and in most cases contain NULL
all parts of code that use config enumeration stop on first NULL
If a directory exist in /etc/config then all fails

	char **configs = NULL;
	char **p;
	if ((uci_list_configs(ctx, &configs) != UCI_OK) || !configs) {
		cli_perror();
		goto out;
	}

	for (p = configs; *p; p++) {
		package_cmd(cmd, *p);
	}


Someone need to correct behavior to stop enumerating dirs inside /etc/config

Attachments (0)

Change History (2)

comment:1 Changed 14 months ago by bolvan

This patch to file.c fixes the problem

838c838
<       int size, i;
---
>       int size, i, j;
862c862
<       for(i = 0; i < globbuf.gl_pathc; i++) {
---
>       for(i = 0, j = 0; i < globbuf.gl_pathc; i++) {
872c872
<               configs[i] = buf;
---
>               configs[j++] = buf;

comment:2 Changed 14 months ago by bolvan

LEDE already fixed this

http://git.lede-project.org/49ec6ef

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.