- 15 1月, 2014 1 次提交
-
-
由 Pavel Hrdina 提交于
For a "newfd1" the coverity tools thinks that the fd is closed in a "virCommandPassFD", but with "flags == 0" it cannot be closed. The code itself is ok, but coverity tool thinks that there is "double_close" of the "newfd1" and to prevent showing this error we simply add a comment before the proper close. This has been found by coverity. Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
-
- 21 10月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
When running setuid, we must be careful about what env vars we allow commands to inherit from us. Replace the virCommandAddEnvPass function with two new ones which do filtering virCommandAddEnvPassAllowSUID virCommandAddEnvPassBlockSUID And make virCommandAddEnvPassCommon use the appropriate ones Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 08 10月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
The test case average timing code has not been used by any test case ever. Delete it to remove complexity. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 18 7月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Merge the virCommandPreserveFD / virCommandTransferFD methods into a single virCommandPasFD method, and use a new VIR_COMMAND_PASS_FD_CLOSE_PARENT to indicate their difference in behaviour Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 10 7月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
-
- 10 5月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
-
- 07 5月, 2013 1 次提交
-
-
由 Eric Blake 提交于
'make distcheck' complained: ERROR: files left in build directory after distclean: ./python/libvirt.pyc ./tests/commandhelper.log Problems introduced in commits f0154959 and 25ea8e47 (both v1.0.3). * tests/commandtest.c (test21): Check (and clean) log file. * tests/commanddata/test21.log: New file. * python/Makefile.am (CLEANFILES): Clean up compiled python files. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 02 5月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
The source code base needs to be adapted as well. Some files include virutil.h just for the string related functions (here, the include is substituted to match the new file), some include virutil.h without any need (here, the include is removed), and some require both.
-
- 16 2月, 2013 1 次提交
-
-
由 John Ferlan 提交于
-
- 06 2月, 2013 1 次提交
-
-
由 Eric Blake 提交于
Commit 39c77fe5 triggered random failures, depending on the platform and what other fds leak into the testsuite (for me, it passed on RHEL 6 but failed on Fedora 18). The reason was that we were expecting an fd that fell outside of our reserved range. By reserving a larger range, the test once again passes on all platforms. * tests/commandtest.c (mymain): Reserve enough fds.
-
- 05 2月, 2013 2 次提交
-
-
由 Michal Privoznik 提交于
This is just a basic test, so we don't break virCommand in the future. A "Hello world\n" string is written to commanhelper, which copies input to stdout and stderr where we read it from. Then the read strings are compared with expected values.
-
由 Michal Privoznik 提交于
This is just preparing environment for the next patch, which is going to need an event loop.
-
- 23 1月, 2013 1 次提交
-
-
由 John Ferlan 提交于
It was possible to call VIR_FREE in cleanup prior to initialization
-
- 21 12月, 2012 4 次提交
-
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
- 02 11月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
The libvirt coding standard is to use 'function(...args...)' instead of 'function (...args...)'. A non-trivial number of places did not follow this rule and are fixed in this patch. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 25 9月, 2012 1 次提交
-
-
由 Eric Blake 提交于
Add a test to avoid virCommand regressions. * tests/commandtest.c (test8): Explicitly test env-var overrides.
-
- 21 9月, 2012 1 次提交
-
-
由 Eric Blake 提交于
https://www.gnu.org/licenses/gpl-howto.html recommends that the 'If not, see <url>.' phrase be a separate sentence. * tests/securityselinuxhelper.c: Remove doubled line. * tests/securityselinuxtest.c: Likewise. * globally: s/; If/. If/
-
- 31 8月, 2012 1 次提交
-
-
由 Eric Blake 提交于
Without this patch, logged command executions can be ambiguous if the command contained any shell metacharacters. This has caused more than one person to attempt to patch clients to add unnecessary quoting, without realizing that the command itself was run with correct args, and only the logged output was ambiguous. * src/util/command.c (virCommandToString): Add shell escapes. * tests/commandtest.c (test16): Test new behavior. * tests/commanddata/test16.log: Update expected output. * tests/qemuxml2argvdata/qemuxml2argv-*.args: Likewise. * tests/networkxml2argvdata/*.argv: Likewise.
-
- 23 7月, 2012 1 次提交
-
-
由 Osier Yang 提交于
Per the FSF address could be changed from time to time, and GNU recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html) You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>. This patch removes the explicit FSF address, and uses above instead (of course, with inserting 'Lesser' before 'General'). Except a bunch of files for security driver, all others are changed automatically, the copyright for securify files are not complete, that's why to do it manually: src/security/security_selinux.h src/security/security_driver.h src/security/security_selinux.c src/security/security_apparmor.h src/security/security_apparmor.c src/security/security_driver.c
-
- 05 6月, 2012 1 次提交
-
-
由 Eric Blake 提交于
It is possible to deadlock libvirt by having a domain with XML longer than PIPE_BUF, and by writing a hook script that closes stdin early. This is because libvirt was keeping a copy of the child's stdin read fd open, which means the write fd in the parent will never see EPIPE (remember, libvirt should always be run with SIGPIPE ignored, so we should never get a SIGPIPE signal). Since there is no error, libvirt blocks waiting for a write to complete, even though the only reader is also libvirt. The solution is to ensure that only the child can act as a reader before the parent does any writes; and then dealing with the fallout of dealing with EPIPE. Thankfully, this is not a security hole - since the only way to trigger the deadlock is to install a custom hook script, anyone that already has privileges to install a hook script already has privileges to do any number of other equally disruptive things to libvirt; it would only be a security hole if an unprivileged user could install a hook script to DoS a privileged user. * src/util/command.c (virCommandRun): Close parent's copy of child read fd earlier. (virCommandProcessIO): Don't let EPIPE be fatal; the child may be done parsing input. * tests/commandhelper.c (main): Set up a SIGPIPE situation. * tests/commandtest.c (test20): Trigger it. * tests/commanddata/test20.log: New file.
-
- 28 4月, 2012 1 次提交
-
-
由 Stefan Berger 提交于
More bug extermination in the category of: Error: CHECKED_RETURN: /libvirt/src/conf/network_conf.c:595: check_return: Calling function "virAsprintf" without checking return value (as is done elsewhere 515 out of 543 times). /libvirt/src/qemu/qemu_process.c:2780: unchecked_value: No check of the return value of "virAsprintf(&msg, "was paused (%s)", virDomainPausedReasonTypeToString(reason))". /libvirt/tests/commandtest.c:809: check_return: Calling function "setsid" without checking return value (as is done elsewhere 4 out of 5 times). /libvirt/tests/commandtest.c:830: unchecked_value: No check of the return value of "virTestGetDebug()". /libvirt/tests/commandtest.c:831: check_return: Calling function "virTestGetVerbose" without checking return value (as is done elsewhere 41 out of 42 times). /libvirt/tests/commandtest.c:833: check_return: Calling function "virInitialize" without checking return value (as is done elsewhere 18 out of 21 times). One note about the error in commandtest line 809: setsid() seems to fail when running the test -- could be removed ?
-
- 27 3月, 2012 1 次提交
-
-
由 Martin Kletzander 提交于
Return statements with parameter enclosed in parentheses were modified and parentheses were removed. The whole change was scripted, here is how: List of files was obtained using this command: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' Found files were modified with this command: sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_' Then checked for nonsense. The whole command looks like this: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
-
- 04 2月, 2012 1 次提交
-
-
由 Eric Blake 提交于
Sometimes, its easier to run children with 2>&1 in shell notation, and just deal with stdout and stderr interleaved. This was already possible for fd handling; extend it to also work when doing string capture of a child process. * docs/internals/command.html.in: Document this. * src/util/command.c (virCommandSetErrorBuffer): Likewise. (virCommandRun, virExecWithHook): Implement it. * tests/commandtest.c (test14): Test it. * daemon/remote.c (remoteDispatchAuthPolkit): Use new command feature.
-
- 28 1月, 2012 1 次提交
-
-
由 Eric Blake 提交于
Otherwise, a failed test gives misleading output. * tests/commandtest.c (test13, test14, test16): Pass arguments in correct order.
-
- 07 1月, 2012 1 次提交
-
-
由 Eric Blake 提交于
I hit a VERY weird testsuite failure on rawhide, which included _binary_ output to stderr, followed by a hang waiting for me to type something! (Here, using ^@ for NUL): $ ./commandtest TEST: commandtest WARNING: gnome-keyring:: couldn't send data: Bad file descriptor .WARNING: gnome-keyring:: couldn't send data: Bad file descriptor .WARNING: gnome-keyring:: couldn't send data: Bad file descriptor WARNING: gnome-keyring:: couldn't send data: Bad file descriptor .8^@^@^@8^@^@^@^A^@^@^@^Bay^A^@^@^@)PRIVATE-GNOME-KEYRING-PKCS11-PROTOCOL-V-1 I finally traced it to the fact that gnome-keyring, called via gnutls_global_init which is turn called by virNetTLSInit, opens an internal fd that it expects to communicate to via a pthread_atfork handler (never mind that it violates POSIX by using non-async-signal-safe functions in that handler: https://bugzilla.redhat.com/show_bug.cgi?id=772320). Our problem stems from the fact that we pulled the rug out from under the library's expectations by closing an fd that it had just opened. While we aren't responsible for fixing the bugs in that pthread_atfork handler, we can at least avoid the bugs by not closing the fd in the first place. * tests/commandtest.c (mymain): Avoid closing fds that were opened by virInitialize.
-
- 04 12月, 2011 1 次提交
-
-
由 Eric Blake 提交于
virBufferContentAndReset (intentionally) returns NULL for a buffer with no content, but it is feasible to invoke a command with an explicit empty string. * src/util/command.c (virCommandAddEnvBuffer): Reject empty string. (virCommandAddArgBuffer): Allow explicit empty argument. * tests/commandtest.c (test9): Test it. * tests/commanddata/test9.log: Adjust.
-
- 25 8月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
The VIR_TEST_DEBUG and VIR_TEST_VERBOSE env vars did not work because we replaced 'environ' with 'newenv'. Simply calling virTestGetDebug/Verbose() before replacing the 'environ' ensures we have processed the env variables. The gnutls initialization code opens /dev/urandom and keeps that FD around for later use. We have code which kills off FDs 3-5 to avoid interfereing with our test case. Move the virInitialize call before this point, so it kills off the gnutls /dev/urandom FD which is irrelevant for testing purposes * tests/commandtest.c: Fix test debugging & make it robust against opened FDs
-
- 13 8月, 2011 1 次提交
-
-
由 Eric Blake 提交于
With gcc 4.5.1: util/virpidfile.c: In function 'virPidFileAcquirePath': util/virpidfile.c:308:66: error: nested extern declaration of '_gl_verify_function2' [-Wnested-externs] Then in tests/commandtest.c, the new virPidFile APIs need to be used. * src/util/virpidfile.c (virPidFileAcquirePath): Move verify to top level. * tests/commandtest.c: Use new pid APIs.
-
- 29 7月, 2011 2 次提交
-
-
由 Matthias Bolte 提交于
Rely on PATH and use just true, because on FreeBSD it's /usr/bin/true.
-
由 Matthias Bolte 提交于
Prefer 'return EXIT_AM_SKIP' over 'exit(EXIT_AM_SKIP)'. Prefer 'int main(void)' over 'int main(int argc, char **argv)'. Fix mymain signature in commandtest and nodeinfotest.
-
- 26 7月, 2011 1 次提交
-
-
由 Laine Stump 提交于
Although most functions in libvirt return 0 on success and < 0 on failure, there are a few functions lingering around that return errno (a positive value) on failure, and sometimes code calling those functions incorrectly assumes the <0 standard. I noticed one of these the other day when auditing networkStartDhcpDaemon after Guido Gunther found a place where success was improperly returned on failure (that patch has been acked and is pending a push). The problem was that it expected the return value from virFileReadPid to be < 0 on failure, but it was actually positive (it was also neglected to set the return code in this case, similar to the bug found by Guido). This all led to the fact that *all* of the virFile*Pid functions in util.c are returning errno on failure. This patch remedies that problem by changing them all to return -errno on failure, and makes any necessary changes to callers of the functions. (In the meantime, I also properly set the return code on failure of virFileReadPid in networkStartDhcpDaemon).
-
- 22 7月, 2011 1 次提交
-
-
由 Eric Blake 提交于
In preparation for a future patch adding new virFile APIs. * src/util/files.h, src/util/files.c: Move... * src/util/virfile.h, src/util/virfile.c: ...here, and rename functions to virFile prefix. Macro names are intentionally left alone. * *.c: All '#include "files.h"' uses changed. * src/Makefile.am (UTIL_SOURCES): Reflect rename. * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise. * src/libvirt_private.syms: Likewise. * docs/hacking.html.in: Likewise. * HACKING: Regenerate.
-
- 11 5月, 2011 1 次提交
-
-
由 Eric Blake 提交于
Running ./autobuild.sh failed when gcov is installed, because commandtest ended up crashing during gcov's getenv() call after exit() had already started. I traced this nasty bug back to a scoping issue present since the test introduction. * tests/commandtest.c (mymain): Move newenv... (newenv): ...to a scope that is still useful during exit().
-
- 04 5月, 2011 1 次提交
-
-
由 Eric Blake 提交于
Unlikely to hit in real life, but clang noticed it. * tests/commandtest.c (checkoutput, test4, test18): Avoid unlink(NULL) on OOM.
-
- 30 4月, 2011 2 次提交
-
-
由 Eric Blake 提交于
* bootstrap.conf (gnulib_modules): Add getcwd-lgpl. * tests/commandtest.c (checkoutput): Drop unused cwd. * tests/commandhelper.c (main): Let getcwd malloc. * tests/testutils.c (virTestMain): Likewise. * tools/virsh.c (cmdPwd): Likewise. (virshCmds): Expose cmdPwd and cmdCd on mingw.
-
由 Eric Blake 提交于
A few of the tests were missing basic sanity checks, while most of them were doing copy-and-paste initialization (in fact, some of them pasted the argc > 1 check more than once!). It's much nicer to do things in one common place, and minimizes the size of the next patch that fixes getcwd usage. * tests/testutils.h (EXIT_AM_HARDFAIL): New define. (progname, abs_srcdir): Define for all tests. (VIRT_TEST_MAIN): Change callback signature. * tests/testutils.c (virtTestMain): Do more common init. * tests/commandtest.c (mymain): Simplify. * tests/cputest.c (mymain): Likewise. * tests/esxutilstest.c (mymain): Likewise. * tests/eventtest.c (mymain): Likewise. * tests/hashtest.c (mymain): Likewise. * tests/networkxml2xmltest.c (mymain): Likewise. * tests/nodedevxml2xmltest.c (myname): Likewise. * tests/nodeinfotest.c (mymain): Likewise. * tests/nwfilterxml2xmltest.c (mymain): Likewise. * tests/qemuargv2xmltest.c (mymain): Likewise. * tests/qemuhelptest.c (mymain): Likewise. * tests/qemuxml2argvtest.c (mymain): Likewise. * tests/qemuxml2xmltest.c (mymain): Likewise. * tests/qparamtest.c (mymain): Likewise. * tests/sexpr2xmltest.c (mymain): Likewise. * tests/sockettest.c (mymain): Likewise. * tests/statstest.c (mymain): Likewise. * tests/storagepoolxml2xmltest.c (mymain): Likewise. * tests/storagevolxml2xmltest.c (mymain): Likewise. * tests/virbuftest.c (mymain): Likewise. * tests/virshtest.c (mymain): Likewise. * tests/vmx2xmltest.c (mymain): Likewise. * tests/xencapstest.c (mymain): Likewise. * tests/xmconfigtest.c (mymain): Likewise. * tests/xml2sexprtest.c (mymain): Likewise. * tests/xml2vmxtest.c (mymain): Likewise.
-
- 25 3月, 2011 1 次提交
-
-
由 Eric Blake 提交于
Sometimes, an asynchronous helper is started (such as a compressor or iohelper program), but a later error means that we want to abort that child. Make this easier. Note that since daemons and virCommandRunAsync can't mix, the only time virCommandFree can reap a process is if someone did virCommandRunAsync for a non-daemon and didn't stash the pid. * src/util/command.h (virCommandAbort): New prototype. * src/util/command.c (_virCommand): Add new field. (virCommandRunAsync, virCommandWait): Track whether pid was used. (virCommandFree): Reap child if caller did not request pid. (virCommandAbort): New function. * src/libvirt_private.syms (command.h): Export it. * tests/commandtest.c (test19): New test.
-