Re: Drop register keyword from less(1)

2015-11-03 Thread Craig Skinner
On 2015-11-02 Mon 15:57 PM |, Ted Unangst wrote:
> 
> I would say less has reached the point in its lifecycle where it can only get
> bigger and worse, so there's some merit to putting it on a diet.
> 

Ha! Less less(1).



Re: Drop register keyword from less(1)

2015-11-02 Thread Todd C. Miller
On Mon, 02 Nov 2015 09:16:07 +, Nicholas Marriott wrote:

> I looked briefly at this and it wouldn't be that hard. However, while it
> would be fantastic to clean up all the crap from less, it isn't clear if
> Garrett D'Amore is going to be keeping his fork up to date - if he
> doesn't then we are then left with a much harder job to merge later
> changes from the original less. Unless we are happy to fork and maintain
> less ourselves without an upstream.

Would it really be so bad to consider less/more feature complete
and only apply bug fixes?  The only place I expect large changes
would be in the UTF-8 support.

 - todd



Re: Drop register keyword from less(1)

2015-11-02 Thread Nicholas Marriott
On Mon, Nov 02, 2015 at 09:32:46AM -0700, Todd C. Miller wrote:
> On Mon, 02 Nov 2015 09:16:07 +, Nicholas Marriott wrote:
> 
> > I looked briefly at this and it wouldn't be that hard. However, while it
> > would be fantastic to clean up all the crap from less, it isn't clear if
> > Garrett D'Amore is going to be keeping his fork up to date - if he
> > doesn't then we are then left with a much harder job to merge later
> > changes from the original less. Unless we are happy to fork and maintain
> > less ourselves without an upstream.
> 
> Would it really be so bad to consider less/more feature complete
> and only apply bug fixes?  The only place I expect large changes
> would be in the UTF-8 support.

I suppose not, I don't think there has been much of interest for a while.



Re: Drop register keyword from less(1)

2015-11-02 Thread Michael McConville
Todd C. Miller wrote:
> On Mon, 02 Nov 2015 09:16:07 +, Nicholas Marriott wrote:
> > I looked briefly at this and it wouldn't be that hard. However,
> > while it would be fantastic to clean up all the crap from less, it
> > isn't clear if Garrett D'Amore is going to be keeping his fork up to
> > date - if he doesn't then we are then left with a much harder job to
> > merge later changes from the original less. Unless we are happy to
> > fork and maintain less ourselves without an upstream.
> 
> Would it really be so bad to consider less/more feature complete and
> only apply bug fixes?  The only place I expect large changes would be
> in the UTF-8 support.

It would be nice to be able to clean it up some. I often muse on the
fact that less is one of the first binaries to touch untrusted data on
my machines, and that it's known to be messy code.



Re: Drop register keyword from less(1)

2015-11-02 Thread Ted Unangst
Todd C. Miller wrote:
> On Mon, 02 Nov 2015 09:16:07 +, Nicholas Marriott wrote:
> 
> > I looked briefly at this and it wouldn't be that hard. However, while it
> > would be fantastic to clean up all the crap from less, it isn't clear if
> > Garrett D'Amore is going to be keeping his fork up to date - if he
> > doesn't then we are then left with a much harder job to merge later
> > changes from the original less. Unless we are happy to fork and maintain
> > less ourselves without an upstream.
> 
> Would it really be so bad to consider less/more feature complete
> and only apply bug fixes?  The only place I expect large changes
> would be in the UTF-8 support.

I would say less has reached the point in its lifecycle where it can only get
bigger and worse, so there's some merit to putting it on a diet.



Re: Drop register keyword from less(1)

2015-11-02 Thread Nicholas Marriott
On Mon, Nov 02, 2015 at 11:48:07AM -0500, Michael McConville wrote:
> Todd C. Miller wrote:
> > On Mon, 02 Nov 2015 09:16:07 +, Nicholas Marriott wrote:
> > > I looked briefly at this and it wouldn't be that hard. However,
> > > while it would be fantastic to clean up all the crap from less, it
> > > isn't clear if Garrett D'Amore is going to be keeping his fork up to
> > > date - if he doesn't then we are then left with a much harder job to
> > > merge later changes from the original less. Unless we are happy to
> > > fork and maintain less ourselves without an upstream.
> > 
> > Would it really be so bad to consider less/more feature complete and
> > only apply bug fixes?  The only place I expect large changes would be
> > in the UTF-8 support.
> 
> It would be nice to be able to clean it up some. I often muse on the
> fact that less is one of the first binaries to touch untrusted data on
> my machines, and that it's known to be messy code.

