Re: Bug in less version 406.

2007-08-04 Thread Sean C. Farley

On Sat, 4 Aug 2007, Pieter de Goeje wrote:


On Saturday 04 August 2007, Sean C. Farley wrote:

On Sat, 4 Aug 2007, Pieter de Goeje wrote:

*snip*


There's also another regression in less: it doesn't automatically
repaint the screen anymore when you resize the terminal.


I have already reported that regression to Mark Nudelman.  He is
looking into an appropriate fix since this regression was introduced
when fixing another bug.


Hmm I wonder what that other bug might have been...
If I look at signal.c I see two signal handlers for things related to
window changes. One for SIGWINCH and one for SIGWIND. The "if(reading)
intread();" statement was removed from the SIGWINCH handler. If
removing that statement fixed the other bug why wasn't it removed from
SIGWIND's handler? Does SIGWIND have different semantics?

Anyway, re-adding "if(reading) intread();" to signal.c:96 makes it
work again, but I wonder what I broke by doing that.


Yes, that is the fix for the resizing.

This is the bug in question[1]:
Fix bug when resizing the window while waiting for input from a
pipe.

Sean
  1. http://www.greenwoodsoftware.com/less/news.406.html
--
[EMAIL PROTECTED]
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Bug in less version 406.

2007-08-03 Thread Pieter de Goeje
On Saturday 04 August 2007, Alexander Kabaev wrote:
> On Sat, 4 Aug 2007 01:29:57 +0200
>
> Pieter de Goeje <[EMAIL PROTECTED]> wrote:
> > There's also another regression in less: it doesn't automatically
> > repaint the screen anymore when you resize the terminal.
> >
> > Regards,
> > Pieter de Goeje
>
> It most certainly does here.
That's odd, are you sure you are using version 406?

To clarify: you need to press a key before less notices the change in window 
size and redraws the screen.

- Pieter de Goeje
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Bug in less version 406.

2007-08-03 Thread Alexander Kabaev
On Sat, 4 Aug 2007 01:29:57 +0200
Pieter de Goeje <[EMAIL PROTECTED]> wrote:

> There's also another regression in less: it doesn't automatically
> repaint the screen anymore when you resize the terminal.
> 
> Regards,
> Pieter de Goeje

It most certainly does here.

-- 
Alexander Kabaev


signature.asc
Description: PGP signature


Re: Bug in less version 406.

2007-08-03 Thread Pieter de Goeje
On Saturday 04 August 2007, Sean C. Farley wrote:
> On Sat, 4 Aug 2007, Pieter de Goeje wrote:
>
> *snip*
>
> > There's also another regression in less: it doesn't automatically
> > repaint the screen anymore when you resize the terminal.
>
> I have already reported that regression to Mark Nudelman.  He is looking
> into an appropriate fix since this regression was introduced when fixing
> another bug.
>
> Sean
Hmm I wonder what that other bug might have been...
If I look at signal.c I see two signal handlers for things related to window 
changes. One for SIGWINCH and one for SIGWIND. The "if(reading) intread();" 
statement was removed from the SIGWINCH handler. If removing that statement 
fixed the other bug why wasn't it removed from SIGWIND's handler? Does 
SIGWIND have different semantics?

Anyway, re-adding "if(reading) intread();" to signal.c:96 makes it work again, 
but I wonder what I broke by doing that.

Regards,
Pieter de Goeje
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Bug in less version 406.

2007-08-03 Thread Sean C. Farley

On Sat, 4 Aug 2007, Pieter de Goeje wrote:

*snip*


There's also another regression in less: it doesn't automatically
repaint the screen anymore when you resize the terminal.


I have already reported that regression to Mark Nudelman.  He is looking
into an appropriate fix since this regression was introduced when fixing
another bug.

Sean
--
[EMAIL PROTECTED]
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Bug in less version 406.

2007-08-03 Thread Pieter de Goeje
On Friday 03 August 2007, Xin LI wrote:
> Graham Menhennitt wrote:
> > Ted Hatfield wrote:
> >> Using less -E or more to display a file that is less than a full page,
> >> while then displaying a nonexistent file causes a segmentation fault.
> >>
> >> For example on a newly built system you can
> >>
> >> less -E /etc/group bogusfile
> >>
> >>
> >> This will display the file ending with
> >>
> >> /etc/group (file 1 of 2) (END) - Next: bogusfile
> >>
> >> when you press space or return it gives
> >>
> >> Segmentation fault: 11
> >
> > I can reproduce it using "more" but not "less -E". This is on -Current
> > as of a week or so ago. TERM=xterm.
>
> I can reliably reproduce this with less -E on both -CURRENT and
> -STABLE... :S  I need to do an operation on my eye this weekend so I
> have to wait a couple of days until I can recover from this.
Less keeps an internal filestate associated with each opened file. However 
before opening the bogus file, it free()s the state. Less then notices that 
the bogus file can't be opened, calls error(), which does some calculations 
on the filestate ('thisfile' in ch.c) and crashes (Use after free). I have 
written a workaround (attached) that moves the error() call below the 
reinitialization of the previous state.
FYI it doesn't crash on the first file because any_display is not yet TRUE, 
which causes error() to ignore the filestate.

