[augeas-devel] 3 small patches
Jim Meyering
jim at meyering.net
Thu Jan 8 13:33:42 UTC 2009
[PATCH 1/3] test ls output more portably in face of SELinux differences
[PATCH 2/3] plug a leak
[PATCH 3/3] comment typos
I saw some test failures on F10 with stock coreutils-7.0:
Expected mode 0600 but got -rw-------.
FAIL: test-preserve.sh
Expected SELinux type etc_t but got
FAIL: test-preserve.sh
They are due to changes in how ls -Z works.
Upstream coreutils made it so -Z does not imply -l.
Here's a fix:
>From 76a52328948da6d9d1ee1ba864d4b7870a7ec492 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 7 Jan 2009 18:58:03 +0100
Subject: [PATCH 1/3] test ls output more portably in face of SELinux differences
* test-preserve.sh: Use cut -b1-10 to get mode from ls -l output.
Use ls -lZ (not ls -Z, which is not portable) to get SELinux context.
---
tests/test-preserve.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/test-preserve.sh b/tests/test-preserve.sh
index f975270..392e05b 100755
--- a/tests/test-preserve.sh
+++ b/tests/test-preserve.sh
@@ -40,9 +40,9 @@ if [ $? != 0 ] ; then
fi
act_group=$(ls -l $hosts | cut -d ' ' -f 4)
-act_mode=$(ls -l $hosts | cut -d ' ' -f 1)
+act_mode=$(ls -l $hosts | cut -b 1-10)
if [ $selinux = yes ] ; then
- act_con=$(ls -Z $hosts | cut -d ' ' -f 5 | cut -d ':' -f 3)
+ act_con=$(ls -lZ $hosts | cut -d ' ' -f 5 | cut -d ':' -f 3)
fi
if [ "x$group" != "x$act_group" ] ; then
echo "Expected group $group but got $act_group"
--
1.6.1.141.gfe98e
>From a006802e57ca2acd58d318607d539a0fa5835d07 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Sun, 28 Dec 2008 16:25:59 +0100
Subject: [PATCH 2/3] plug a leak
24 bytes in 1 blocks are definitely lost in loss record 1 of 1
at 0x4021BDE: calloc (vg_replace_malloc.c:397)
by 0x4029379: make_tree (augeas.c:316)
by 0x403AC70: get_lens (get.c:592)
by 0x403ACB6: get_lens (get.c:523)
by 0x403AB4F: get_lens (get.c:474)
by 0x403ACDE: get_lens (get.c:523)
by 0x403AB4F: get_lens (get.c:474)
by 0x403AF20: lns_get (get.c:684)
by 0x4034E81: lens_get (builtin.c:124)
by 0x402CDC7: native_call (syntax.c:967)
by 0x402F4C9: compile_exp (syntax.c:1574)
by 0x402EF17: compile_exp (syntax.c:1487)
by 0x402FEEC: __aug_load_module_file (syntax.c:1600)
by 0x80489AE: main (augparse.c:86)
---
src/builtin.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/builtin.c b/src/builtin.c
index 8d862c0..e5c475a 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -126,7 +126,10 @@ static struct value *lens_get(struct info *info, struct value *l,
v = make_value(V_TREE, ref(info));
v->origin = make_tree_origin(tree);
} else {
- tree = make_tree_origin(tree);
+ struct tree *t = make_tree_origin(tree);
+ if (t == NULL)
+ free_tree(tree);
+ tree = t;
v = make_exn_lns_error(info, err, text);
if (tree != NULL) {
--
1.6.1.141.gfe98e
>From 4edd597a2b2b2cb02e375334b7146b30f51f3c09 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Sun, 28 Dec 2008 16:27:53 +0100
Subject: [PATCH 3/3] comment typos
---
src/get.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/get.c b/src/get.c
index f0f2f92..9357afe 100644
--- a/src/get.c
+++ b/src/get.c
@@ -675,9 +675,9 @@ struct tree *lns_get(struct info *info, struct lens *lens, const char *text,
/* We are probably being overly cautious here: if the lens can't process
* all of TEXT, we should really fail somewhere in one of the sublenses.
- * But to be safe, we check that we can process everythign anyway, then
+ * But to be safe, we check that we can process everything anyway, then
* try to process, hoping we'll get a more specific error, and if that
- * fails, we throw our arms in the air and say 'something wnet wrong'
+ * fails, we throw our arms in the air and say 'something went wrong'
*/
partial = !applies(lens, &split);
--
1.6.1.141.gfe98e
More information about the augeas-devel
mailing list