CVS commit: src/sys/dev/filemon

2019-10-30 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Wed Oct 30 18:35:06 UTC 2019

Modified Files:
src/sys/dev/filemon: filemon.c

Log Message:
filemon_ioctl: check fd for write permission

Reviewed by: christos
Reported by: ivansprundel


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/filemon/filemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/filemon/filemon.c
diff -u src/sys/dev/filemon/filemon.c:1.30 src/sys/dev/filemon/filemon.c:1.31
--- src/sys/dev/filemon/filemon.c:1.30	Wed Jun  6 01:49:08 2018
+++ src/sys/dev/filemon/filemon.c	Wed Oct 30 18:35:06 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: filemon.c,v 1.30 2018/06/06 01:49:08 maya Exp $ */
+/*  $NetBSD: filemon.c,v 1.31 2019/10/30 18:35:06 sjg Exp $ */
 /*
  * Copyright (c) 2010, Juniper Networks, Inc.
  *
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.30 2018/06/06 01:49:08 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.31 2019/10/30 18:35:06 sjg Exp $");
 
 #include 
 #include 
@@ -315,6 +315,11 @@ filemon_ioctl(struct file * fp, u_long c
 			error = EBADF;
 			break;
 		}
+		if ((filemon->fm_fp->f_flag & FWRITE) == 0) {
+			closef(filemon->fm_fp);
+			filemon->fm_fp = NULL;
+			return (EBADF);
+		}
 		/* Write the file header. */
 		filemon_comment(filemon);
 		break;



CVS commit: src/sys/dev/filemon

2019-10-30 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Wed Oct 30 18:35:06 UTC 2019

Modified Files:
src/sys/dev/filemon: filemon.c

Log Message:
filemon_ioctl: check fd for write permission

Reviewed by: christos
Reported by: ivansprundel


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/filemon/filemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2019-09-26 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Sep 26 21:09:55 UTC 2019

Modified Files:
src/usr.bin/make: parse.c

Log Message:
Do not assume safe to pass NULL to realpath(3).

