launch: Make the "launched failed" message more explanatory.

Since this is the most common error seen by people who have
installation problems, buggy qemu, etc, and since no one reads the
FAQ, describe in this error message what resources are available to
debug launch problems.

Cherry picked from commit 840deea12079b05a9f588016af273843d5d6e1b8
and fixed for the stable branch.
Cherry picked from commit 58f190b2b8c507c6151fd86e6fef896f842b3e87.
recipes: Add section about uploading raw filesystem content.
(cherry picked from commit 8aa8eb205b02e1014e5ed9577f4a9da9fd864aba)
(cherry picked from commit 53c4ec871d0d43dd628a9693b18017d1552ec651)
docs: Add links to various guestfs-* man pages from guestfs(3).

Cherry picked from commit 64cc0dafd03bb23ef1520c8f46fd2dd44a0d8c4e.
Remove ref to guestfs-release-notes(1) which doesn't exist in 1.18.
(cherry picked from commit 9a01948a80cf4d6c3902b23c12d88e1b886dc4a5)
rename local variable to avoid clash with match macro

match will expand to guestfs___match, rename the local variable to avoid clash.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
(cherry picked from commit b36b44af9e177fe5c9677d430abc7cba0633049c)
(cherry picked from commit 409a80476442a65b3c4498422fa6c812e21ba928)
./run: Keep gnome-keyring from disturbing test script output
(cherry picked from commit 71f87d9a8f04212fc0534b3fb423780185181585)
(cherry picked from commit 29d2be7d8e36068feea2bda5775a63672c15887c)
test-launch-race: Add comment.
(cherry picked from commit 09c372ea250e8241d62e9fde70eabe7bdca83050)
(cherry picked from commit 77ca1f94d5982a0b49a57b7787a7f89b6b0b7de4)
generator: Allow an optional emacs-mode at the top of generated files.
(cherry picked from commit a95d4261b8cedc31bfc3c5358be7b346b27d457b)
(cherry picked from commit d8014089d1585810153f97fc75d8e5e93fb34b2f)
generator: Tidy up comments in guestfs_protocol.x.
(cherry picked from commit db6a8512402f068815f882928662af0d8f5eec83)
(cherry picked from commit d7f08bc4f7b4fa50d15fcf74a41591ba952b9f1d)
docs: Link to guestfs-recipes(1) from intro in guestfs(3).
(cherry picked from commit d19e557df54f3822d38621b8c2da098bf44b4d53)
(cherry picked from commit b782d36589a981760625967b47b8e1d38aa1c90a)
remove the useless "h" option

"h" option is not enabled in virt-cat, remove it.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
(cherry picked from commit f7f746a98e8d378ac8934a7f7b82a48b3e2a5aa4)
(cherry picked from commit 9b45ae5ddeb1703ba14a4eeefde53a45e03ce0c8)
guestfs-testing(1): Start by running libguestfs-test-tool.
(cherry picked from commit 9b7813c5bd91d53e358deee64ab42b00b42c37ba)
(cherry picked from commit 7d674f2fbfa663366c957f8662822f55ed1f2e1c)
test-tool: guestfs_get_path might return NULL.

It would almost certainly indicate a bug if it happens, but
don't rely on printf not segfaulting if it did happen.
(cherry picked from commit ca2e65275d797864d2a5b3b3d0e115460522e5bb)
(cherry picked from commit c3eedd00d7d974613b4f8138211b8226e37b2c79)
test-tool: Add prominent warning about including complete output.

Everyone ignores the documentation.  Everyone ignores me even
when I specifically tell them to include the complete output.

Place a prominent notice at the beginning of the output.
(cherry picked from commit 4f3048c6be0663c6c254a765ec5f83a7b40a8808)
(cherry picked from commit 093d286f844b64dcb28543cec113c35208ea8e0d)
recipes: Add a section about diagnosing hanging guests.
(cherry picked from commit f7e138835a7194135113088767c46df65dbf292a)
(cherry picked from commit f487298ed4cff3cbda26c0a62c94b9a5e71c13df)
virt-edit: If case_sensitive_path returns an error, exit.

The 'windows_path' function was blindly copied from virt-cat.  In
virt-cat, errors are checked by the caller to 'windows_path'.  But
virt-edit lacks this check.  Change the function in virt-edit to add a
check and exit on error.
(cherry picked from commit 55b7c4df7895b8c22d737723d857a9a63db69926)
(cherry picked from commit dd913ddd0e78bd7f4a2a586fd824f467590f28d6)
inspection: Fix calls to case_sensitive_path (RHBZ#858126).

Don't assume that if guestfs_case_sensitive_path returns NULL, that it
means the file does not exist.

The (previously undefined) behaviour of case_sensitive_path was that a
NULL return meant "either the file doesn't exist or some other error".
However in commit 973581780d8a006f336684fef6762801402d775d this was
changed so that if the last element of the path didn't exist, it was
assumed to be a new file and the (non-NULL) path of the new file is
returned.

This change breaks code (including in libguestfs) which tries to use
case_sensitive_path as a dual-purpose call to fix-up a path for
Windows and test if the file exists.  Such code should be rewritten so
that it explicitly tests for file existence after calling
case_sensitive_path.

I examined all the calls to case_sensitive_path in libguestfs and
modified them where necessary.

Cherry picked from commit 9ea6e9701461e594033999150f930cc4fafec4d2.
(cherry picked from commit ff610469fb8ad1d27dac5d3cb2f1e007d8c0ecc7)
daemon: When sorting devices, don't fail on mix of /dev/sd and /dev/vd
(RHBZ#858128).

If compare_device_names was given two devices with devices with
different interfaces (eg. /dev/sda and /dev/vda) then it would try to
compare the partition numbers, and fail when it could parse them.

It's arguable what we should be doing in this case (except for
strongly discouraging people from using the interface feature), but
let's at least not cause the daemon to assert-fail.

Found by Red Hat QA, thanks Mohua Li.
(cherry picked from commit 6f53d49a27fbf7f1b5c22080e2509375e128d5e4)
(cherry picked from commit 4ff32ca76ef11cc7a7b62ba2503c037cbd791b36)
Version 1.16.32.