Change in vdsm[master]: libvirt configure: use "ed" instead of "sed --copy -i"

danken at redhat.com danken at redhat.com
Sat Aug 17 06:01:18 UTC 2013


Dan Kenigsberg has submitted this change and it was merged.

Change subject: libvirt configure: use "ed" instead of "sed --copy -i"
......................................................................


libvirt configure: use "ed" instead of "sed --copy -i"

"sed -i" generates a temp file for output, then renames the temp file to
the targeted file. Renaming a file means just changing the content of
the directory entry, and the edited file has different inode index from
the original version. So the sed edited file is a different file though
with the same file name as the original version. To use sed on
ovirt-node on bind-mounted files, we need "--copy" to copy the temp file
into targeted file instead of renaming. Unfortunately, "--copy" is
provided by a patch that is specific to the RPM packaged sed on Red Hat
family distros. The "--copy" option is neither in GNU sed [1] nor in
Single Unix Specification sed [2].

In this patch we use "ed" instead of "sed -i --copy". "ed" edits the
file in-place, by buffering the edited contents in memory and flushing
to the file at last.

[1] http://www.gnu.org/software/sed/manual/sed.html
[2] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html

Change-Id: Ic265df1a5abca0104d044f8c3048cf0643547c70
Signed-off-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/17813
Reviewed-by: Antoni Segura Puimedon <asegurap at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M lib/vdsm/tool/libvirt_configure.sh.in
M vdsm.spec.in
2 files changed, 19 insertions(+), 2 deletions(-)

Approvals:
  Antoni Segura Puimedon: Looks good to me, but someone else must approve
  Dan Kenigsberg: Looks good to me, approved
  Zhou Zheng Sheng: Verified



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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic265df1a5abca0104d044f8c3048cf0643547c70
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Mark Wu <wudxw at linux.vnet.ibm.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list