summaryrefslogtreecommitdiffstats
path: root/fish/fish.c
Commit message (Collapse)AuthorAgeFilesLines
* 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/
* Enable autosync by default.Richard W.M. Jones2010-10-271-2/+0
|
* fish: Specify format of disks (RHBZ#642934,CVE-2010-3851).Richard W.M. Jones2010-10-221-5/+28
| | | | | | | | For libvirt guests, the disk format is copied from libvirt (if libvirt knows it). For command line disk images, you can use --format to override format auto-detection.
* Allow $TMPDIR to override most temporary directory uses.Richard W.M. Jones2010-09-241-1/+1
| | | | | | | Be more consistent in allowing the user to override use of the temporary directory by specifying $TMPDIR. Also prefer P_tmpdir macro (defined in <stdio.h>) if that is defined, rather than hard-coding "/tmp" for the fallback location.
* fish: Fix segfault in free_drives() function.Richard W.M. Jones2010-09-221-2/+2
| | | | | This updates commit 8ea62c8d7f3f7f7e4057b93105cf979271aa13f4 so it doesn't try to free the optarg (stack-allocated) strings.
* leak: Clear history before exiting guestfish.Richard W.M. Jones2010-09-211-0/+1
| | | | | | | | | Clear the in-memory history before exiting. This removes some but not all memory leaks associated with using the GNU History library. As far as I can tell it is not possible to free up everything used by GNU History. (Found by valgrind).
* leak: Free list of drives and mountpoints in guestfish.Richard W.M. Jones2010-09-211-0/+38
| | | | | | | | | | Previously the list of -a, -d, -m, -N parameters were leaked. This change frees them explicitly. This is not such an important fix since guestfish is a one-shot program, but it aids in finding other leaks in future. (Found by valgrind).
* fish: Add --echo-keys option to allow passphrases/keys to be echoed.Richard W.M. Jones2010-09-211-8/+15
| | | | | See also: http://catless.ncl.ac.uk/Risks/26.17.html#subj13.3
* generator: Generate guestfish-only commands.Richard W.M. Jones2010-09-181-208/+2
| | | | | | The guestfish-only commands such as 'alloc' and 'edit' are now generated from one place in the generator instead of being spread around ad-hoc in the C code.
* fish: Correction for online help for 'edit' and 'more' commands.Richard W.M. Jones2010-09-171-8/+2
| | | | | This corrects commit b5c287bcd456bdb02d8ec0443483df34f4fd6b5d and commit 639ca1828b167bf59353f0cd3c8c79c6289bbd5d.