I think we should move to the Illumos fork, it looks good. I've got it
building easily enough, will take a look at porting our changes at some
point.



Re: Drop register keyword from less(1)

2015-11-02 Thread Todd C. Miller
On Mon, 02 Nov 2015 21:13:31 +, Nicholas Marriott wrote:

> I think we should move to the Illumos fork, it looks good. I've got it
> building easily enough, will take a look at porting our changes at some
> point.

Awesome.

 - todd



Re: Drop register keyword from less(1)

2015-11-02 Thread Nicholas Marriott
On Sun, Nov 01, 2015 at 06:22:53PM -0700, Todd C. Miller wrote:
> If we are going to diverge from upstream less, a better starting
> point would be https://github.com/gdamore/less-fork
> 
> See also http://garrett.damore.org/2014_09_01_archive.html
> 
> If you decide to tackle that you'll also want to diff our less
> against the stock version to make sure we don't lose any local
> changes, of which there were a few.

I looked briefly at this and it wouldn't be that hard. However, while it
would be fantastic to clean up all the crap from less, it isn't clear if
Garrett D'Amore is going to be keeping his fork up to date - if he
doesn't then we are then left with a much harder job to merge later
changes from the original less. Unless we are happy to fork and maintain
less ourselves without an upstream.

IIRC our local changes are not huge and it is pretty easy to see them in
the diff (strlcpy, SMALL, less_is_more, a few other bits).



Re: Drop register keyword from less(1)

2015-11-02 Thread Alexandr Shadchin
On Mon, Nov 2, 2015 at 2:16 PM, Nicholas Marriott <
nicholas.marri...@gmail.com> wrote:

> On Sun, Nov 01, 2015 at 06:22:53PM -0700, Todd C. Miller wrote:
> > If we are going to diverge from upstream less, a better starting
> > point would be https://github.com/gdamore/less-fork
> >
> > See also http://garrett.damore.org/2014_09_01_archive.html
> >
> > If you decide to tackle that you'll also want to diff our less
> > against the stock version to make sure we don't lose any local
> > changes, of which there were a few.
>
> I looked briefly at this and it wouldn't be that hard. However, while it
> would be fantastic to clean up all the crap from less, it isn't clear if
> Garrett D'Amore is going to be keeping his fork up to date - if he
> doesn't then we are then left with a much harder job to merge later
> changes from the original less. Unless we are happy to fork and maintain
> less ourselves without an upstream.
>
> IIRC our local changes are not huge and it is pretty easy to see them in
> the diff (strlcpy, SMALL, less_is_more, a few other bits).
>
>
Our patches https://github.com/shadchin/less/commits/openbsd for less-471
(man from -current, without merge changes less-471)

-- 
Alexandr Shadchin


Re: Drop register keyword from less(1)

2015-11-02 Thread Theo de Raadt
> I think we should move to the Illumos fork, it looks good. I've got it
> building easily enough, will take a look at porting our changes at some
> point.

I was the first one to bring it up with Todd about 4 weeks ago.
I am a big fan of this, becuase it will allow us to pledge^Wrefactor
it also.



Re: Drop register keyword from less(1)

2015-11-01 Thread Nicholas Marriott
No, I don't think we should do this because it will make updating to
upstream less more difficult, and it is painful enough as it is.