PR: 54574
Reviewed by: buhrow


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/usr.bin/make/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.232 src/usr.bin/make/parse.c:1.233
--- src/usr.bin/make/parse.c:1.232	Tue Apr  9 18:28:10 2019
+++ src/usr.bin/make/parse.c	Thu Sep 26 21:09:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.232 2019/04/09 18:28:10 sjg Exp $	*/
+/*	$NetBSD: parse.c,v 1.233 2019/09/26 21:09:55 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.232 2019/04/09 18:28:10 sjg Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.233 2019/09/26 21:09:55 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.232 2019/04/09 18:28:10 sjg Exp $");
+__RCSID("$NetBSD: parse.c,v 1.233 2019/09/26 21:09:55 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -670,6 +670,7 @@ ParseVErrorInternal(FILE *f, const char 
 const char *fmt, va_list ap)
 {
 	static Boolean fatal_warning_error_printed = FALSE;
+	char dirbuf[MAXPATHLEN+1];
 
 	(void)fprintf(f, "%s: ", progname);
 
@@ -688,9 +689,7 @@ ParseVErrorInternal(FILE *f, const char 
 			if (dir == NULL)
 dir = ".";
 			if (*dir != '/') {
-dir = cp2 = realpath(dir, NULL);
-free(cp);
-cp = cp2; /* cp2 set to NULL by Var_Value */
+dir = realpath(dir, dirbuf);
 			}
 			fname = Var_Value(".PARSEFILE", VAR_GLOBAL, );
 			if (fname == NULL) {



CVS commit: src/usr.bin/make

2019-09-26 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Sep 26 21:09:55 UTC 2019

Modified Files:
src/usr.bin/make: parse.c

Log Message:
Do not assume safe to pass NULL to realpath(3).

PR: 54574
Reviewed by: buhrow


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/usr.bin/make/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.bin/make

2018-05-13 Thread Simon J. Gerraty
J. Hannken-Illjes  wrote:
> After this commit parallel builds take much longer.  Building
> amd64 release with -j16 for example goes from 45 to 380 minutes.

Interesting.
Removing the sleep would help there - the busy waiting issue
isn't new anyway.


Re: CVS commit: src/usr.bin/make

2017-04-21 Thread Simon J. Gerraty
Simon J. Gerraty <s...@juniper.net> wrote:

> <co...@sdf.org> wrote:
> 
> > On Tue, Apr 11, 2017 at 05:30:13PM +, Simon J. Gerraty wrote:
> > > Log Message:
> > > Str_Match: allow [^a-z] to behave as expected.
> > 
> > % env A=NetBSD-7-x86_64 make -V '${A:MNetBSD-[^0-1]-i386}'
> > NetBSD-7-x86_64
> 
> Well that's interesting - thanks...

Fixed, and a better unit-test added.

Thanks


Re: CVS commit: src/usr.bin/make

2017-04-21 Thread Simon J. Gerraty
<co...@sdf.org> wrote:

> On Tue, Apr 11, 2017 at 05:30:13PM +0000, Simon J. Gerraty wrote:
> > Log Message:
> > Str_Match: allow [^a-z] to behave as expected.
> 
> % env A=NetBSD-7-x86_64 make -V '${A:MNetBSD-[^0-1]-i386}'
> NetBSD-7-x86_64

Well that's interesting - thanks...


Re: CVS commit: src/usr.bin/make

2016-06-04 Thread Simon J. Gerraty
Joerg Sonnenberger  wrote:
> > This improves the worst case performance (eg examining libc with
> > nothing to do) by a factor of 4.
> 
> ...except now build.sh on !NetBSD fails immediately due to missing
> strlcpy.

Should be fixed...

Don't know if you want to get carried away with tools/make/configure*
to build things like strlcpy which are available in the tree if
necessary.





Re: CVS commit: src/usr.bin/make

2016-06-04 Thread Simon J. Gerraty
Joerg Sonnenberger  wrote:
> > This improves the worst case performance (eg examining libc with
> > nothing to do) by a factor of 4.
> 
> ...except now build.sh on !NetBSD fails immediately due to missing
> strlcpy.

Gah, bmake provides strlcpy... sorry about that.


Re: CVS commit: src/usr.bin/make

2016-01-16 Thread Simon J. Gerraty
Joerg Sonnenberger  wrote:
> I suspect this change broke editors/xemacs-current, which is now failing
> with:
> 
> make[1]: make[1]: don't know how to make insert-data-in-exec. Stop

I'm guessing you are talking about a makefile that comes with emacs?
I don't see anything in editors/xemacs-current itself.
Do you happen to have an accessible machine with the makefile(s) in
question?




Re: CVS commit: src/usr.bin/make

2015-12-01 Thread Simon J. Gerraty
Joerg Sonnenberger  wrote:
> > Log Message:
> > Avoid calling brk_string() and hence Var_Export1() on
> > empty strings.
> 
> I'm not sure which change, but now I get fallout in the clang builds
> from constructs like:

Shouldn't this one since only affects exporting of vars.
More likely change to cond.c - will dig...


Re: CVS commit: src/usr.bin/make

2015-10-20 Thread Simon J. Gerraty
Thanks - fixed.

> /work/src/usr.bin/make/var.c:2772:7: error: variable 'emsg' is used 
> uninitialized whenever 'if' condition is false 
> [-Werror,-Wsometimes-uninitialized]
>   if (wantit)
> /work/src/usr.bin/make/var.c:2777:7: note: uninitialized use occurs here
>   if (emsg)


Re: CVS commit: src/lib/csu

2011-02-06 Thread Simon J. Gerraty
Making .PARSEDIR always absolute should fix this problem, but in the
general case requires realpath(). 

Yes.  Though it is worth noting that setting .PARSEDIR to .CURDIR when
the makefile path contains no '/' may be sufficient for correct
operation.

However, I'm guessing that .PARSEDIR
may not be the only path variable affected -- ISTM that the right
thing to do is to track down why assigning OBJDIR after startup does
not update all the same things that assigning it during startup does,

That would boil down to re-running main() and re-reading makefiles etc.
A lot of overhead.

A possibly simpler solution might be to shift the default objdir logic
until after sys.mk has been read, and invoke it only if cwd has not
changed.

There's still no guarantee that you won't break half the world though
;-)

