Greg A. Woods | 1 Dec 2009 01:39
X-Face
Picon
Favicon

Re: Weirdness in comm(1)

At Sun, 29 Nov 2009 09:12:46 +0000, Roy Marples <roy <at> NetBSD.org> wrote:
Subject: Re: Weirdness in comm(1)
> 
> When I first looked at fgetstr.c and it's realloction, my first reaction 
> was that it would crash or have undefined behaviour when newsize > 
> INT_MAX. Closer inspection shows that it just reallocs the buffer on 
> each call when newsize > INT_MAX. In other words, it works, just very 
> inefficiently.

Yes, inefficient indeed.

> Attached is a patch that should restore this behaviour. Untested though.
> Does this appease you to any extent?

Yes, I think that's better than introducing a new errno, assuming it
tests OK (I haven't tried it yet either)

--

-- 
						Greg A. Woods
						Planix, Inc.

<woods <at> planix.com>       +1 416 218 0099        http://www.planix.com/
Greg A. Woods | 1 Dec 2009 01:46
X-Face
Picon
Favicon

Re: Weirdness in comm(1)

At Mon, 30 Nov 2009 23:08:36 +0100, Joerg Sonnenberger <joerg <at> britannica.bec.de> wrote:
Subject: Re: Weirdness in comm(1)
> 
> I completely disagree.

I'm not at all comfortable with the introduction of EOVERFLOW to fgetln(3).

The ability to handle lines longer than INT_MAX is much more academic.

The fact that it does it badly, is, well, not its fault, since as you say:

> At some point the libc ABI should be fixed to not
> use an internal buffer length of type int,

Indeed.  That's the real bug.  And here we'll get stuck unless a wide
enough audience can agree that we need to be able to regularly make
fixes such as this in libc.

--

-- 
						Greg A. Woods
						Planix, Inc.

<woods <at> planix.com>       +1 416 218 0099        http://www.planix.com/
Roy Marples | 1 Dec 2009 02:17
Favicon
Gravatar

Re: Weirdness in comm(1)

On Tuesday 01 December 2009 00:46:03 Greg A. Woods wrote:
> I'm not at all comfortable with the introduction of EOVERFLOW to fgetln(3).

It now gets converted to EINVAL.

> The ability to handle lines longer than INT_MAX is much more academic.

It can now handle lines up to SSIZE_MAX, but may needlessly realloc the buffer 
if reading lines > INT_MAX.

> The fact that it does it badly, is, well, not its fault, since as you say:
> > At some point the libc ABI should be fixed to not
> > use an internal buffer length of type int,
> 
> Indeed.  That's the real bug.  And here we'll get stuck unless a wide
> enough audience can agree that we need to be able to regularly make
> fixes such as this in libc.

Is there a reason that it's exposed to userland anyway?
If not, we could just #define it as void * for non libc.
That would allow for any future changes to its internals.

Thanks

Roy

Joerg Sonnenberger | 1 Dec 2009 03:55
Picon

Re: Weirdness in comm(1)

On Mon, Nov 30, 2009 at 07:46:03PM -0500, Greg A. Woods wrote:
> At Mon, 30 Nov 2009 23:08:36 +0100, Joerg Sonnenberger <joerg <at> britannica.bec.de> wrote:
> Subject: Re: Weirdness in comm(1)
> > 
> > I completely disagree.
> 
> I'm not at all comfortable with the introduction of EOVERFLOW to fgetln(3).
> 
> The ability to handle lines longer than INT_MAX is much more academic.

Let's ignore for a moment whether the limit is INT_MAX or SIZE_MAX.
fgetln does have a platform specific limit due to the amount of memory.

Imagine that fgetln uses a very smart lookup algorithm in the backend.
It can be imagined that it might know the length of the line without
reading it to memory completely or that it is using a compressed buffer
or whatever. For this reason documenting that this can result in an
error is a good way anyway.

I will fix the size_t vs int, but that's a separate question.

Joerg

NetBSD source update | 1 Dec 2009 04:10
Picon

daily CVS update output


Updating src tree:
P src/BUILDING
P src/Makefile
P src/build.sh
P src/crypto/external/bsd/netpgp/dist/src/lib/misc.c
P src/distrib/notes/common/legal.common
P src/distrib/sets/Makefile
P src/distrib/sets/checkflist
P src/distrib/sets/comments
P src/distrib/sets/deps
P src/distrib/sets/descrs
P src/distrib/sets/makeflist
P src/distrib/sets/makeobsolete
P src/distrib/sets/makesrctars
P src/distrib/sets/maketars
P src/distrib/sets/sets.subr
U src/distrib/sets/lists/base/ad.m68000
P src/doc/CHANGES
P src/etc/Makefile
P src/etc/mtree/Makefile
U src/extsrc/Makefile
U src/extsrc/Makefile.extsrc
U src/extsrc/external/Makefile
P src/gnu/lib/libgcc4/Makefile.inc
U src/gnu/lib/libgcc4/Makefile.wrapper
U src/gnu/lib/libgcc4/arch/mips64eb/funcs.S
U src/gnu/lib/libgcc4/arch/mips64eb/funcs.libgcc
U src/gnu/lib/libgcc4/arch/mips64eb/funcs.libgcc_eh
U src/gnu/lib/libgcc4/arch/mips64eb/funcs.libgcc_s
(Continue reading)

Joerg Sonnenberger | 1 Dec 2009 04:23
Picon

Re: Weirdness in comm(1)

On Tue, Dec 01, 2009 at 01:17:45AM +0000, Roy Marples wrote:
> Is there a reason that it's exposed to userland anyway?
> If not, we could just #define it as void * for non libc.
> That would allow for any future changes to its internals.

A bunch of broken programs depend on being able to look into the
internals. There is also the issue that e.g. getc is often used in the
tight inner loops and shouldn't have function call overhead without good
reasons.

Joerg

Kurt Schreiner | 1 Dec 2009 17:44
Picon
Picon
Favicon

build.sh tools fails on amd64

Hi,

running build.sh tools on amd64 with -current source updated
some minutes ago fails:

===> build.sh command: ./build.sh -u -N 1 -x -U -m amd64 -O /u/NetBSD/arch/amd64/obj -D /u/NetBSD/ar
ch/amd64/dest -T /u/NetBSD/arch/amd64/TOOLS tools
===> build.sh started: Tue Dec  1 17:40:20 MET 2009

[....]

dependall ===> binstall
     create  binstall/getid.d
     create  binstall/xinstall.d
In file included from /u/NetBSD/src/usr.bin/xinstall/xinstall.c:77:
/u/NetBSD/src/tools/binstall/../compat/sys/sha1.h:4:27: error: nbtool_config.h: No such file or directory
     create  binstall/.depend
    compile  binstall/xinstall.lo
In file included from /u/NetBSD/src/usr.bin/xinstall/xinstall.c:77:
/u/NetBSD/src/tools/binstall/../compat/sys/sha1.h:4:27: error: nbtool_config.h: No such file or directory

*** Failed target:  xinstall.lo
*** Failed command: cc -O -I/u/NetBSD/src/tools/binstall/../compat/sys
-DTARGET_STRIP=\"/u/NetBSD/arch/amd64/TOOLS/bin/x86_64--netbsd-strip\"
-I/u/NetBSD/src/usr.sbin/mtree -c -o xinstall.lo.o /u/NetBSD/src/usr.bin/xinstall/xinstall.c
*** Error code 1

Stop.
nbmake: stopped in /u/NetBSD/src/tools/binstall

(Continue reading)

Masao Uebayashi | 1 Dec 2009 18:13
Picon

Re: build.sh tools fails on amd64

> dependall ===> binstall
>      create  binstall/getid.d
>      create  binstall/xinstall.d
> In file included from /u/NetBSD/src/usr.bin/xinstall/xinstall.c:77:
> /u/NetBSD/src/tools/binstall/../compat/sys/sha1.h:4:27: error: nbtool_config.h: No such file or directory
>      create  binstall/.depend
>     compile  binstall/xinstall.lo
> In file included from /u/NetBSD/src/usr.bin/xinstall/xinstall.c:77:
> /u/NetBSD/src/tools/binstall/../compat/sys/sha1.h:4:27: error: nbtool_config.h: No such file or directory
> 
> *** Failed target:  xinstall.lo
> *** Failed command: cc -O -I/u/NetBSD/src/tools/binstall/../compat/sys
-DTARGET_STRIP=\"/u/NetBSD/arch/amd64/TOOLS/bin/x86_64--netbsd-strip\"
-I/u/NetBSD/src/usr.sbin/mtree -c -o xinstall.lo.o /u/NetBSD/src/usr.bin/xinstall/xinstall.c
> *** Error code 1
> 
> Stop.
> nbmake: stopped in /u/NetBSD/src/tools/binstall
> 
> *** Failed target:  dependall
> 
> This is with cleaned out obj, dest and tools dirs...

My bad.  I've just reverted my last change to tools/Makefile.host.  You'll
prbably need clean relevant files to proceed.  Sorry for inconvenience.

Masao

--

-- 
Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635
(Continue reading)

error compiling xulrunner

Hi,

From sources (-current and pkgsrc), dated from 20091128:

cc -o prsystem.o -c -fvisibility=hidden   -I/usr/include
-I/usr/pkg/include/pyth
on2.5 -I/usr/pkg/include -I/usr/pkg/include/freetype2 -O2 -I/usr/include
-I/usr/
pkg/include/python2.5 -I/usr/pkg/include -I/usr/pkg/include/freetype2
-ansi -Wal
l -pthread -O2 -fPIC -DPIC  -UDEBUG  -DMOZILLA_CLIENT=1 -DNDEBUG=1
-DHAVE_VISIBI
LITY_HIDDEN_ATTRIBUTE=1 -DHAVE_VISIBILITY_PRAGMA=1 -DXP_UNIX=1
-DNETBSD=1 -DHAVE
_BSD_FLOCK=1 -DHAVE_SOCKLEN_T=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 
-DFORCE_PR_LO
G -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -D_NSPR_BUILD_
-I/pkg_comp/obj/pkgsrc/devel/xulrunner/default/mozilla-1.9.1/dist/include/nspr
-I../../../pr/include -I../../../pr/include/private  prsystem.c
In file included from /usr/include/sys/proc.h:83,
                 from /usr/include/sys/sysctl.h:46,
                 from prsystem.c:62:
/usr/include/sys/lwp.h:200: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'void'
make[5]: *** [prsystem.o] Error 1
make[5]: Leaving directory
`/pkg_comp/obj/pkgsrc/devel/xulrunner/default/mozilla-1.9.1/nsprpub/pr/src/misc'

Is this a system error?

(Continue reading)

Kurt Schreiner | 1 Dec 2009 18:28
Picon
Picon
Favicon

Re: build.sh tools fails on amd64

On Wed, Dec 02, 2009 at 02:13:22AM +0900, Masao Uebayashi wrote:
> > dependall ===> binstall
> >      create  binstall/getid.d
> >      create  binstall/xinstall.d
> > In file included from /u/NetBSD/src/usr.bin/xinstall/xinstall.c:77:
> > /u/NetBSD/src/tools/binstall/../compat/sys/sha1.h:4:27: error: nbtool_config.h: No such file
or directory
> >      create  binstall/.depend
> >     compile  binstall/xinstall.lo
> > In file included from /u/NetBSD/src/usr.bin/xinstall/xinstall.c:77:
> > /u/NetBSD/src/tools/binstall/../compat/sys/sha1.h:4:27: error: nbtool_config.h: No such file
or directory
> > 
> > *** Failed target:  xinstall.lo
> > *** Failed command: cc -O -I/u/NetBSD/src/tools/binstall/../compat/sys
-DTARGET_STRIP=\"/u/NetBSD/arch/amd64/TOOLS/bin/x86_64--netbsd-strip\"
-I/u/NetBSD/src/usr.sbin/mtree -c -o xinstall.lo.o /u/NetBSD/src/usr.bin/xinstall/xinstall.c
> > *** Error code 1
> > 
> > Stop.
> > nbmake: stopped in /u/NetBSD/src/tools/binstall
> > 
> > *** Failed target:  dependall
> > 
> > This is with cleaned out obj, dest and tools dirs...
> 
> My bad.  I've just reverted my last change to tools/Makefile.host.  You'll
> prbably need clean relevant files to proceed.  Sorry for inconvenience.
Yep! cvs updated,  cleaned obj and build.sh 's running fine again.
Thanks for the quick fix.
(Continue reading)


Gmane