[augeas-devel] [PATCH] Fix run single command with autosave

Nathaniel Cook nvcook42 at gmail.com
Mon Aug 22 14:14:17 UTC 2011


Thanks for the quick reply this looks great. I'll work in the fix. Any
idea when this will be fixed in the official release?

Nathaniel Cook

On Fri, Aug 19, 2011 at 6:26 PM, Francis Giraldeau
<francis.giraldeau at gmail.com> wrote:
> This patch fixes autosave in the case only one command is provided as
> arguments and adds a test that checks proper handling of this case.
> ---
>  src/augtool.c           |    2 +-
>  tests/test-save-mode.sh |    6 ++++++
>  2 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/src/augtool.c b/src/augtool.c
> index 8981b4f..621f644 100644
> --- a/src/augtool.c
> +++ b/src/augtool.c
> @@ -483,7 +483,7 @@ static int run_args(int argc, char **argv) {
>     }
>     code = run_command(line);
>     free(line);
> -    if (code == 0 && auto_save)
> +    if (code >= 0 && auto_save)
>         code = run_command("save");
>     return (code == 0 || code == -2) ? 0 : -1;
>  }
> diff --git a/tests/test-save-mode.sh b/tests/test-save-mode.sh
> index d34f5bc..f8a0c3b 100755
> --- a/tests/test-save-mode.sh
> +++ b/tests/test-save-mode.sh
> @@ -120,3 +120,9 @@ EOF
>  assert_ipaddr 127.0.0.2
>  assert_file_exists_not $hosts.augnew
>  assert_file_exists_not $hosts.augsave
> +
> +setup "autosave command line"
> +run_augtool ok set /files/etc/hosts/1/ipaddr 127.0.0.2
> +assert_ipaddr 127.0.0.2
> +assert_file_exists_not $hosts.augnew
> +assert_file_exists_not $hosts.augsave
> --
> 1.7.4.1
>
> _______________________________________________
> augeas-devel mailing list
> augeas-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/augeas-devel
>




More information about the augeas-devel mailing list