--sjg


Re: CVS commit: src/lib/csu

2011-01-31 Thread Simon J. Gerraty
 I can comment out the MAKEOBJDIR assignment in nbmake-amd64 and it still
 works fine. BSDOBJDIR doesn't seem to do anything. BUILDID breaks this.
 I have no idea why those variables even exist, the code in bsd.own.mk is
 messy at best and I don't think it justifies the changes to the
 Makefiles. As such, please either kill BUILDID or find a proper fix and
 backout this change.

FWIW I think I last used BSDOBJDIR etc 10+ years ago.
I tend to use something like:

MAKEOBJDIR='${.CURDIR:S,${SRCTOP},${OBJTOP},}'

The attached patch seems to sort this out.

I didn't follow the conversation, how is this patch relevant to BUILDID?

Index: src/usr.bin/make/parse.c
===
--- src/usr.bin/make/parse.c
+++ src/usr.bin/make/parse.c
@@ -2206,11 +2206,12 @@
 char *dirname;
 int len;
 
 slash = strrchr(filename, '/');
 if (slash == NULL) {
-  Var_Set(.PARSEDIR, ., VAR_GLOBAL, 0);
+  extern char curdir[];

I thought scoped externs like this were frowned on?

+  Var_Set(.PARSEDIR, curdir, VAR_GLOBAL, 0);
   Var_Set(.PARSEFILE, filename, VAR_GLOBAL, 0);


Re: CVS commit: src/usr.bin/make

2010-04-22 Thread Simon J. Gerraty

On Thu, 22 Apr 2010 19:51:07 +, Tom Spindler writes:
 Modified Files:
  src/usr.bin/make: job.c main.c make.h
 
 Log Message:
 Just because $TMPDIR is set does not mean it is valid.
 Add a central function for creating temp files so we have one place to
 audit.

This breaks build.sh when bootstrapping nbmake on linux:

Crap - sorry,  will fix.


cc  -O -o nbmake *.o  
main.o: In function `mkTempFile':
main.c:(.text+0x618): undefined reference to `strlcpy'
collect2: ld returned 1 exit status

ERROR: Build of nbmake failed
*** BUILD ABORTED ***


Re: CVS commit: src/usr.bin/make

2010-04-22 Thread Simon J. Gerraty
Dh already commited the exact same change I just tried to.

On Thu, 22 Apr 2010 19:51:07 +, Tom Spindler writes:
 Modified Files:
  src/usr.bin/make: job.c main.c make.h
 
 Log Message:
 Just because $TMPDIR is set does not mean it is valid.
 Add a central function for creating temp files so we have one place to
 audit.

This breaks build.sh when bootstrapping nbmake on linux:

cc  -O -o nbmake *.o  
main.o: In function `mkTempFile':
main.c:(.text+0x618): undefined reference to `strlcpy'
collect2: ld returned 1 exit status

ERROR: Build of nbmake failed
*** BUILD ABORTED ***


Re: CVS commit: src/usr.bin/make

2010-04-22 Thread Simon J. Gerraty
Thanks for fixing that.

On Thu, 22 Apr 2010 22:00:26 +, David Holland writes:
On Thu, Apr 22, 2010 at 02:11:31PM -0700, Simon J. Gerraty wrote:
  Dh already commited the exact same change I just tried to.

sorry, didn't look here first. :-/


Re: CVS commit: src/usr.bin/make

2009-11-22 Thread Simon J. Gerraty
Yes, cvs log has been fixed.

 Log Message:
 PR: make.unexport
 Reviewed by:
 

Hmm, this is a little unusual commit message.

Bernd