summaryrefslogtreecommitdiffstats
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* daemon: Use pkg-config to locate Augeas CFLAGS / libraries.Richard W.M. Jones2011-12-222-11/+15
| | | | | | | | | | | | | | | | | | | | | | Augeas 0.10 depends on libxml2, so this is now required in the appliance (in fact, it was already present). However this exposed two bugs: (1) In libguestfs we use a home-brewed recipe for Augeas flags, resulting in this error: /usr/include/augeas.h:24:25: fatal error: libxml/tree.h: No such file or directory (2) Augeas's own augeas.pc didn't include the libxml2 flags, so it was broken. This requires a patch to Augeas 0.10, see: https://www.redhat.com/archives/augeas-devel/2011-December/msg00008.html Change to using pkg-config to detect Augeas. It is still an optional library. Cherry picked from commit 615924abaa968398d6529529fa2f31ae23de825b and rebased for old libguestfs branches that had separate daemon/configure.ac.
* daemon: Don't use files with fixed names in /tmp (thanks Steve Kemp).Richard W.M. Jones2011-11-092-20/+46
| | | | | | | Although this doesn't matter for the ordinary (appliance) case, it matters for the libguestfs live case. In that case it could cause the guest to be exploited by a tmp/symlink attack. (cherry picked from commit 6011b1f803ba7308c6a94b9bf6b7212cfccb9f42)
* Update to latest gnulib for stable-1.8 branch.Richard W.M. Jones2011-10-311-0/+48
|
* Add an optional group ("grub") for the guestfs_grub_install API.Richard W.M. Jones2011-09-161-1/+8
| | | | | | | | | This also improves the documentation for this call, pointing out several pitfalls in using it. This unfortunately breaks existing callers that might use guestfs_grub_install without checking for this new group. (cherry picked from commit 99624d29226ece1abbbdd921183b360f5f80de91)
* blkid: Use -c /dev/null option to kill the cache.Richard W.M. Jones2011-07-271-9/+4
| | | | | | | On recent Debian, /etc/blkid.tab is now a symlink to /dev/.blkid.tab. Rather than chasing the cache file around (it may move to /run in future) use the -c /dev/null option to stop blkid from reading the cache. (cherry picked from commit 1d0f398d8e3c74ce6a70cbbb8d9b8ae07c6d7ef6)
* blkid: Detect when value not found and return empty string.Richard W.M. Jones2011-07-271-4/+15
| | | | | | | | | | | | | | | If the blkid command returns 2, that means the value was not found. Note that this changes the output of the vfs-type API when the filesystem has no type (eg when it is empty). Previously this would return an error. Now it returns empty string "". We did not document this either way. Making it return empty string is consistent with vfs-label and vfs-uuid. This change broke list-filesystems, since that code was assuming that vfs-type could only return a filesystem type or an error. (cherry picked from commit 168fd4ad5d1e5da93e11388095d41aaa8f804ceb)
* mkfs: Don't die if mke2fs is not available.Richard W.M. Jones2011-07-271-4/+4
| | | | | Allow other types of filesystems to be created. (cherry picked from commit c6340f45007b0ab7e1c5391cf78afc10a816553f)
* part-get-bootable: Fix when partitions are missing or unordered (RHBZ#602997).Richard W.M. Jones2011-07-271-4/+30
| | | | (cherry picked from commit 511c82df46f5c6f4a7f984fdb81d4691038ed6da)
* daemon: Keep Coverity happy by ignoring some return values.Richard W.M. Jones2011-06-133-7/+17
| | | | (cherry picked from commit f5096dd546ac43c7288b3ab7aec1562f070f78f6)
* Coverity: Don't return freed pointers from command* along error path.Richard W.M. Jones2011-06-131-2/+14
| | | | | | | | | | | If the external command failed to run, we could free up the allocated *stdoutput and *stderror pointers, but then return those freed pointers to the caller. The caller usually tries to print and free *stderror, so this is a serious error. Instead, return *stdoutput as NULL, and *stderror pointing to a generic error message. (cherry picked from commit 29453a58d818df24c238d0a08a68886ebe4029dd)
* Coverity: Missing return on error path.Richard W.M. Jones2011-06-131-0/+1
| | | | (cherry picked from commit 7a091a11d7aeddc170e4d1b833fd9d7d18c00841)
* Coverity: Ensure fp is closed along all error paths.Richard W.M. Jones2011-06-131-4/+6
| | | | (cherry picked from commit 346c5b0ebf58c81f657540eeb72abaa41bfc4e3f)
* Coverity: Close directory handle along error paths.Richard W.M. Jones2011-06-131-0/+2
| | | | (cherry picked from commit 7c020a14802255c966b2b402b983551b86a08bba)
* Coverity: Don't leak argv arrays.Richard W.M. Jones2011-06-131-0/+4
| | | | (cherry picked from commit 869c11b30c72c57e48dd63c4641087a06abe80d5)
* Coverity: Don't leak error strings.Richard W.M. Jones2011-06-135-3/+14
| | | | (Cherry picked from commit 3135b8c378f9f98ae66e37fd79d305764334980d).
* Coverity: Check return value of sysroot_path.Richard W.M. Jones2011-06-131-1/+1
| | | | | For some reason we were checking the parameter! (cherry picked from commit 7fae594df719d1d81a043c4d0280b359f750facb)
* Coverity: Check return value of malloc.Richard W.M. Jones2011-06-131-0/+4
| | | | (cherry picked from commit 3a5bd5aba23583e64bfaabc906ca95b0f9d37578)
* Coverity: Don't close fd_cwd if fd_cwd == -1.Richard W.M. Jones2011-06-131-2/+5
| | | | (cherry picked from commit 76dfb74324fa0daa343d7edf89bd05e1fe7b4db0)
* Coverity: Avoid calling sort_strings (NULL, 0) on empty list.Richard W.M. Jones2011-06-131-2/+3
| | | | (cherry picked from commit 3ed8d5122026f37dd96cc7e8503c4f3ecf0afbb7)
* Coverity: Don't call free_strings (NULL).Richard W.M. Jones2011-06-131-1/+0
| | | | (cherry picked from commit 48ebf50f3136ac27f4252662e351230ffa2b15e5)
* Coverity: Remove unreachable code.Richard W.M. Jones2011-06-134-12/+0
| | | | (cherry picked from commit 9160eec4fbf12643d8d5fa13465066822b2fed92)
* daemon: Fix error message.Nikita A Menkovich2011-06-131-1/+1
| | | | (cherry picked from commit 08bc8e40cea750bd35493ecab514e8e37c883a0a)
* Compile rpcgen-generated files with -fno-strict-aliasingMatthew Booth2011-04-111-6/+5
| | | | | | rpcgen generates source which can't be safely compiled with strict-aliasing enabled. (cherry picked from commit 3a84e0784e1e3ab7b56850d0f8c9aa42f1ae3da1)
* daemon: When running commands, restart select if we receive a signal.Richard W.M. Jones2011-04-111-0/+4
| | | | (cherry picked from commit 6e5f64089631622167e60df25ee009ef83df5170)
* daemon: Reset SIGPIPE to default before running subprocesses.Richard W.M. Jones2011-04-111-0/+1
| | | | (cherry picked from commit 42938f6faf9e724130be28f8e67d3c291bb81cba)
* RHEL 5: Use mke4fs on RHEL 5 as replacement for mke2fs.Richard W.M. Jones2011-03-293-3/+10
| | | | (cherry picked from commit a0e3b2183733c7440ad017c4ffe361935672339b)
* mkfs: Force mke2fs to create a filesystem even on raw IDE device (RHBZ#690819).Richard W.M. Jones2011-03-291-2/+18
| | | | (cherry picked from commit 227bea6c7ef89b707fe2c01c4d0d0fb9081e8c04)
* proto: Fix both-ends-cancel case.Richard W.M. Jones2011-03-214-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case where both ends cancel at the same time (eg. both ends realize there are errors before or during the transfer), previously we skipped sending back an error from the daemon, on the spurious basis that the library would not need it (the library is cancelling because of its own error). However this is wrong: we should always send back an error message from the daemon in order to preserve synchronization of the protocol. A simple test case is: $ guestfish -N fs -m /dev/sda1 upload nosuchfile / libguestfs: error: open: nosuchfile: No such file or directory libguestfs: error: unexpected procedure number (66/282) (Notice two things: there are errors at both ends, and the loss of synchronization). After applying this commit, the loss of synchronization does not occur and we just see the library error: $ guestfish -N fs -m /dev/sda1 upload nosuchfile / libguestfs: error: open: nosuchfile: No such file or directory The choice of displaying the library or the daemon error is fairly arbitrary in this case -- it would be valid to display either or even to combine them into one error. Displaying the library error only makes the code considerably simpler. This commit also (re-)enables a test for this case. Cherry picked and rebased from commit f4d996fd26762053d68f46de5790aae893f03d38.
* proto: Fix FileIn ops that abort during the chunk upload stage.Richard W.M. Jones2011-03-217-39/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a previous, incorrect attempt to fix RHBZ#576879 we tried to prevent the daemon from sending an error reply if the daemon had cancelled the transfer. This is wrong: the daemon should send an error reply in these cases. A simple test case is this: guestfish -N fs -m /dev/sda1 upload big-file / (This fails because the target "/" is a directory, not a file.) Prior to this commit, libguestfs would hang instead of printing an error. With this commit, libguestfs prints an error. What is happening is: (1) Library is uploading a file (2) In the middle of the long upload, daemon detects an error. Daemon cancels. (3) Library detects cancel, sends cancel chunk, then waits for the error reply from the daemon. (4) Daemon is supposed to send an error reply message. Because step (4) wasn't happening, uploads that failed like this would hang in the library (waiting for the error message, while the daemon was waiting for the next request). This also adds a regression test. This temporarily breaks the "both ends cancel" case (RHBZ#576879c5). Therefore the test for that is disabled, and this is fixed in the next patch in the series. This partially reverts commit dc706a639eec16084c0618baf7bfde00c6565f63. Cherry picked and rebased from commit 33b638109ed66ea360b53b80b1f407b3a5f5ec39.
* daemon: Ignore return value from chdir.Richard W.M. Jones2011-03-081-1/+1
| | | | | This updates commit 7eb012f3710bb554d5fc2c4229036901b0b5ad90. (cherry picked from commit 8d7d7c4ecfd202e04d18736718e9c5bb125ce4f0)
* daemon: change to root directoryRichard W.M. Jones2011-03-081-0/+2
| | | | | Ensure the daemon always starts with current directory == root. (cherry picked from commit 7eb012f3710bb554d5fc2c4229036901b0b5ad90)
* daemon: Add perror to two exit paths to make errors clearer.Richard W.M. Jones2011-03-081-1/+4
| | | | (cherry picked from commit e85fbee7bff9422a370d3f437594d262c043d89b)
* docs: Obsolete HACKING file, move content into guestfs(3) man page.Richard W.M. Jones2011-01-102-3/+4
| | | | | | | Add a new section called "EXTENDING LIBGUESTFS" to the guestfs manual page which contains all the information previously in "HACKING". (cherry picked from commit d2400da92e5e2cc7fd5e33e61220a33214d5241c)
* New APIs: getxattr and lgetxattr to get single extended attributes.Richard W.M. Jones2010-12-161-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These APIs are essentially required to work around a problem with ntfs-3g. This filesystem (or FUSE?) does not list all extended attributes of a file when you call listxattr(2). However if you know the name of an extended attribute, you can retrieve it directly using getxattr(2). The current APIs (getxattrs etc) are simple to use, but they don't work if we can't list out the extended attributes (ie. by calling listxattr(2)). Example using the new APIs on an ntfs-3g filesystem: ><fs> lgetxattr "/Documents and Settings" system.ntfs_attrib | hexdump -C 00000000 16 24 00 00 |.$..| 00000004 ><fs> lgetxattr "/Documents and Settings" system.ntfs_reparse_data | hexdump -C 00000000 03 00 00 a0 34 00 00 00 00 00 18 00 1a 00 10 00 |....4...........| 00000010 5c 00 3f 00 3f 00 5c 00 43 00 3a 00 5c 00 55 00 |\.?.?.\.C.:.\.U.| 00000020 73 00 65 00 72 00 73 00 00 00 43 00 3a 00 5c 00 |s.e.r.s...C.:.\.| 00000030 55 00 73 00 65 00 72 00 73 00 00 00 |U.s.e.r.s...| 0000003c ><fs> getxattr "/Documents and Settings" system.ntfs_reparse_data | hexdump -C libguestfs: error: getxattr: getxattr: No such file or directory ><fs> getxattr "/Documents and Settings" system.ntfs_attrib | hexdump -C libguestfs: error: getxattr: getxattr: No such file or directory ><fs> lgetxattr "/Documents and Settings" system.ntfs_attrib | hexdump -C 00000000 16 24 00 00 |.$..| 00000004 ><fs> getxattr "/Users" system.ntfs_attrib | hexdump -C 00000000 11 00 00 00 |....| 00000004
* daemon: Use prog_exists to check for features.Richard W.M. Jones2010-12-102-12/+5
| | | | This updates commit 0938509e0422363554023ab99381fd70a22a6e08.
* Remove several unused local variables.Richard W.M. Jones2010-12-101-1/+1
| | | | (Revealed by compiling under Debian where this is a warning).
* ubuntu: deactivate LVs and VGs before removing them.Richard W.M. Jones2010-12-071-0/+10
| | | | | | | | Even with the '-f' option, LVM on Ubuntu sometimes cannot remove active LVs and VGs. Change lvm-remove-all so it deactivates each LV and VG before removing them.
* Revert "umount-all: Add udev_settle after unmounting disks."Richard W.M. Jones2010-12-071-3/+0
| | | | | | | This reverts commit ad2abf89c364d5ec73fb12af63b053637d99d757. Ubuntu still has errors even with the addition of udev_settle after umount-all. Therefore this was just masking the problem.
* debian: Fix ntfs3g available API on Debian.Richard W.M. Jones2010-12-071-1/+5
| | | | | Really we should have a test for "is program on $PATH?" but this fix will do for now.
* umount-all: Add udev_settle after unmounting disks.Richard W.M. Jones2010-12-071-0/+3
| | | | | | This helps avoid an error on Ubuntu, but it's not clear if this is a real solution or just helps by adjusting the timing of some race condition.
* build: Don't emit warnings about stack protector failures.Richard W.M. Jones2010-12-061-0/+2
| | | | These are seen on gcc 4.5.1 used in Ubuntu.
* New API: mkfs_opts, mkfs with optional arguments.Richard W.M. Jones2010-12-021-49/+49
| | | | | | This is an extensible version of 'mkfs' which supports optional arguments. There is now no need for 'mkfs_b' since you should use 'mkfs_opts' with the optional 'blocksize' argument instead.
* generator: Code to handle optional arguments in daemon functions.Richard W.M. Jones2010-12-021-8/+0
| | | | | | | | Previously we only supported optional arguments for library functions (commit 14490c3e1aac61c6ac90f28828896683f64f0dc9). This extends that work so that optional arguments can also be passed through to the daemon.
* Add progress notification messages to upload and upload-offset APIs.Richard W.M. Jones2010-12-011-11/+28
|
* protocol: Handle progress notification messages during FileIn.Richard W.M. Jones2010-12-011-0/+1
| | | | | | | If the daemon sends progress notification messages while we are uploading FileIn parameters, these are received in check_for_daemon_cancellation_or_eof. Modify this library function so that it turns these messages into callbacks.
* protocol: Upload progress messages and optional arguments.Richard W.M. Jones2010-12-012-0/+30
| | | | | | | | Two unrelated changes to the protocol to support progress messages during uploads, and optional arguments. Note that this makes an incompatible change to the protocol, and this is reflected in the protocol version field (3 -> 4).
* daemon: Close leaked file descriptor along checksum error path (RHBZ#657499).Richard W.M. Jones2010-11-261-1/+3
|
* daemon: blkid cache is at a different location on Debian.Richard W.M. Jones2010-11-241-1/+2
| | | | Remove both possible cache locations.
* daemon: In sfdisk call blockdev --rereadpt with device name.Richard W.M. Jones2010-11-231-1/+1
|
* daemon: findfs-uuid and findfs-label should not return /dev/mapper paths.Richard W.M. Jones2010-11-161-0/+16
|