From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:52806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFP8J-00009Q-ME for qemu-devel@nongnu.org; Thu, 28 Apr 2011 07:11:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFP8I-0002ej-It for qemu-devel@nongnu.org; Thu, 28 Apr 2011 07:11:43 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:51210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFP8I-0002eK-8e for qemu-devel@nongnu.org; Thu, 28 Apr 2011 07:11:42 -0400 Received: by fxm2 with SMTP id 2so1988130fxm.4 for ; Thu, 28 Apr 2011 04:11:40 -0700 (PDT) MIME-Version: 1.0 Sender: ico2ico2@gmail.com In-Reply-To: <1303929046-8481-1-git-send-email-sassan@sassan.me.uk> References: <1303929046-8481-1-git-send-email-sassan@sassan.me.uk> Date: Thu, 28 Apr 2011 12:11:40 +0100 Message-ID: From: Sassan Panahinejad Content-Type: multipart/alternative; boundary=002354530ebc21489b04a1f89f69 Subject: Re: [Qemu-devel] [PATCH] Fix bug with virtio-9p rename List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Sassan Panahinejad --002354530ebc21489b04a1f89f69 Content-Type: text/plain; charset=ISO-8859-1 Malahal Naineni's patch "Stop renaming files with similar name!" (posted since this one) also fixes this bug. I don't mind which one gets merged, as long as the bug gets fixed ;) Sassan On 27 April 2011 19:30, Sassan Panahinejad wrote: > After renaming a file, any existing references to the file are updated. > However, in addition to this, it would update any files whos names began > with that of the file being moved. > Therefore when renaming somefile.txt to somefile.txt-old, any references to > somefile.txt-new became somefile.txt-old-new. > This breaks debconf and probably many other applications. > This patch fixes the problem. Now only files exactly matching, or files > which are a subdirectory of a directory being moved are affected. > > Signed-off-by: Sassan Panahinejad > --- > hw/virtio-9p.c | 9 ++++++++- > 1 files changed, 8 insertions(+), 1 deletions(-) > > diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c > index 2530f6d..a2f096d 100644 > --- a/hw/virtio-9p.c > +++ b/hw/virtio-9p.c > @@ -2810,8 +2810,15 @@ static int v9fs_complete_rename(V9fsState *s, > V9fsRenameState *vs) > */ > continue; > } > + /* > + * Fix the name if > + * A: The file is the one we're moving > + * Or B: The file is a subdirectory of one we're moving > + */ > if (!strncmp(vs->fidp->path.data, fidp->path.data, > - strlen(vs->fidp->path.data))) { > + strlen(vs->fidp->path.data)) && > + (strlen(vs->fidp->path.data) == > strlen(fidp->path.data) || > + fidp->path.data[strlen(vs->fidp->path.data)] == '/')) > { > /* replace the name */ > v9fs_fix_path(&fidp->path, &vs->name, > strlen(vs->fidp->path.data)); > -- > 1.7.0.4 > > --002354530ebc21489b04a1f89f69 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Malahal Naineni's patch "Stop renaming files with similar name!&qu= ot; (posted since this one) also fixes this bug.
I don't mind which = one gets merged, as long as the bug gets fixed ;)

Sassan


On 27 April 2011 19:30, Sassan Panahinejad <sassan@sassan.me.uk= > wrote:
After renaming a file, any existing references to the file are updated.
However, in addition to this, it would update any files whos names began wi= th that of the file being moved.
Therefore when renaming somefile.txt to somefile.txt-old, any references to= somefile.txt-new became somefile.txt-old-new.
This breaks debconf and probably many other applications.
This patch fixes the problem. Now only files exactly matching, or files whi= ch are a subdirectory of a directory being moved are affected.

Signed-off-by: Sassan Panahinejad <sassan@sassan.me.uk>
---
=A0hw/virtio-9p.c | =A0 =A09 ++++++++-
=A01 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c
index 2530f6d..a2f096d 100644
--- a/hw/virtio-9p.c
+++ b/hw/virtio-9p.c
@@ -2810,8 +2810,15 @@ static int v9fs_complete_rename(V9fsState *s, V9fsRe= nameState *vs)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/*
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Fix the name if
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* A: The file is the one we're moving<= br> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Or B: The file is a subdirectory of one = we're moving
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!strncmp(vs->fidp->path.data, fi= dp->path.data,
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0strlen(vs->fidp->path.data))= ) {
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0strlen(vs->fidp->path.data))= &&
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(strlen(vs->fidp->path.data)= =3D=3D strlen(fidp->path.data) ||
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0fidp->path.data[strlen(vs->f= idp->path.data)] =3D=3D '/')) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* replace the name */
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 v9fs_fix_path(&fidp->path, = &vs->name,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 strlen= (vs->fidp->path.data));
--
1.7.0.4


--002354530ebc21489b04a1f89f69--