From 8a66041f90db8205db50fd83aed8001175c787ed Mon Sep 17 00:00:00 2001 From: slioch Date: Mon, 2 Mar 2009 22:28:16 -0800 Subject: added fix for nested priority and deletion failure. also priorities should not reside on node.tags, but on parent (node name of multinode)--this is to prevent priorities splitting behaviors between different priorities on multinodes. --- src/common/unionfs.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/common/unionfs.c b/src/common/unionfs.c index 0aaffe0..4cb2ed6 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -1066,8 +1066,10 @@ delete_func(GNode *node, gpointer data) char *command = malloc(MAX_LENGTH_DIR_PATH); struct SrcDst *sd = (struct SrcDst*)data; + //DONT HAVE THE COMMAND BELOW BLOW AWAY WHITEOUT FILES!!!!! static const char format[]="rm -f %s%s{*,.*} >&/dev/null;rmdir %s%s >&/dev/null ; /bin/true"; //need to remove opaque file. - static const char format_force_delete[]="rm -f %s%s{*,.*} >&/dev/null;rm -fr %s%s >&/dev/null ; /bin/true"; //force delete as this is a delete operation with dependency + static const char format_force_delete[]="rm -f %s%s{*,.*} >&/dev/null;rmdir %s%s >&/dev/null ; /bin/true"; //force delete as this is a delete operation with dependency + static const char delete_format[]="rm %s%s../.wh.%s >&/dev/null"; char *path = ((struct VyattaNode*)(node->data))->_data._path; @@ -1078,13 +1080,23 @@ delete_func(GNode *node, gpointer data) //WILL ONLY REMOVE DIRS WITHOUT CHILD DIRS--just what we want.. - sprintf(command,format,sd->_src,path,sd->_src,path); - if (g_debug) { - printf("%s\n",command); - fflush(NULL); + //NEED TO PREVENT THE COMMAND BELOW FROM DELETING WHITEOUT FILES.... + + if (IS_NOOP(((struct VyattaNode*)(node->data))->_data._operation)) { + return FALSE; //see if we can skip this node here } - if (sd->_test_mode == FALSE) { - system(command); + + + //DOESN'T QUITE FIX THE PROBLEM, THE PARENT IS CALLED (AND PROBABLY SHOULDN'T BE) + if (!IS_DELETE(((struct VyattaNode*)(node->data))->_data._operation)) { + sprintf(command,format,sd->_src,path,sd->_src,path); + if (g_debug) { + printf("%s\n",command); + fflush(NULL); + } + if (sd->_test_mode == FALSE) { + system(command); + } } //if this is a deletion operation, need to remove -- cgit v1.2.3 From 11d77d7b77d0dae8c5d41ff692a8b01eebafc9fb Mon Sep 17 00:00:00 2001 From: slioch Date: Tue, 3 Mar 2009 17:06:06 -0800 Subject: fixed -o option on commit. modified empty multinode behavior so action is NOT executed if a multinode does not possess a value. Other source cleanup. --- src/commit2.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/commit2.c b/src/commit2.c index 858cf90..5e75151 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -34,9 +34,6 @@ char* ActionNames[top_act] = { "end" //7 }; -extern boolean -check_syn(vtw_node *cur); - GNode* get_transactions(GNode*, boolean priority); @@ -76,15 +73,6 @@ also, the algorithm for collapsing the tree into a transaction list is: 1) iterate through tree and mark all explicit transactions 2) when done, prune the tree of all root explicit transactions 3) Now iterate through remaining tree and remove each node and append to transaction list. - - -TODO: -> Implement transactional sorting functions (test) -> possibly add back validation sequence (difference in committing failed user w/o pw) -> memory handling code (i.e. all the frees I left out) -> test on boot by having boot call load rather than running through boot (and adding priority file) -> - */ /** @@ -164,6 +152,11 @@ main(int argc, char** argv) fprintf(out_stream, "No configuration changes to commit\n"); return 0; } + + GNode *orig_node_tree = NULL; + if (disable_partial_commit == TRUE) { + orig_node_tree = g_node_copy(config_data); + } // Get collection of transactions, i.e. trans nodes that have been activated. GNode *trans_coll = get_transactions(config_data, priority_mode); @@ -235,6 +228,9 @@ main(int argc, char** argv) } while ((trans_child_node = (GNode*)g_node_nth_child((GNode*)trans_coll,(guint)i)) != NULL); if (no_errors == TRUE) { + if (disable_partial_commit == TRUE) { + complete(orig_node_tree, test_mode); + } common_commit_clean_temp_config(test_mode); if (g_debug == TRUE) { printf("commit2: successful commit, now cleaning up temp directories\n"); @@ -306,6 +302,11 @@ process_func(GNode *node, gpointer data) return FALSE; } + //let's skip any multi-node that does not have have a value (an empty multi-node) + if (c->_multi && node->children == NULL) { + return FALSE; + } + //look at parent for multi tag if (d->_value && d->_name) { if (g_debug) { @@ -379,8 +380,7 @@ complete(GNode *node, boolean test_mode) gpointer gp = ((GNode*)node)->data; if (g_debug) { if (((struct VyattaNode*)gp)->_data._name != NULL) { - printf("commit2::complete():name: %s\n",((struct VyattaNode*)gp)->_data._name); - printf("commit2::complete():path: %s\n",((struct VyattaNode*)gp)->_data._path); + printf("commit2::complete():name: %s, path: %s\n",((struct VyattaNode*)gp)->_data._name,((struct VyattaNode*)gp)->_data._path); } else { printf("commit2::complete()\n"); -- cgit v1.2.3 From 2a04ac6d2e0e63317fc3cc30462658c2d0376631 Mon Sep 17 00:00:00 2001 From: slioch Date: Wed, 4 Mar 2009 09:42:32 -0800 Subject: modified environment variable setting for action on nodes. --- src/commit2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/commit2.c b/src/commit2.c index 5e75151..35f609d 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -337,12 +337,15 @@ process_func(GNode *node, gpointer data) if (result->_action == delete_act) { - setenv(ENV_ACTION_NAME,ENV_ACTION_DELETE,1); set_in_delete_action(TRUE); } + if (IS_DELETE(d->_operation)) { + setenv(ENV_ACTION_NAME,ENV_ACTION_DELETE,1); + } else { setenv(ENV_ACTION_NAME,ENV_ACTION_SET,1); } + status = execute_list(c->_def.actions[result->_action].vtw_list_head,&c->_def); if (result->_action == delete_act) { set_in_delete_action(FALSE); -- cgit v1.2.3 From 079dc15e8e34568ef41a3938276c235d4f75ee09 Mon Sep 17 00:00:00 2001 From: slioch Date: Wed, 4 Mar 2009 17:15:29 -0800 Subject: limit unescape command to embedded multinodes--fixes problem in qos-walkthrough regression test. haven't tried it but system probably inherently prevents percents from being used in embedded multinodes. --- src/commit2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/commit2.c b/src/commit2.c index 35f609d..0d77fb6 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -309,10 +309,14 @@ process_func(GNode *node, gpointer data) //look at parent for multi tag if (d->_value && d->_name) { + char *val = d->_name; + if (c->_def.tag) { //need to handle the embedded multinode as a special case--should be fixed! + val = (char*)clind_unescape(d->_name); + } if (g_debug) { - printf("commit2::process_func(): @ value: %s\n",(char*)clind_unescape(d->_name)); + printf("commit2::process_func(): @ value: %s\n",(char*)val); } - set_at_string((char*)clind_unescape(d->_name)); //embedded multinode value + set_at_string(val); //embedded multinode value } else { if (g_debug) { -- cgit v1.2.3