Paul Stoeber | 1 Nov 2006 09:03

[PATCH] less - null bytes in file hide search results

Run
	perl -e 'print "\n"x1000,"\0z\n"' | less
and press
	/ z enter

Index: src/usr.bin/less/line.c
===================================================================
RCS file: /cvs/src/usr.bin/less/line.c,v
retrieving revision 1.9
diff -u -r1.9 line.c
--- src/usr.bin/less/line.c	11 Jan 2006 19:20:10 -0000	1.9
+++ src/usr.bin/less/line.c	1 Nov 2006 07:43:22 -0000
 <at>  <at>  -814,11 +814,12  <at>  <at> 
  * {{ This is supposed to be more efficient than forw_line(). }}
  */
 	public POSITION
-forw_raw_line(curr_pos, linep)
+forw_raw_line(curr_pos, linep, sizep)
 	POSITION curr_pos;
 	char **linep;
+	size_t *sizep;
 {
-	register int n;
+	size_t n;
 	register int c;
 	POSITION new_pos;

 <at>  <at>  -852,6 +853,8  <at>  <at> 
 	linebuf[n] = '\0';
 	if (linep != NULL)
(Continue reading)

patrick ~ | 1 Nov 2006 10:34
Picon
Favicon

Re: Reading Between the Line

Greetings,

In the two files in src/usr.bin/ftp/{cmds,util}.c
fgets(3) is passed buffer size - 1, which is not
necessary. fgets(3) will at most read one less than
buffers size passed in.

So, maybe your patch should also fix those two
instances as well?

"Charles Longeau" <chl <at> tuxfamily.org> wrote:
> Hi,
>
> Following the recent undeadly's article
> http://undeadly.org/cgi?action=article&sid=20061027031811 about fgets, I
> decided to do some grep(1) to find some other misusing "buf[strlen(buf) -
> 1] = '\0';" code.
>
> Best regards,
>
> Charles Longeau

[dd]
Index: usr.bin/ftp/cmds.c
===================================================================
RCS file: /home/chl/mirrors/cvs.obsd.org/src/usr.bin/ftp/cmds.c,v
retrieving revision 1.52
diff -u -p -r1.52 cmds.c
--- usr.bin/ftp/cmds.c  19 May 2006 04:05:35 -0000      1.52
+++ usr.bin/ftp/cmds.c  30 Oct 2006 13:20:40 -0000
(Continue reading)

Charles Longeau | 1 Nov 2006 14:02
Favicon

Re: Reading Between the Line

Hi,

Here's the updated patch with Patrick ~'s suggestion and the new way that
Ray is using to get rid of '\n' (using strchr instead of strlen twice)

Best regards,

Charles Longeau

Index: games/atc/main.c
===================================================================
RCS file: /home/chl/mirrors/cvs.obsd.org/src/games/atc/main.c,v
retrieving revision 1.14
diff -u -p -r1.14 main.c
--- games/atc/main.c	27 Mar 2006 00:10:14 -0000	1.14
+++ games/atc/main.c	1 Nov 2006 11:35:34 -0000
 <at>  <at>  -255,6 +255,7  <at>  <at>  default_game(void)
 	FILE		*fp;
 	static char	file[256];
 	char		line[256], games[256];
+	char            *p;

 	strlcpy(games, _PATH_GAMES, sizeof games);
 	strlcat(games, GAMES, sizeof games);
 <at>  <at>  -269,7 +270,8  <at>  <at>  default_game(void)
 		return (NULL);
 	}
 	fclose(fp);
-	line[strlen(line) - 1] = '\0';
+	if ((p = strchr(line, '\n')) != NULL)
(Continue reading)

Otto Moerbeek | 1 Nov 2006 20:50

diff: better time on amd64

Hi,

this diff by art <at>  moves amd64 to the timecounters mechanism. As a
result, time keeping on amd64 should be much better, especially in the
MP case. 

Please test: check ntpd behaviour before and after. Other things to
test are ping times (they should not be negative once in a while any
more) and the regress/sys/kern/gettimeofday test. 

This needs some stuff that was committed two days ago, so make sure
your tree is current.

To verify that you are using timecounters:

[otto <at> lou:22]$ sysctl kern.timecounter            
kern.timecounter.tick=1
kern.timecounter.timestepwarnings=0
kern.timecounter.hardware=i8254
kern.timecounter.choice=i8254(0) dummy(-1000000)
[otto <at> lou:23]$

Thanks,

	-Otto

Index: sys/arch/amd64/amd64/machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/machdep.c,v
retrieving revision 1.51
(Continue reading)

Ingo Schwarze | 2 Nov 2006 00:36
Picon
Favicon

utility for upgrading /etc

Nearly a year ago, Christian Weisgerber considered integrating
sysutils/mergemaster into the base system [1], but postponed it
because he intended to evaluate mergeslave first [2].

