summaryrefslogtreecommitdiffstats
path: root/fish/fish.c
Commit message (Collapse)AuthorAgeFilesLines
* tools: Modify existing tools to use guestfs_{push,pop}_error_handler.Richard W.M. Jones2012-11-091-5/+2
| | | | | This is a shorter and more convenient way to disable errors temporarily across calls.
* fish: Add GUESTFISH_PS1 environment variable to control prompt.Richard W.M. Jones2012-10-291-9/+134
|
* Fix multiple errors where jump skips variable initialization.Richard W.M. Jones2012-09-171-4/+7
| | | | | | | <file>: error: jump skips variable initialization [-Werror=jump-misses-init] This has only just appeared, possibly related to previous gnulib update. In any case, this is just code motion / cleanup.
* fish: Add --network option.Richard W.M. Jones2012-08-111-1/+5
| | | | | This enables the libguestfs user network, and is the equivalent of the 'virt-rescue --network' option.
* fish: Use minimal permissions when initially creating history fileMatthew Booth2012-07-251-1/+1
|
* New API: guestfs_shutdown: Cleanly shutdown the backend.Richard W.M. Jones2012-07-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The new API splits orderly close into a two-step process: if (guestfs_shutdown (g) == -1) { /* handle the error, eg. qemu error */ } guestfs_close (g); Note that the explicit shutdown step is only necessary in the case where you have made changes to the disk image and want to handle write errors. Read the documentation for further information. This change also: - deprecates guestfs_kill_subprocess - turns guestfs_kill_subprocess into the same as guestfs_shutdown - changes guestfish and other tools to call shutdown + close where necessary (not for read-only tools) - updates documentation - updates examples
* fish: Move 'feature_available' function to global.Richard W.M. Jones2012-05-021-0/+19
| | | | This is just code motion.
* fish: Add --pipe-error flag to allow detection of errors in pipe commands ↵Richard W.M. Jones2012-05-021-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (RHBZ#803533). For a test case, see: https://bugzilla.redhat.com/show_bug.cgi?id=803533 In guestfish, we use the gnulib closeout module which sets up an atexit handler to detect if there were any errors on stdout when the program exits. This is so we can fail correctly in out of disk space cases like: guestfish [...] > output However the atexit handler just checks that there was any error on stdout (using ferror). If a pipe command such as: ><fs> command_with_lots_of_output | head ran at any time during the session, the error flag would be set (because the underlying writes failed with EPIPE errors). So the commit first adds a test for ferror (stdout) after each command that we issue. This brings error handling closer to the point of failure, and so is generally a good thing. Secondly we reset the error flag after detecting and dealing with the error, so that avoids the redundant 'guestfish: write error' message produced by gnulib closeout. Thirdly we add a --pipe-error flag which causes guestfish commands to fail on pipe commands line the one above. The default is off for backwards compatibility reasons.
* Remove "convenience header" "gettext.h" and use <libintl.h> instead.Richard W.M. Jones2012-05-011-0/+1
| | | | | | | | | | | | gettextize provides a local file called "gettext.h". Remove this and use <libintl.h> from glibc headers instead. Most of this change is mechanical: #include <libintl.h> in every C file which uses any gettext function. But also we remove the gettext.h file, and adjust the "_" macros. Note that this effectively removes the ./configure --disable-nls option, although we don't know if that ever worked.
* Use O_CLOEXEC / SOCK_CLOEXEC for almost all file descriptors.Richard W.M. Jones2012-03-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The presumption is that all file descriptors should be created with the close-on-exec flag set. The only exception are file descriptors that we want passed through to exec'd subprocesses (mainly pipes and stdin/stdout/stderr). For open calls, we pass O_CLOEXEC as an extra flag, eg: fd = open ("foo", O_RDONLY|O_CLOEXEC); This is a Linux-ism, but using a macro we can easily make it portable. For sockets, similarly: sock = socket (..., SOCK_STREAM|SOCK_CLOEXEC, ...); For accepted sockets, we use the Linux accept4 system call which allows flags to be supplied, but we use the Gnulib 'accept4' module to make this portable. For dup, dup2, we use the Linux dup3 system call, and the Gnulib modules 'dup3' and 'cloexec'.
* Replace 'int' with 'size_t' passim.Richard W.M. Jones2012-03-131-12/+12
| | | | | Analyze all uses of 'int' in the code, and replace with 'size_t' where appropriate.
* fish: remote: Output from close event now passed over stdout (RHBZ#802389).Richard W.M. Jones2012-03-121-3/+4
|
* fish: remote: Make sure global cleanups are called for guestfish --listen.Richard W.M. Jones2012-03-121-0/+2
| | | | | Return to the main program ('fish.c') and perform global cleanups when the guestfish remote server exits.
* fish: In edit command, upload to a new file.Richard W.M. Jones2012-02-101-0/+3
| | | | | | | If the upload fails, this means we don't leave a partially written file. Also add a test for the edit command.
* Tempus fugit.Richard W.M. Jones2012-01-181-2/+2
| | | | Update all copyright dates to 2012.
* fish options parsing: Allow add_drives to be called multiple times.Richard W.M. Jones2012-01-181-5/+3
| | | | | | Ensure that the drv structure is always zeroed on allocation. Don't leak old drv->device when add_drives is called multiple times.
* fish: fix the Ctrl-\ causes guestfish to abort bug(RHBZ#596761)Wanlong Gao2012-01-041-0/+1
| | | | | | Handle SIGQUIT by guestfish, so that it can't be terminated. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* fish: Allow events to be processed in guestfish.Richard W.M. Jones2011-12-161-0/+2
| | | | | | | | Add 'event', 'list-events' and 'delete-event' commands so that event handlers can be registered, listed and deleted in guestfish. The event handler is a shell script snippet or host command. Cc: Pádraig Brady <P@draigBrady.com>
* Update FSF address.Matthew Booth2011-11-081-1/+1
|
* fish: Close guestfs handle explicitly before exiting.Richard W.M. Jones2011-10-131-0/+2
| | | | | | NOTE this is just a cleanup. It is NOT necessary for correctness, since libguestfs itself is correctly closing the handle in the exit handler.
* fish: Make progress bars into a mini library.Richard W.M. Jones2011-08-261-36/+33
| | | | This library could now be called from other virt tools.
* Coverity: fix memory leak in guestfish.Richard W.M. Jones2011-08-231-2/+1
|
* pclose: Fix other places where we only tested pclose == -1.Richard W.M. Jones2011-08-231-1/+1
| | | | pclose can return > 0 when the status of the command was non-zero.
* fish: Print input file and line number in error messages.Richard W.M. Jones2011-08-051-0/+25
| | | | | eg: *stdin*:37: libguestfs: error: luks_close: Device lukstest is busy.
* fish: Register ^C handler to cancel long transfers.Richard W.M. Jones2011-07-151-1/+21
|
* fish: Add is_interactive flag.Richard W.M. Jones2011-07-151-2/+9
| | | | | Decide early (before launch) if this is going to be an interactive session, and set the is_interactive flag.
* fish: Handle backslash escapes in guestfish double-quoted strings.Richard W.M. Jones2011-07-141-4/+84
|
* Remove local LIBGUESTFS_PATH detection from guestfish and guestmount.Richard W.M. Jones2011-04-161-13/+0
| | | | | | | | | | | Remove the hack that let you run ./fish/guestfish or ./fuse/guestmount. You now have to do: ./run ./fish/guestfish or ./run ./fuse/guestmount to run these programs without installing.
* fish: Allows win:... paths to work with drives mounted anywhere.Richard W.M. Jones2011-04-121-75/+94
| | | | | | This allows you to mount disks on (eg) /c and /e and have the guestfish win:... path mechanism map drive letters to the right places.
* fish: Enhance guestfish win:... parsing to understand drive letters.Richard W.M. Jones2011-04-051-6/+74
|
* Add /etc/libguestfs-tools.conf configuration file.Richard W.M. Jones2011-03-311-0/+2
| | | | | This allows the default for --ro or --rw to be controlled for the three tools guestfish, guestmount and virt-rescue.
* fish: fuse: Add -m dev:mnt:opts to allow mount options to be specified.Richard W.M. Jones2011-03-281-1/+1
| | | | | | | | | | | | | This lets you turn on ACLs and xattrs by doing: -m /dev/sda1:/:acl,user_xattr The extra parameter is passed through to mount_options: libguestfs: trace: mount_options "acl,user_xattr" "/dev/sda1" "/" Notes: Labels: feature
* fish: Add better quick help to --help output.Richard W.M. Jones2011-03-221-10/+10
| | | | | Notes: Labels: cleanup Depends: c8faa5d0b0a17689d27bd33bc787ba0fe9a3f076
* fish: Add -w|--rw option to --help output.Richard W.M. Jones2011-03-221-1/+2
| | | | Notes: Labels: bugfix
* New event API (RHBZ#664558).Richard W.M. Jones2011-03-151-1/+2
| | | | | | | | | | | | | This API allows more than one callback to be registered for each event, makes it possible to call the API from other languages, and allows [nearly all] log, debug and trace messages to be rerouted from stderr. An older version of this API was discussed on the mailing list here: https://www.redhat.com/archives/libguestfs/2010-December/msg00081.html https://www.redhat.com/archives/libguestfs/2011-January/msg00012.html This also updates guestfish to use the new API for its progress bars.
* fish: Add guestfish --live, guestmount --live options.Richard W.M. Jones2011-02-031-0/+5
| | | | | | The other programs have the variable, but the flag is not enabled either because it doesn't make sense or because the implications are not well understood.
* Add guestfs_add_domain 'live' flag.Richard W.M. Jones2011-02-031-1/+1
| | | | | | | | | | This optional flag controls whether this API call will try to connect to a running virtual machine 'guestfsd' process. If the flag is given and the virtual machine is running, then the libvirt XML is parsed looking for a suitable <channel> element, and 'guestfs_set_attach_method' is called with the corresponding virtio-serial socket path.
* fish: Initialize pcmd structure.Richard W.M. Jones2011-01-181-1/+4
| | | | | | | On Debian we get this warning which I'm pretty sure is bogus: fish.c:690: error: 'pcmd.cmd' may be used uninitialized in this function [-Wuninitialized]
* fish: <! cmd executes a shell command and inlines the resulting commands.Richard W.M. Jones2011-01-181-0/+57
| | | | | | | | The new guestfish construct "<! cmd" executes the shell command "cmd", and then anything printed to stdout by "cmd" is parsed and executed as a guestfish command. This allows some very hairy shell scripting with guestfish.
* fish: Factor out command line parsing.Richard W.M. Jones2011-01-181-154/+170
| | | | Factor out the code which splits a string into a command line.
* fish: Make exit_on_error into a completely local variable.Richard W.M. Jones2011-01-181-6/+12
| | | | | | Note that 'time' and 'glob' (which both run subcommands) do not correctly pass the exit_on_error flag in the remote case. This is not a regression: the current code doesn't work either.
* fish: exit_on_error is a local variable.Richard W.M. Jones2011-01-181-1/+1
|
* fish: Remove some unused local variables.Richard W.M. Jones2010-12-091-2/+2
|
* fish: Don't use external pod2text program.Richard W.M. Jones2010-11-261-18/+0
| | | | | | | This removes the dependency from guestfish to the external pod2text program (and hence the final dependency on perl for guestfish). This is done by storing the formatted pod2text output in guestfish as the help text.
* fish: Keep device names in options drives list.Richard W.M. Jones2010-11-251-2/+3
| | | | | | | In the 'struct drv *drvs' structure, keep a list of the device name(s) for each added drive or guest. The device name is the canonical name as that drive would be known inside libguestfs, eg. "/dev/sda"
* fish: Add --rw option (does nothing yet).Richard W.M. Jones2010-11-081-1/+6
| | | | | | | | | | This adds the guestfish --rw option, intended in future to be required for writing to disk images. At the moment this does not change the default and so does nothing. This patch is intended for backporting to the stable branches so that we can start to introduce scripts which use 'guestfish --rw'.
* fish: Add --listen --csh to for csh, tcsh compatibility.Richard W.M. Jones2010-11-051-0/+5
| | | | (Thanks Eric Blake).
* fish: '-i' option automatically handles whole-disk encryption.Richard W.M. Jones2010-11-051-64/+0
| | | | | | | | | | | This feature is also available in guestmount because of the shared option parsing code. You don't need to do anything to enable it, just using -i will attempt decryption of encrypted partitions. Only works for simple Fedora whole-disk encryption. It's a work-in-progress to make it work for other types of encryption.
* fish: Make the 'help' command more helpful.Richard W.M. Jones2010-11-041-2/+2
|
* Unify guestfish and guestmount options processing (RHBZ#642932).Richard W.M. Jones2010-10-271-239/+41
| | | | | | | | | | | | | | | In guestfish, factor out the processing of the options -a, -c, -d, -i, -m, -n, -r, -v, -V, -x into a separate set of files: options.c, options.h, inspect.c, virt.c. Change guestmount so that it uses these same files (from the ../fish directory) to process the same options. This unifies the handling of these options between the two programs. It also adds the useful inspection feature to guestmount, so you can now do: guestmount -d Guest -i --ro mnt/