bug in cvs using diff -p

Vincent Stemen vs1 at crel.us
Tue Sep 4 01:13:08 PDT 2007


On 2007-09-04, Matthew Dillon <dillon at apollo.backplane.com> wrote:
>
>     It's a bug.  Try this patch.
>
> 					-Matt
>
> Index: md.c
>===================================================================
> RCS file: /cvs/src/sys/dev/disk/md/md.c,v
> retrieving revision 1.17
> diff -u -p -r1.17 md.c
> --- md.c	31 Jul 2007 20:04:48 -0000	1.17
> +++ md.c	4 Sep 2007 02:18:45 -0000
> @@ -373,6 +373,8 @@ 		DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_
>  		DEVSTAT_PRIORITY_OTHER);
>  	sc->dev = disk_create(sc->unit, &sc->disk, &md_ops);
>  	sc->dev->si_drv1 = sc;
> +	sc->dev->si_iosize_max = DFLTPHYS;
> +
>  	return (sc);
>  }


Hi Matt.

I ended up manually patching this.  It failed every time, using patch.
Luckily, in this case, it was just a simple 1 liner.

I finally tracked down the problem.  I noticed you used cvs to create
the patch.

It is apparently a bug with cvs 1.12.13 on Dragonfly.  I tested with cvs
1.11.20 on NetBSD and it worked properly, so it is apparently a bug cvs
has introduced in the newer version.

When using the -p option to diff when running under cvs, it outputs
a broken patch file.  The problem is that it outputs the previous line
at the end of the '@@' line rather than the function name.

# cvs diff -u -p md.c
Index: md.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/disk/md/md.c,v
retrieving revision 1.16.2.1
diff -u -p -r1.16.2.1 md.c
--- md.c        31 Jul 2007 22:40:49 -0000      1.16.2.1
+++ md.c        4 Sep 2007 06:36:37 -0000
@@ -373,6 +373,8 @@             DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_
                DEVSTAT_PRIORITY_OTHER);
        sc->dev = disk_create(sc->unit, &sc->disk, &md_ops);
        sc->dev->si_drv1 = sc;
+       sc->dev->si_iosize_max = DFLTPHYS;
+
        return (sc);
 }


========================

It worked properly with the same options using diff directly.
The output should look like this.

# diff -u -p md.c md.c-manually_patched

--- md.c	2007-09-04 01:30:23.000000000 -0500
+++ md.c-manually_patched	2007-09-04 01:20:44.000000000 -0500
@@ -373,6 +373,8 @@ mdcreate(void)
 		DEVSTAT_PRIORITY_OTHER);
 	sc->dev = disk_create(sc->unit, &sc->disk, &md_ops);
 	sc->dev->si_drv1 = sc;
+	sc->dev->si_iosize_max = DFLTPHYS;
+
 	return (sc);
 }
 
========================


Notice it shows the "mdcreate(void)" function at the end of the "@@"
line.

I noticed, on the cvs site, that 1.12.13 is not in the stable tree.  You
might want to consider downgrading it to version 1.11.22 on Dragonfly,
which is the latest one I see in the stable branch.

Regards,
Vincent






More information about the Bugs mailing list