I should like to suggest the solution implemented by the patch
below.  The basic idea is taken from mergeslave [3].  That is,
diff the old and new default configurations and apply the
resulting patch to the root file system.  See the man page
and the source included below for details.

For testing the patch, i set up 3.9-stable, 4.0-release and
4.0-current source trees, applied the patch to each of them,
made release for each of them, installed the resulting 3.9-stable
on a i386 test box, changed various configuration files,
upgraded to 4.0-release, and upgraded to 4.0-current.

In case you like the idea, i am interested in expanding this to
handle configuration files from the ports tree, such that the
upgrade workflow will become:

 - reboot some bsd.rd and run ./upgrade
 - reboot the new /bsd
 - pkg_add -u (copying its default config files
               to /var/etc-dist/running, too)
 - upgrade_etc
 - check /var/etc-dist/todo
 - upgrade_etc

But let's do one step at a time and start with the base system.

(Continue reading)

Genadijus Paleckis | 3 Nov 2006 00:20
Picon

missing info

I can't find PDC205x devices (they are included in pciide(4)) in 
supported hardware list at http://www.openbsd.org/i386.html. Is it 
reason for this ?

Pierre-Yves Ritschard | 3 Nov 2006 11:26
Gravatar

reproducible crash on -current

Hi tech,

I have a pair of static routers in the following configuration:

                  | |
                  | |
                  | |
                  | |             (external network)
  -----------------------------------
       | [carp on trunk]       | [carp on trunk]
  -----------             -----------
 |           | [pfsync]  |           |
 |  router1  |===========|  router2  |
 |           |           |           |
  -----------             -----------
      | [carp on vlan on trunk] | [carp on vlan on trunk]
  ---------------------------------------
                                      (internal network)

carps are preempted and pfsync is used to synchronize states.
Using this configuration on a bare OpenBSD router (only additional
package is net-snmp), I get the following crash at boot type (just after
login: prompt):

kernel: page fault trap, code=0
Stopped at      pfsync_insert_net_state

trace output:
pfsync_insert_net_state
pfsync_input
(Continue reading)

Henning Brauer | 3 Nov 2006 13:52
Picon
Favicon

Re: testers needed to finish multiple routing tables

* Henning Brauer <henning <at> openbsd.org> [2006-10-27 16:37]:
> as you might have noticed, I am working on having multiple routing 
> tables on OpenBSD for a while. this can be used for policy routing, and 
> to implement multiple "virtual" routers on one machine.
> 
> the diff below is the last step in getting the basic funactionality 
> going, it enables the use of alternate routing tables in the forwarding 
> path.

so, who is running with this, and what are your results?

this is a fairly easy way to help us big time...

--

-- 
Henning Brauer, hb <at> bsws.de, henning <at> openbsd.org
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting - Hamburg & Amsterdam

Otto Moerbeek | 3 Nov 2006 17:15

Re: reproducible crash on -current

On Fri, 3 Nov 2006, Pierre-Yves Ritschard wrote:

> Hi tech,
> 
> I have a pair of static routers in the following configuration:
> 
>                   | |
>                   | |
>                   | |
>                   | |             (external network)
>   -----------------------------------
>        | [carp on trunk]       | [carp on trunk]
>   -----------             -----------
>  |           | [pfsync]  |           |
>  |  router1  |===========|  router2  |
>  |           |           |           |
>   -----------             -----------
>       | [carp on vlan on trunk] | [carp on vlan on trunk]
>   ---------------------------------------
>                                       (internal network)
> 
> 
> carps are preempted and pfsync is used to synchronize states.
> Using this configuration on a bare OpenBSD router (only additional
> package is net-snmp), I get the following crash at boot type (just after
> login: prompt):
> 
> kernel: page fault trap, code=0
> Stopped at      pfsync_insert_net_state

(Continue reading)

Pierre-Yves Ritschard | 3 Nov 2006 17:57
Gravatar

Re: reproducible crash on -current

* Otto Moerbeek (otto <at> drijf.net) wrote:
> 
> On Fri, 3 Nov 2006, Pierre-Yves Ritschard wrote:
> 
> > Hi tech,
> > 
> > I have a pair of static routers in the following configuration:
> > 
> >                   | |
> >                   | |
> >                   | |
> >                   | |             (external network)
> >   -----------------------------------
> >        | [carp on trunk]       | [carp on trunk]
> >   -----------             -----------
> >  |           | [pfsync]  |           |
> >  |  router1  |===========|  router2  |
> >  |           |           |           |
> >   -----------             -----------
> >       | [carp on vlan on trunk] | [carp on vlan on trunk]
> >   ---------------------------------------
> >                                       (internal network)
> > 
> > 
> > carps are preempted and pfsync is used to synchronize states.
> > Using this configuration on a bare OpenBSD router (only additional
> > package is net-snmp), I get the following crash at boot type (just after
> > login: prompt):
> > 
> > kernel: page fault trap, code=0
(Continue reading)


Gmane