On Sun, May 29, 2016 at 07:14:10AM -0400, Kenneth Westerback wrote:
> On 29 May 2016 at 02:43, Jonathan Gray <j...@jsg.id.au> wrote:
> > On Sat, May 28, 2016 at 05:38:31PM -0600, Theo de Raadt wrote:
> >> CVSROOT:      /cvs
> >> Module name:  src
> >> Changes by:   dera...@cvs.openbsd.org 2016/05/28 17:38:31
> >>
> >> Modified files:
> >>       sbin/disklabel : disklabel.c
> >>
> >> Log message:
> >> back out previous; -wAT template vnd0 fails
> >>
> >
> > The change that was backed out also broke ramdisk installs on armv7:
> >
> > Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a]
> > disklabel: unknown disk type: (null)
> >
> 
> Bob's diff was slightly flawed. I sent a 'fixed' version to them but
> not generally since I don't really know what the point of the original
> diff was. Attached if it is of use while they ponder it.

It aimed to eliminate a crash with 'disklabel /dev/tty'.

I see the logical flaw that you are fixing, but more than this diff
needs to be done. See my diff here:
https://marc.info/?l=openbsd-tech&m=146451297724427&w=2

> .... Ken
> Index: disklabel.c
> ===================================================================
> RCS file: /cvs/src/sbin/disklabel/disklabel.c,v
> retrieving revision 1.214
> diff -u -p -r1.214 disklabel.c
> --- disklabel.c       25 Nov 2015 17:17:38 -0000      1.214
> +++ disklabel.c       29 May 2016 00:25:48 -0000
> @@ -211,6 +211,7 @@ main(int argc, char *argv[])
>           &specname);
>       if (f < 0)
>               err(4, "%s", specname);
> +     readlabel(f);

You can't do readlabel(f) unconditionally here, because...

[...]

> @@ -261,9 +258,9 @@ main(int argc, char *argv[])
>               fclose(t);
>               break;
>       case WRITE:
> -             if (dflag || aflag) {
> -                     readlabel(f);
> -             } else if (argc < 2 || argc > 3)
> +             if (dflag || aflag)
> +                     ;
> +             else if (argc < 2 || argc > 3)
>                       usage();
>               else
>                       makelabel(argv[1], argc == 3 ? argv[2] : NULL, &lab);
> 

...previously makelabel() didn't follow a readlabel(f), but now it does.

Reply via email to