On Sun, Nov 01, 2015 at 02:25:58PM -0500, Michael McConville wrote:
> Every one of these is in a var declaration, so a megadiff is probably
> the easiest way to do it.
> 
> ok?
> 
> 
> Index: brac.c
> ===
> RCS file: /cvs/src/usr.bin/less/brac.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 brac.c
> --- brac.c25 Apr 2014 13:38:21 -  1.6
> +++ brac.c1 Nov 2015 19:19:16 -
> @@ -25,13 +25,13 @@
>   */
>   public void
>  match_brac(obrac, cbrac, forwdir, n)
> - register int obrac;
> - register int cbrac;
> + int obrac;
> + int cbrac;
>   int forwdir;
>   int n;
>  {
> - register int c;
> - register int nest;
> + int c;
> + int nest;
>   POSITION pos;
>   int (*chget)();
>  
> Index: ch.c
> ===
> RCS file: /cvs/src/usr.bin/less/ch.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 ch.c
> --- ch.c  25 Apr 2014 13:38:21 -  1.10
> +++ ch.c  1 Nov 2015 19:19:16 -
> @@ -144,11 +144,11 @@ static int ch_addbuf();
>   int
>  ch_get()
>  {
> - register struct buf *bp;
> - register struct bufnode *bn;
> - register int n;
> - register int slept;
> - register int h;
> + struct buf *bp;
> + struct bufnode *bn;
> + int n;
> + int slept;
> + int h;
>   POSITION pos;
>   POSITION len;
>  
> @@ -410,8 +410,8 @@ end_logfile()
>   public void
>  sync_logfile()
>  {
> - register struct buf *bp;
> - register struct bufnode *bn;
> + struct buf *bp;
> + struct bufnode *bn;
>   int warned = FALSE;
>   BLOCKNUM block;
>   BLOCKNUM nblocks;
> @@ -448,9 +448,9 @@ sync_logfile()
>  buffered(block)
>   BLOCKNUM block;
>  {
> - register struct buf *bp;
> - register struct bufnode *bn;
> - register int h;
> + struct buf *bp;
> + struct bufnode *bn;
> + int h;
>  
>   h = BUFHASH(block);
>   FOR_BUFS_IN_CHAIN(h, bn)
> @@ -468,7 +468,7 @@ buffered(block)
>   */
>   public int
>  ch_seek(pos)
> - register POSITION pos;
> + POSITION pos;
>  {
>   BLOCKNUM new_block;
>   POSITION len;
> @@ -537,8 +537,8 @@ ch_end_seek()
>   public int
>  ch_beg_seek()
>  {
> - register struct bufnode *bn;
> - register struct bufnode *firstbn;
> + struct bufnode *bn;
> + struct bufnode *firstbn;
>  
>   /*
>* Try a plain ch_seek first.
> @@ -595,7 +595,7 @@ ch_tell()
>   public int
>  ch_forw_get()
>  {
> - register int c;
> + int c;
>  
>   if (thisfile == NULL)
>   return (EOI);
> @@ -658,7 +658,7 @@ ch_setbufspace(bufspace)
>   public void
>  ch_flush()
>  {
> - register struct bufnode *bn;
> + struct bufnode *bn;
>  
>   if (thisfile == NULL)
>   return;
> @@ -725,8 +725,8 @@ ch_flush()
>   static int
>  ch_addbuf()
>  {
> - register struct buf *bp;
> - register struct bufnode *bn;
> + struct buf *bp;
> + struct bufnode *bn;
>  
>   /*
>* Allocate and initialize a new buffer and link it 
> @@ -750,7 +750,7 @@ ch_addbuf()
>   static void
>  init_hashtbl()
>  {
> - register int h;
> + int h;
>  
>   for (h = 0;  h < BUFHASH_SIZE;  h++)
>   {
> @@ -765,7 +765,7 @@ init_hashtbl()
>   static void
>  ch_delbufs()
>  {
> - register struct bufnode *bn;
> + struct bufnode *bn;
>  
>   while (ch_bufhead != END_OF_CHAIN)
>   {
> Index: charset.c
> ===
> RCS file: /cvs/src/usr.bin/less/charset.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 charset.c
> --- charset.c 25 Apr 2014 13:38:21 -  1.10
> +++ charset.c 1 Nov 2015 19:19:16 -
> @@ -134,9 +134,9 @@ public int binattr = AT_STANDOUT;
>  ichardef(s)
>   char *s;
>  {
> - register char *cp;
> - register int n;
> - register char v;
> + char *cp;
> + int n;
> + char v;
>  
>   n = 0;
>   v = 0;
> @@ -189,11 +189,11 @@ ichardef(s)
>   */
>   static int
>  icharset(name, no_error)
> - register char *name;
> + char *name;
>   int no_error;
>  {
> - register struct charset *p;
> - register struct cs_alias *a;
> + struct charset *p;
> + struct cs_alias *a;
>  
>   if (name == NULL || *name == '\0')
>   return (0);
> @@ -233,7 +233,7 @@ icharset(name, no_error)
>   static void
>  ilocale()
>  {
> - register int c;
> + int c;
>  
>   for (c = 0;  c < (int) sizeof(chardef);  c++)
>   {
> Index: cmdbuf.c
> ===
> RCS file: /cvs/src/usr.bin/less/cmdbuf.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 cmdbuf.c
> --- cmdbuf.c  25 Apr 2014 13:38:21 

Re: Drop register keyword from less(1)

2015-11-01 Thread Todd C. Miller
If we are going to diverge from upstream less, a better starting
point would be https://github.com/gdamore/less-fork

See also http://garrett.damore.org/2014_09_01_archive.html

If you decide to tackle that you'll also want to diff our less
against the stock version to make sure we don't lose any local
changes, of which there were a few.

 - todd



Re: Drop register keyword from less(1)

2015-11-01 Thread Theo de Raadt
less is code imported on a regular basis from upstream.
Look at the commit log.

> Every one of these is in a var declaration, so a megadiff is probably
> the easiest way to do it.
> 
> ok?
> 
> 
> Index: brac.c
> ===
> RCS file: /cvs/src/usr.bin/less/brac.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 brac.c
> --- brac.c25 Apr 2014 13:38:21 -  1.6
> +++ brac.c1 Nov 2015 19:19:16 -
> @@ -25,13 +25,13 @@
>   */
>   public void
>  match_brac(obrac, cbrac, forwdir, n)
> - register int obrac;
> - register int cbrac;
> + int obrac;
> + int cbrac;
>   int forwdir;
>   int n;
>  {
> - register int c;
> - register int nest;
> + int c;
> + int nest;
>   POSITION pos;
>   int (*chget)();
>  
> Index: ch.c
> ===
> RCS file: /cvs/src/usr.bin/less/ch.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 ch.c
> --- ch.c  25 Apr 2014 13:38:21 -  1.10
> +++ ch.c  1 Nov 2015 19:19:16 -
> @@ -144,11 +144,11 @@ static int ch_addbuf();
>   int
>  ch_get()
>  {
> - register struct buf *bp;
> - register struct bufnode *bn;
> - register int n;
> - register int slept;
> - register int h;
> + struct buf *bp;
> + struct bufnode *bn;
> + int n;
> + int slept;
> + int h;
>   POSITION pos;
>   POSITION len;
>  
> @@ -410,8 +410,8 @@ end_logfile()
>   public void
>  sync_logfile()
>  {
> - register struct buf *bp;
> - register struct bufnode *bn;
> + struct buf *bp;
> + struct bufnode *bn;
>   int warned = FALSE;
>   BLOCKNUM block;
>   BLOCKNUM nblocks;
> @@ -448,9 +448,9 @@ sync_logfile()
>  buffered(block)
>   BLOCKNUM block;
>  {
> - register struct buf *bp;
> - register struct bufnode *bn;
> - register int h;
> + struct buf *bp;
> + struct bufnode *bn;
> + int h;
>  
>   h = BUFHASH(block);
>   FOR_BUFS_IN_CHAIN(h, bn)
> @@ -468,7 +468,7 @@ buffered(block)
>   */
>   public int
>  ch_seek(pos)
> - register POSITION pos;
> + POSITION pos;
>  {
>   BLOCKNUM new_block;
>   POSITION len;
> @@ -537,8 +537,8 @@ ch_end_seek()
>   public int
>  ch_beg_seek()
>  {
> - register struct bufnode *bn;
> - register struct bufnode *firstbn;
> + struct bufnode *bn;
> + struct bufnode *firstbn;
>  
>   /*
>* Try a plain ch_seek first.
> @@ -595,7 +595,7 @@ ch_tell()
>   public int
>  ch_forw_get()
>  {
> - register int c;
> + int c;
>  
>   if (thisfile == NULL)
>   return (EOI);
> @@ -658,7 +658,7 @@ ch_setbufspace(bufspace)
>   public void
>  ch_flush()
>  {
> - register struct bufnode *bn;
> + struct bufnode *bn;
>  
>   if (thisfile == NULL)
>   return;
> @@ -725,8 +725,8 @@ ch_flush()
>   static int
>  ch_addbuf()
>  {
> - register struct buf *bp;
> - register struct bufnode *bn;
> + struct buf *bp;
> + struct bufnode *bn;
>  
>   /*
>* Allocate and initialize a new buffer and link it 
> @@ -750,7 +750,7 @@ ch_addbuf()
>   static void
>  init_hashtbl()
>  {
> - register int h;
> + int h;
>  
>   for (h = 0;  h < BUFHASH_SIZE;  h++)
>   {
> @@ -765,7 +765,7 @@ init_hashtbl()
>   static void
>  ch_delbufs()
>  {
> - register struct bufnode *bn;
> + struct bufnode *bn;
>  
>   while (ch_bufhead != END_OF_CHAIN)
>   {
> Index: charset.c
> ===
> RCS file: /cvs/src/usr.bin/less/charset.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 charset.c
> --- charset.c 25 Apr 2014 13:38:21 -  1.10
> +++ charset.c 1 Nov 2015 19:19:16 -
> @@ -134,9 +134,9 @@ public int binattr = AT_STANDOUT;
>  ichardef(s)
>   char *s;
>  {
> - register char *cp;
> - register int n;
> - register char v;
> + char *cp;
> + int n;
> + char v;
>  
>   n = 0;
>   v = 0;
> @@ -189,11 +189,11 @@ ichardef(s)
>   */
>   static int
>  icharset(name, no_error)
> - register char *name;
> + char *name;
>   int no_error;
>  {
> - register struct charset *p;
> - register struct cs_alias *a;
> + struct charset *p;
> + struct cs_alias *a;
>  
>   if (name == NULL || *name == '\0')
>   return (0);
> @@ -233,7 +233,7 @@ icharset(name, no_error)
>   static void
>  ilocale()
>  {
> - register int c;
> + int c;
>  
>   for (c = 0;  c < (int) sizeof(chardef);  c++)
>   {
> Index: cmdbuf.c
> ===
> RCS file: /cvs/src/usr.bin/less/cmdbuf.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 cmdbuf.c
> --- cmdbuf.c  25 Apr 2014 13:38:21 -  1.7
> +++ cmdbuf.c  1 Nov 2015 19:19:16 -
> @@ -525,7 +525,7 @@ cmd_ichar(cs, clen)
>   static int
>  

Drop register keyword from less(1)

2015-11-01 Thread Michael McConville
Every one of these is in a var declaration, so a megadiff is probably
the easiest way to do it.

ok?


Index: brac.c
===
RCS file: /cvs/src/usr.bin/less/brac.c,v
retrieving revision 1.6
diff -u -p -r1.6 brac.c
--- brac.c  25 Apr 2014 13:38:21 -  1.6
+++ brac.c  1 Nov 2015 19:19:16 -
@@ -25,13 +25,13 @@
  */
public void
 match_brac(obrac, cbrac, forwdir, n)
-   register int obrac;
-   register int cbrac;
+   int obrac;
+   int cbrac;
int forwdir;
int n;
 {
-   register int c;
-   register int nest;
+   int c;
+   int nest;
POSITION pos;
int (*chget)();
 
Index: ch.c
===
RCS file: /cvs/src/usr.bin/less/ch.c,v
retrieving revision 1.10
diff -u -p -r1.10 ch.c
--- ch.c25 Apr 2014 13:38:21 -  1.10
+++ ch.c1 Nov 2015 19:19:16 -
@@ -144,11 +144,11 @@ static int ch_addbuf();
int
 ch_get()
 {
-   register struct buf *bp;
-   register struct bufnode *bn;
-   register int n;
-   register int slept;
-   register int h;
+   struct buf *bp;
+   struct bufnode *bn;
+   int n;
+   int slept;
+   int h;
POSITION pos;
POSITION len;
 
@@ -410,8 +410,8 @@ end_logfile()
public void
 sync_logfile()
 {
-   register struct buf *bp;
-   register struct bufnode *bn;
+   struct buf *bp;
+   struct bufnode *bn;
int warned = FALSE;
BLOCKNUM block;
BLOCKNUM nblocks;
@@ -448,9 +448,9 @@ sync_logfile()
 buffered(block)
BLOCKNUM block;
 {
-   register struct buf *bp;
-   register struct bufnode *bn;
-   register int h;
+   struct buf *bp;
+   struct bufnode *bn;
+   int h;
 
h = BUFHASH(block);
FOR_BUFS_IN_CHAIN(h, bn)
@@ -468,7 +468,7 @@ buffered(block)
  */
public int
 ch_seek(pos)
-   register POSITION pos;
+   POSITION pos;
 {
BLOCKNUM new_block;
POSITION len;
@@ -537,8 +537,8 @@ ch_end_seek()
public int
 ch_beg_seek()
 {
-   register struct bufnode *bn;
-   register struct bufnode *firstbn;
+   struct bufnode *bn;
+   struct bufnode *firstbn;
 
/*
 * Try a plain ch_seek first.
@@ -595,7 +595,7 @@ ch_tell()
public int
 ch_forw_get()
 {
-   register int c;
+   int c;
 
if (thisfile == NULL)
return (EOI);
@@ -658,7 +658,7 @@ ch_setbufspace(bufspace)
public void
 ch_flush()
 {
-   register struct bufnode *bn;
+   struct bufnode *bn;
 
if (thisfile == NULL)
return;
@@ -725,8 +725,8 @@ ch_flush()
static int
 ch_addbuf()
 {
-   register struct buf *bp;
-   register struct bufnode *bn;
+   struct buf *bp;
+   struct bufnode *bn;
 
/*
 * Allocate and initialize a new buffer and link it 
@@ -750,7 +750,7 @@ ch_addbuf()
static void
 init_hashtbl()
 {
-   register int h;
+   int h;
 
for (h = 0;  h < BUFHASH_SIZE;  h++)
{
@@ -765,7 +765,7 @@ init_hashtbl()
static void
 ch_delbufs()
 {
-   register struct bufnode *bn;
+   struct bufnode *bn;
 
while (ch_bufhead != END_OF_CHAIN)
{
Index: charset.c
===
RCS file: /cvs/src/usr.bin/less/charset.c,v
retrieving revision 1.10
diff -u -p -r1.10 charset.c
--- charset.c   25 Apr 2014 13:38:21 -  1.10
+++ charset.c   1 Nov 2015 19:19:16 -
@@ -134,9 +134,9 @@ public int binattr = AT_STANDOUT;
 ichardef(s)
char *s;
 {
-   register char *cp;
-   register int n;
-   register char v;
+   char *cp;
+   int n;
+   char v;
 
n = 0;
v = 0;
@@ -189,11 +189,11 @@ ichardef(s)
  */
static int
 icharset(name, no_error)
-   register char *name;
+   char *name;
int no_error;
 {
-   register struct charset *p;
-   register struct cs_alias *a;
+   struct charset *p;
+   struct cs_alias *a;
 
if (name == NULL || *name == '\0')
return (0);
@@ -233,7 +233,7 @@ icharset(name, no_error)
static void
 ilocale()
 {
-   register int c;
+   int c;
 
for (c = 0;  c < (int) sizeof(chardef);  c++)
{
Index: cmdbuf.c
===
RCS file: /cvs/src/usr.bin/less/cmdbuf.c,v
retrieving revision 1.7
diff -u -p -r1.7 cmdbuf.c
--- cmdbuf.c25 Apr 2014 13:38:21 -  1.7
+++ cmdbuf.c1 Nov 2015 19:19:16 -
@@ -525,7 +525,7 @@ cmd_ichar(cs, clen)
static int
 cmd_erase()
 {
-   register char *s;
+   char *s;
int clen;
 
if (cp == cmdbuf)
Index: command.c
===
RCS file: /cvs/src/usr.bin/less/command.c,v
retrieving revision