There's also another regression in less: it doesn't automatically repaint the 
screen anymore when you resize the terminal.

Regards,
Pieter de Goeje
--- contrib/less/edit.c.orig	2007-07-03 15:02:06.0 +0200
+++ contrib/less/edit.c	2007-08-04 01:03:43.0 +0200
@@ -308,8 +308,6 @@
 		/*
 		 * It looks like a bad file.  Don't try to open it.
 		 */
-		error("%s", &parg);
-		free(parg.p_string);
 	err1:
 		if (alt_filename != NULL)
 		{
@@ -331,6 +329,13 @@
 			quit(QUIT_ERROR);
 		}
 		reedit_ifile(was_curr_ifile);
+
+		/*
+		 * Cannot print the error if filestate isn't initialized.
+		 */
+		error("%s", &parg);
+		free(parg.p_string);
+
 		return (1);
 	} else if ((f = open(qopen_filename, OPEN_READ)) < 0)
 	{
@@ -338,8 +343,6 @@
 		 * Got an error trying to open it.
 		 */
 		parg.p_string = errno_message(filename);
-		error("%s", &parg);
-		free(parg.p_string);
 		goto err1;
 	} else 
 	{
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Re: Bug in less version 406.

2007-08-03 Thread Xin LI
Graham Menhennitt wrote:
> Ted Hatfield wrote:
>> Using less -E or more to display a file that is less than a full page,
>> while then displaying a nonexistent file causes a segmentation fault.
>>
>> For example on a newly built system you can
>>
>> less -E /etc/group bogusfile
>>
>>
>> This will display the file ending with
>>
>> /etc/group (file 1 of 2) (END) - Next: bogusfile
>>
>> when you press space or return it gives
>>
>> Segmentation fault: 11
>>
> 
> I can reproduce it using "more" but not "less -E". This is on -Current
> as of a week or so ago. TERM=xterm.

I can reliably reproduce this with less -E on both -CURRENT and
-STABLE... :S  I need to do an operation on my eye this weekend so I
have to wait a couple of days until I can recover from this.

Cheers,
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Bug in less version 406.

2007-08-03 Thread Graham Menhennitt
Ted Hatfield wrote:
>
> Using less -E or more to display a file that is less than a full page,
> while then displaying a nonexistent file causes a segmentation fault.
>
> For example on a newly built system you can
>
> less -E /etc/group bogusfile
>
>
> This will display the file ending with
>
> /etc/group (file 1 of 2) (END) - Next: bogusfile
>
> when you press space or return it gives
>
> Segmentation fault: 11
>

I can reproduce it using "more" but not "less -E". This is on -Current
as of a week or so ago. TERM=xterm.

Graham
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Bug in less version 406.

2007-08-02 Thread Ted Hatfield



On Thu, 2 Aug 2007, Jeremy Chadwick wrote:


On Thu, Aug 02, 2007 at 01:08:47PM -0500, Stephen Montgomery-Smith wrote:

 For me this is one of those intermittent faults.  Sometimes it segfaults,
 and sometimes it doesn't.


I can't reproduce this on any of the 3 systems I have easy access to,
either with less -E or more.

The less options I use, for what it's worth:

LESS=-MRX
LESSHISTFILE=-

Could this be a terminal definition problem?  I use TERM=xterm, SSH
session is via PuTTY.



TERM=vt100, SSH session via SecureCRT version 3.3.

I copied the binaries for less and more version 394 from another machine 
which I haven't updated yet and those binaries work without issues.


What the exact problem is I not sure but it's probably something in the 
version 4 code tree for less.  I've emailed a bug report to the author at 
[EMAIL PROTECTED]


This bug isn't system breaking and I've told my user that found the bug to 
see if he could work around it.


I mostly wanted to see if anyone else could replicate the problem before I 
looked into sending a bug report.


Ted Hatfield

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Bug in less version 406.

2007-08-02 Thread Jeremy Chadwick
On Thu, Aug 02, 2007 at 01:08:47PM -0500, Stephen Montgomery-Smith wrote:
>  For me this is one of those intermittent faults.  Sometimes it segfaults, 
>  and sometimes it doesn't.

I can't reproduce this on any of the 3 systems I have easy access to,
either with less -E or more.

The less options I use, for what it's worth:

LESS=-MRX
LESSHISTFILE=-

Could this be a terminal definition problem?  I use TERM=xterm, SSH
session is via PuTTY.

-- 
| Jeremy Chadwickjdc at parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Bug in less version 406.

2007-08-02 Thread Stephen Montgomery-Smith

David Wolfskill wrote:

On Thu, Aug 02, 2007 at 12:14:37PM -0500, Ted Hatfield wrote:

Can someone verify this bug for me please and suggest a fix.

Error description:

Using less -E or more to display a file that is less than a full page, 
while then displaying a nonexistent file causes a segmentation fault.


I was able to recrerate the symptoms using more, but not "less -E".


For example on a newly built system you can

less -E /etc/group bogusfile


This will display the file ending with

/etc/group (file 1 of 2) (END) - Next: bogusfile

when you press space or return it gives

Segmentation fault: 11


I did:

g1-18(6.2-S)[1] cd /tmp
g1-18(6.2-S)[2] head /etc/group >group
g1-18(6.2-S)[3] less -E group fubar

and didn't see a problem

Using more(1), I got:

g1-18(6.2-S)[5] more group fubar
# $FreeBSD: src/etc/group,v 1.32.2.1 2006/03/06 22:23:10 rwatson Exp $
#
wheel:*:0:root,david
daemon:*:1:
kmem:*:2:
sys:*:3:
tty:*:4:
operator:*:5:root
mail:*:6:
bin:*:7:
Segmentation fault (core dumped)
g1-18(6.2-S)[6] 


For me this is one of those intermittent faults.  Sometimes it 
segfaults, and sometimes it doesn't.


Stephen

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Bug in less version 406.

2007-08-02 Thread David Wolfskill
On Thu, Aug 02, 2007 at 12:14:37PM -0500, Ted Hatfield wrote:
> 
> Can someone verify this bug for me please and suggest a fix.
> 
> Error description:
> 
> Using less -E or more to display a file that is less than a full page, 
> while then displaying a nonexistent file causes a segmentation fault.

I was able to recrerate the symptoms using more, but not "less -E".

> For example on a newly built system you can
> 
> less -E /etc/group bogusfile
> 
> 
> This will display the file ending with
> 
> /etc/group (file 1 of 2) (END) - Next: bogusfile
> 
> when you press space or return it gives
> 
> Segmentation fault: 11

I did:

g1-18(6.2-S)[1] cd /tmp
g1-18(6.2-S)[2] head /etc/group >group
g1-18(6.2-S)[3] less -E group fubar

and didn't see a problem

Using more(1), I got:

g1-18(6.2-S)[5] more group fubar
# $FreeBSD: src/etc/group,v 1.32.2.1 2006/03/06 22:23:10 rwatson Exp $
#
wheel:*:0:root,david
daemon:*:1:
kmem:*:2:
sys:*:3:
tty:*:4:
operator:*:5:root
mail:*:6:
bin:*:7:
Segmentation fault (core dumped)
g1-18(6.2-S)[6] 

This is with:

g1-18(6.2-S)[6] uname -a
FreeBSD g1-18.catwhisker.org. 6.2-STABLE FreeBSD 6.2-STABLE #464: Thu Aug  2 
06:16:43 PDT 2007 [EMAIL PROTECTED]:/common/S1/obj/usr/src/sys/CANARY  i386
g1-18(6.2-S)[7] less -V
less 406
Copyright (C) 1984-2005 Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
g1-18(6.2-S)[8] 

>...

Peace,
david
-- 
David H. Wolfskill  [EMAIL PROTECTED]
Anything and everything is a (potential) cat toy.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.


pgp4HBLvC3CqG.pgp
Description: PGP signature


Bug in less version 406.

2007-08-02 Thread Ted Hatfield


Can someone verify this bug for me please and suggest a fix.

Error description:

Using less -E or more to display a file that is less than a full page, 
while then displaying a nonexistent file causes a segmentation fault.


For example on a newly built system you can

less -E /etc/group bogusfile


This will display the file ending with

/etc/group (file 1 of 2) (END) - Next: bogusfile

when you press space or return it gives

Segmentation fault: 11



If you choose a file that is longer than 1 page the process works as 
expected.


For example

less -E /etc/hosts.allow bogusfile

works as expected.


I have confirmed this behaviour on 3 different machines all built within a 
week of each other.


The newest machine was built on

FreeBSD 6.2-STABLE (GENERIC) #0: Thu Jul 26 02:20:28 CDT 2007

Thanks,

Ted Hatfield

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"