Richard W.M. Jones
2010-Oct-01 09:49 UTC
[Libguestfs] [PATCH] fish: Fix glob command (RHBZ#635969).
Note this bug was very confusing because glob works when you use the -x (trace) option, so when you try to trace the commands being run the bug "disappears". Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top -------------- next part -------------->From f69a3687a5731530b8044773bd8246863ccdeae7 Mon Sep 17 00:00:00 2001From: Richard W.M. Jones <rjones at redhat.com> Date: Fri, 1 Oct 2010 10:46:38 +0100 Subject: [PATCH] fish: Fix glob command (RHBZ#635969). This is a fix for the glob command in guestfish which was inadvertently broken in commit c359347dd42c9f5b875630537ee3641264826b89. This also appears to fix: https://bugzilla.redhat.com/show_bug.cgi?id=635969 glob echo mkfs ext2 /dev/vd[b-t]1 prints garbage --- fish/glob.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fish/glob.c b/fish/glob.c index 41f2bcd..3e0f8b9 100644 --- a/fish/glob.c +++ b/fish/glob.c @@ -1,5 +1,5 @@ /* guestfish - the filesystem interactive shell - * Copyright (C) 2009 Red Hat Inc. + * Copyright (C) 2009-2010 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -140,12 +140,13 @@ glob_issue (char *cmd, int argc, argv[argc] = NULL; again: + for (i = 1; i < argc; ++i) + argv[i] = globs[i][posn[i]]; + if (guestfs_get_trace (g)) { printf ("%s", argv[0]); - for (i = 1; i < argc; ++i) { - argv[i] = globs[i][posn[i]]; + for (i = 1; i < argc; ++i) printf (" %s", argv[i]); - } printf ("\n"); } -- 1.7.3
Richard W.M. Jones
2010-Oct-01 10:14 UTC
[Libguestfs] [PATCH v2] fish: Fix glob command (RHBZ#635969).
I think it's better to just get rid of the whole tracing bit, since if tracing is enabled then the command will get printed anyway. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html -------------- next part -------------->From ffc75da7139f1ff447b597457458b72eba2bb108 Mon Sep 17 00:00:00 2001From: Richard W.M. Jones <rjones at redhat.com> Date: Fri, 1 Oct 2010 10:46:38 +0100 Subject: [PATCH] fish: Fix glob command (RHBZ#635969). This is a fix for the glob command in guestfish which was inadvertently broken in commit c359347dd42c9f5b875630537ee3641264826b89. This also appears to fix: https://bugzilla.redhat.com/show_bug.cgi?id=635969 glob echo mkfs ext2 /dev/vd[b-t]1 prints garbage --- fish/glob.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/fish/glob.c b/fish/glob.c index 41f2bcd..e17a9ad 100644 --- a/fish/glob.c +++ b/fish/glob.c @@ -1,5 +1,5 @@ /* guestfish - the filesystem interactive shell - * Copyright (C) 2009 Red Hat Inc. + * Copyright (C) 2009-2010 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -140,14 +140,8 @@ glob_issue (char *cmd, int argc, argv[argc] = NULL; again: - if (guestfs_get_trace (g)) { - printf ("%s", argv[0]); - for (i = 1; i < argc; ++i) { - argv[i] = globs[i][posn[i]]; - printf (" %s", argv[i]); - } - printf ("\n"); - } + for (i = 1; i < argc; ++i) + argv[i] = globs[i][posn[i]]; if (issue_command (argv[0], &argv[1], NULL) == -1) *r = -1; /* ... but don't exit */ -- 1.7.3
Seemingly Similar Threads
- [PATCH 0/4] fish: Allow the glob command to expand device patterns (RHBZ#635971).
- [PATCH 0/3] Fix resolving absolute symlinks (RHBZ#579608).
- [PATCH 0/2] Actually translate our Perl programs (RHBZ#559963).
- [PATCH] fish: help command return error for non-existent commands (RHBZ#597145).
- [PATCH 1/2] daemon: glob: do not return directories with trailing slash