Change in vdsm[master]: utils: Faster version of list2cmdline

nsoffer at redhat.com nsoffer at redhat.com
Sat May 10 20:52:52 UTC 2014


Nir Soffer has posted comments on this change.

Change subject: utils: Faster version of list2cmdline
......................................................................


Patch Set 1:

(2 comments)

http://gerrit.ovirt.org/#/c/27548/1/lib/vdsm/utils.py
File lib/vdsm/utils.py:

Line 656:     parts = []
Line 657:     for arg in seq:
Line 658:         if "'" in arg:
Line 659:             arg = arg.replace("'", "\'")
Line 660:         if ' ' in arg:
> doublequotes is intentionaly ignored? If so, pls mention in docstring
I assume that quoting with single quote is the simplest and safest way, so I can ignore anything "special" inside the string, except another single quote.
Line 661:             arg = "'" + arg + "'"
Line 662:         parts.append(arg)
Line 663:     return ' '.join(parts)
Line 664: 


Line 699:     if not printable:
Line 700:         printable = command
Line 701: 
Line 702:     cmdline = repr(list2cmdline(printable))
Line 703:     execCmdLogger.debug("%s (cwd %s)", cmdline, cwd)
> Using %r here (and elsewhere) would save a couple of cycles if non-debug lo
How %r would be less expensive then %s?
Line 704: 
Line 705:     p = CPopen(command, close_fds=True, cwd=cwd, env=env,
Line 706:                deathSignal=deathSignal, childUmask=childUmask)
Line 707:     p = AsyncProc(p)


-- 
To view, visit http://gerrit.ovirt.org/27548
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibfc7819c126fe51cc068cc6f9f85b1002878385b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list