Re: [PATCH] Update link to the VMware backdoor docs

2017-06-02 Thread Seth Jackson

Bump.

Index: src/sys/dev/pv/vmt.c
===
RCS file: /cvs/src/sys/dev/pv/vmt.c,v
retrieving revision 1.12
diff -u -p -r1.12 vmt.c
--- src/sys/dev/pv/vmt.c3 Feb 2017 08:23:01 - 1.12
+++ src/sys/dev/pv/vmt.c1 Mar 2017 17:56:51 -
@@ -23,7 +23,7 @@

 /*
  * Protocol reverse engineered by Ken Kato:
- * http://chitchat.at.infoseek.co.jp/vmware/backdoor.html
+ * https://sites.google.com/site/chitchatvmback/backdoor
  */

 #include 



Re: kern_pledge: sysctl abort printing

2017-06-02 Thread Theo de Raadt
> >From my /var/log/messages:
> 
> Jun  1 22:10:25 idefix /bsd: dig(9111): sysctl 2: 1 13 16 0 -32064 32639
> Jun  1 22:10:25 idefix /bsd: dig(9111): syscall 202 ""
> Jun  1 22:10:57 idefix /bsd: dig(56469): sysctl 2: 1 13 0 0 -129840 32639
> Jun  1 22:10:57 idefix /bsd: dig(56469): syscall 202 ""
> Jun  1 22:14:03 idefix /bsd: dig(67838): sysctl 2: 1 13 999298946 0 6777188 0
> Jun  1 22:14:04 idefix /bsd: dig(67838): syscall 202 ""
> Jun  1 22:16:53 idefix /bsd: dig(10121): sysctl 2: 1 13 991450427 0 6777188 0
> Jun  1 22:16:54 idefix /bsd: dig(10121): syscall 202 ""
> 
> We're printing 5 mibs while the miblen is only 2, hence we see garbage.
> 
> Wouldn't it be better to print only this:
> 
> Jun  2 22:53:16 idefix /bsd: a.out(37619): sysctl 2: 1 13
> Jun  2 22:53:16 idefix /bsd: a.out(37619): syscall 202 ""
> 
> We could tweak it to stop after printing 5 mibs, of course. Printing the
> miblen could also be omitted, since it is kind of redundant now.
> 
> Index: kern_pledge.c
> ===
> RCS file: /var/cvs/src/sys/kern/kern_pledge.c,v
> retrieving revision 1.210
> diff -u -p -r1.210 kern_pledge.c
> --- kern_pledge.c 30 May 2017 15:04:45 -  1.210
> +++ kern_pledge.c 2 Jun 2017 20:42:21 -
> @@ -891,6 +891,8 @@ pledge_sendfd(struct proc *p, struct fil
>  int
>  pledge_sysctl(struct proc *p, int miblen, int *mib, void *new)
>  {
> + int i;
> +
>   if ((p->p_p->ps_flags & PS_PLEDGE) == 0)
>   return (0);
>  
> @@ -1053,9 +1055,11 @@ pledge_sysctl(struct proc *p, int miblen
>   mib[0] == CTL_VM && mib[1] == VM_LOADAVG)
>   return (0);
>  
> - printf("%s(%d): sysctl %d: %d %d %d %d %d %d\n",
> - p->p_p->ps_comm, p->p_p->ps_pid, miblen, mib[0], mib[1],
> - mib[2], mib[3], mib[4], mib[5]);
> + printf("%s(%d): sysctl %d:", p->p_p->ps_comm, p->p_p->ps_pid, miblen);
> + for (i = 0; i < miblen; i++)
> + printf(" %d", mib[i]);
> + printf("\n");
> +
>   return pledge_fail(p, EINVAL, 0);
>  }

Looks good to me.

I verified that sys_sysctl does a reasonable bounds-check of miblen
(aka SCARG(uap, namelen)) before calling pledge_sysctl().



kern_pledge: sysctl abort printing

2017-06-02 Thread Theo Buehler
>From my /var/log/messages:

Jun  1 22:10:25 idefix /bsd: dig(9111): sysctl 2: 1 13 16 0 -32064 32639
Jun  1 22:10:25 idefix /bsd: dig(9111): syscall 202 ""
Jun  1 22:10:57 idefix /bsd: dig(56469): sysctl 2: 1 13 0 0 -129840 32639
Jun  1 22:10:57 idefix /bsd: dig(56469): syscall 202 ""
Jun  1 22:14:03 idefix /bsd: dig(67838): sysctl 2: 1 13 999298946 0 6777188 0
Jun  1 22:14:04 idefix /bsd: dig(67838): syscall 202 ""
Jun  1 22:16:53 idefix /bsd: dig(10121): sysctl 2: 1 13 991450427 0 6777188 0
Jun  1 22:16:54 idefix /bsd: dig(10121): syscall 202 ""

We're printing 5 mibs while the miblen is only 2, hence we see garbage.

Wouldn't it be better to print only this:

Jun  2 22:53:16 idefix /bsd: a.out(37619): sysctl 2: 1 13
Jun  2 22:53:16 idefix /bsd: a.out(37619): syscall 202 ""

We could tweak it to stop after printing 5 mibs, of course. Printing the
miblen could also be omitted, since it is kind of redundant now.

Index: kern_pledge.c
===
RCS file: /var/cvs/src/sys/kern/kern_pledge.c,v
retrieving revision 1.210
diff -u -p -r1.210 kern_pledge.c
--- kern_pledge.c   30 May 2017 15:04:45 -  1.210
+++ kern_pledge.c   2 Jun 2017 20:42:21 -
@@ -891,6 +891,8 @@ pledge_sendfd(struct proc *p, struct fil
 int
 pledge_sysctl(struct proc *p, int miblen, int *mib, void *new)
 {
+   int i;
+
if ((p->p_p->ps_flags & PS_PLEDGE) == 0)
return (0);
 
@@ -1053,9 +1055,11 @@ pledge_sysctl(struct proc *p, int miblen
mib[0] == CTL_VM && mib[1] == VM_LOADAVG)
return (0);
 
-   printf("%s(%d): sysctl %d: %d %d %d %d %d %d\n",
-   p->p_p->ps_comm, p->p_p->ps_pid, miblen, mib[0], mib[1],
-   mib[2], mib[3], mib[4], mib[5]);
+   printf("%s(%d): sysctl %d:", p->p_p->ps_comm, p->p_p->ps_pid, miblen);
+   for (i = 0; i < miblen; i++)
+   printf(" %d", mib[i]);
+   printf("\n");
+
return pledge_fail(p, EINVAL, 0);
 }
 



i386 clang: fix binutils build

2017-06-02 Thread Christian Weisgerber
On i386, binutils-2.17/gas fails to build with clang:

/usr/src/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c:2107:53: error: signed
  shift result (0x1) requires 34 bits to represent, but 'offsetT'
  (aka 'long') only has 32 bits [-Werror,-Wshift-overflow]
&& ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1))
  ~~~ ^  ~~

Since ((2 << 31) - 1) is just a fancy way of saying 0x,
let's use the latter.  Note that this code is compiled on both i386
and amd64.

ok?

Index: gas/config/tc-i386.c
===
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/gas/config/tc-i386.c,v
retrieving revision 1.6
diff -u -p -r1.6 tc-i386.c
--- gas/config/tc-i386.c10 Sep 2016 14:02:32 -  1.6
+++ gas/config/tc-i386.c2 Jun 2017 16:05:49 -
@@ -2104,7 +2104,7 @@ optimize_imm ()
  (((i.op[op].imms->X_add_number & 0x) ^ 0x8000) - 0x8000);
  }
if ((i.types[op] & Imm32)
-   && ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1))
+   && ((i.op[op].imms->X_add_number & ~(offsetT) 0xL)
== 0))
  {
i.op[op].imms->X_add_number = ((i.op[op].imms->X_add_number
@@ -2183,12 +2183,12 @@ optimize_disp ()
i.types[op] &= ~Disp64;
  }
if ((i.types[op] & Disp32)
-   && (disp & ~(((offsetT) 2 << 31) - 1)) == 0)
+   && (disp & ~(offsetT) 0xL) == 0)
  {
/* If this operand is at most 32 bits, convert
   to a signed 32 bit number and don't use 64bit
   displacement.  */
-   disp &= (((offsetT) 2 << 31) - 1);
+   disp &= (offsetT) 0xL;
disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31);
i.types[op] &= ~Disp64;
  }
-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



Re: Correction for www/faq/faq10.html - yptest is dead

2017-06-02 Thread Theo Buehler
On Fri, Jun 02, 2017 at 02:04:41PM -0400, Kurt Mosiejczuk wrote:
> Was looking over the YP section of the FAQ and was intrigued to learn of
> yptest(8).  Except it was sent to the attic years ago.  So this eliminates
> its mention as a useful YP debugging tool.

fixed, thanks!

> 
> Index: faq/faq10.html
> ===
> RCS file: /cvs/www/faq/faq10.html,v
> retrieving revision 1.267
> diff -u -p -r1.267 faq10.html
> --- faq/faq10.html16 Apr 2017 16:04:47 -  1.267
> +++ faq/faq10.html2 Jun 2017 18:01:33 -
> @@ -623,9 +623,8 @@ from the YP server, but that data will n
>  ...
>  
>  
> -Other useful tools for debugging your YP setup include
> -http://man.openbsd.org/ypmatch;>ypmatch(1) and
> -http://man.openbsd.org/yptest;>yptest(8).
> +Another useful tool for debugging your YP setup is
> +http://man.openbsd.org/ypmatch;>ypmatch(1).
>  
>  
>  The second part of configuring a YP client involves editing local 
> configuration
> 



Correction for www/faq/faq10.html - yptest is dead

2017-06-02 Thread Kurt Mosiejczuk
Was looking over the YP section of the FAQ and was intrigued to learn of
yptest(8).  Except it was sent to the attic years ago.  So this eliminates
its mention as a useful YP debugging tool.

Index: faq/faq10.html
===
RCS file: /cvs/www/faq/faq10.html,v
retrieving revision 1.267
diff -u -p -r1.267 faq10.html
--- faq/faq10.html  16 Apr 2017 16:04:47 -  1.267
+++ faq/faq10.html  2 Jun 2017 18:01:33 -
@@ -623,9 +623,8 @@ from the YP server, but that data will n
 ...
 
 
-Other useful tools for debugging your YP setup include
-http://man.openbsd.org/ypmatch;>ypmatch(1) and
-http://man.openbsd.org/yptest;>yptest(8).
+Another useful tool for debugging your YP setup is
+http://man.openbsd.org/ypmatch;>ypmatch(1).
 
 
 The second part of configuring a YP client involves editing local configuration



Re: Question on getcwd(3) behavior on OpenBSD

2017-06-02 Thread Kurt Mosiejczuk
On Fri, Jun 02, 2017 at 04:37:08PM +0200, Alexander Bochmann wrote:

>  > to OpenBSD 6.1.  I've found out that git will abort in one scenario
>  > where there is a directory in the tree where the user has execute
>  > permissions but not read permissions.

> Did you use the git version from ports (2.12.2)? Between that and 
> git 2.13 they added a patch "for FreeBSD", which ignores the EACCES:

> https://github.com/git/git/commit/49a8fe8e962ed929cf5bed5520e581025f5bfe9a

> Since I don't see any conditionals around that, I assume it should 
> solve the problem on OpenBSD too? (Didn't try though.)

I did use the package.  I saw that link and was going to look at it, 
wondering if it was compiled in for OpenBSD or not.  Although it wasn't
clear it ignored the result from the release notes.  

I'll take a look at that and see if it helps.

Thanks!

--Kurt



brconfig: Unify/fix strtoul(3) handling

2017-06-02 Thread Klemens Nanni

Besides fixing a tautological 'v < 0' and using more descriptive/less
errorprone sizeof(target) this patch unifies strtoul(3) handling both
logically and cosmetically.

Index: brconfig.c
===
RCS file: /cvs/src/sbin/ifconfig/brconfig.c,v
retrieving revision 1.14
diff -u -p -r1.14 brconfig.c
--- brconfig.c  28 Nov 2016 10:12:50 -  1.14
+++ brconfig.c  2 Jun 2017 15:55:29 -
@@ -220,7 +220,6 @@ bridge_ifsetflag(const char *ifsname, u_
err(1, "%s: ioctl SIOCBRDGGIFFLGS %s", name, ifsname);

req.ifbr_ifsflags |= flag & ~IFBIF_RO_MASK;
-
if (ioctl(s, SIOCBRDGSIFFLGS, (caddr_t)) < 0)
err(1, "%s: ioctl SIOCBRDGSIFFLGS %s", name, ifsname);
}
@@ -232,12 +231,10 @@ bridge_ifclrflag(const char *ifsname, u_

strlcpy(req.ifbr_name, name, sizeof(req.ifbr_name));
strlcpy(req.ifbr_ifsname, ifsname, sizeof(req.ifbr_ifsname));
-
if (ioctl(s, SIOCBRDGGIFFLGS, (caddr_t)) < 0)
err(1, "%s: ioctl SIOCBRDGGIFFLGS %s", name, ifsname);

req.ifbr_ifsflags &= ~(flag | IFBIF_RO_MASK);
-
if (ioctl(s, SIOCBRDGSIFFLGS, (caddr_t)) < 0)
err(1, "%s: ioctl SIOCBRDGSIFFLGS %s", name, ifsname);
}
@@ -425,7 +422,8 @@ bridge_maxage(const char *arg, int d)

errno = 0;
v = strtoul(arg, , 0);
-   if (arg[0] == '\0' || endptr[0] != '\0' || v > 0xffUL ||
+   if (arg[0] == '\0' || endptr[0] != '\0' ||
+   v == 0 || v > sizeof(bp.ifbrp_maxage) ||
(errno == ERANGE && v == ULONG_MAX))
errx(1, "invalid arg for maxage: %s", arg);

@@ -444,7 +442,8 @@ bridge_priority(const char *arg, int d)

errno = 0;
v = strtoul(arg, , 0);
-   if (arg[0] == '\0' || endptr[0] != '\0' || v > 0xUL ||
+   if (arg[0] == '\0' || endptr[0] != '\0' ||
+   v == 0 || v > sizeof(bp.ifbrp_prio) ||
(errno == ERANGE && v == ULONG_MAX))
errx(1, "invalid arg for spanpriority: %s", arg);

@@ -483,7 +482,8 @@ bridge_fwddelay(const char *arg, int d)

errno = 0;
v = strtoul(arg, , 0);
-   if (arg[0] == '\0' || endptr[0] != '\0' || v > 0xffUL ||
+   if (arg[0] == '\0' || endptr[0] != '\0' ||
+   v == 0 || v > sizeof(bp.ifbrp_fwddelay) ||
(errno == ERANGE && v == ULONG_MAX))
errx(1, "invalid arg for fwddelay: %s", arg);

@@ -502,7 +502,8 @@ bridge_hellotime(const char *arg, int d)

errno = 0;
v = strtoul(arg, , 0);
-   if (arg[0] == '\0' || endptr[0] != '\0' || v > 0xffUL ||
+   if (arg[0] == '\0' || endptr[0] != '\0' ||
+   v == 0 || v > sizeof(bp.ifbrp_hellotime) ||
(errno == ERANGE && v == ULONG_MAX))
errx(1, "invalid arg for hellotime: %s", arg);

@@ -521,7 +522,8 @@ bridge_maxaddr(const char *arg, int d)

errno = 0;
newsize = strtoul(arg, , 0);
-   if (arg[0] == '\0' || endptr[0] != '\0' || newsize > 0xUL ||
+   if (arg[0] == '\0' || endptr[0] != '\0' ||
+   newsize == 0 || newsize > sizeof(bp.ifbrp_csize) ||
(errno == ERANGE && newsize == ULONG_MAX))
errx(1, "invalid arg for maxaddr: %s", arg);

@@ -537,13 +539,12 @@ bridge_deladdr(const char *addr, int d)
struct ifbareq ifba;
struct ether_addr *ea;

-   strlcpy(ifba.ifba_name, name, sizeof(ifba.ifba_name));
ea = ether_aton(addr);
if (ea == NULL)
err(1, "Invalid address: %s", addr);

+   strlcpy(ifba.ifba_name, name, sizeof(ifba.ifba_name));
bcopy(ea, _dst, sizeof(struct ether_addr));
-
if (ioctl(s, SIOCBRDGDADDR, ) < 0)
err(1, "%s: %s", name, addr);
}
@@ -555,16 +556,16 @@ bridge_ifprio(const char *ifname, const 
	unsigned long v;

char *endptr;

-   strlcpy(breq.ifbr_name, name, sizeof(breq.ifbr_name));
-   strlcpy(breq.ifbr_ifsname, ifname, sizeof(breq.ifbr_ifsname));
-
errno = 0;
v = strtoul(val, , 0);
-   if (val[0] == '\0' || endptr[0] != '\0' || v > 0xffUL ||
+   if (val[0] == '\0' || endptr[0] != '\0' ||
+   v == 0 || v > sizeof(breq.ifbr_priority) ||
(errno == ERANGE && v == ULONG_MAX))
-   err(1, "invalid arg for ifpriority: %s", val);
-   breq.ifbr_priority = v;
+   errx(1, "invalid arg for ifpriority: %s", val);

+   strlcpy(breq.ifbr_name, name, sizeof(breq.ifbr_name));
+   strlcpy(breq.ifbr_ifsname, ifname, sizeof(breq.ifbr_ifsname));
+   breq.ifbr_priority = v;
if (ioctl(s, SIOCBRDGSIFPRIO, (caddr_t)) < 0)
err(1, "%s: %s", name, val);
}
@@ -576,18 +577,16 @@ bridge_ifcost(const char *ifname, const 
	unsigned long v;

char *endptr;

-   strlcpy(breq.ifbr_name, name, sizeof(breq.ifbr_name));
-   strlcpy(breq.ifbr_ifsname, ifname, sizeof(breq.ifbr_ifsname));
-
errno = 0;
v = strtoul(val, 

ksh(1): custom completion for command containing hyphens

2017-06-02 Thread Anton Lindqvist
Hi,
Custom completions in ksh is currently limited to commands that does not
contain hyphens since such a character cannot be part of an identifier.
We could cheat and replace hyphens with underscores upon performing
completions.
The motivation behind this is that I want to add completions for
ssh-add(1). With the attached diff, I can achieve the following:

  $ set -A complete_ssh_add -- $(find ~/.ssh -name '*_rsa')

Comments? OK?

Index: edit.c
===
RCS file: /cvs/src/bin/ksh/edit.c,v
retrieving revision 1.57
diff -u -p -r1.57 edit.c
--- edit.c  8 Sep 2016 12:12:40 -   1.57
+++ edit.c  2 Jun 2017 15:00:02 -
@@ -585,7 +585,7 @@ x_try_array(const char *buf, int buflen,
 {
const char *cmd, *cp;
int cmdlen, n, i, slen;
-   char *name, *s;
+   char *ncmd, *name, *s;
struct tbl *v, *vp;
 
*nwords = 0;
@@ -604,10 +604,19 @@ x_try_array(const char *buf, int buflen,
while (cmd + cmdlen < want && !isspace((u_char)cmd[cmdlen]))
cmdlen++;
for (i = 0; i < cmdlen; i++) {
-   if (!isalnum((u_char)cmd[i]) && cmd[i] != '_')
+   if (!isalnum((u_char)cmd[i]) && cmd[i] != '_' && cmd[i] != '-')
return 0;
}
 
+   /* Normalize the command by replacing hyphens with underscores. */
+   if ((ncmd = malloc(cmdlen)) == NULL)
+   internal_errorf(1, "unable to allocate memory");
+   for (i = 0; i < cmdlen; i++)
+   if (cmd[i] == '-')
+   ncmd[i] = '_';
+   else
+   ncmd[i] = cmd[i];
+
/* Take a stab at argument count from here. */
n = 1;
for (cp = cmd + cmdlen + 1; cp < want; cp++) {
@@ -616,18 +625,21 @@ x_try_array(const char *buf, int buflen,
}
 
/* Try to find the array. */
-   if (asprintf(, "complete_%.*s_%d", cmdlen, cmd, n) < 0)
+   if (asprintf(, "complete_%.*s_%d", cmdlen, ncmd, n) < 0)
internal_errorf(1, "unable to allocate memory");
v = global(name);
free(name);
if (~v->flag & (ISSET|ARRAY)) {
-   if (asprintf(, "complete_%.*s", cmdlen, cmd) < 0)
+   if (asprintf(, "complete_%.*s", cmdlen, ncmd) < 0)
internal_errorf(1, "unable to allocate memory");
v = global(name);
free(name);
-   if (~v->flag & (ISSET|ARRAY))
+   if (~v->flag & (ISSET|ARRAY)) {
+   free(ncmd);
return 0;
+   }
}
+   free(ncmd);
 
/* Walk the array and build words list. */
for (vp = v; vp; vp = vp->u.array) {
Index: ksh.1
===
RCS file: /cvs/src/bin/ksh/ksh.1,v
retrieving revision 1.187
diff -u -p -r1.187 ksh.1
--- ksh.1   19 Feb 2017 22:09:18 -  1.187
+++ ksh.1   2 Jun 2017 15:00:02 -
@@ -4719,6 +4719,14 @@ offer a selection of signal names for th
 .Xr kill 1 :
 .Pp
 .Dl set -A complete_kill_1 -- -9 -HUP -INFO -KILL -TERM
+.Pp
+If the command contain hyphens,
+replace them with underscores.
+For example,
+offer selection of arguments to
+.Xr ssh-add 1 :
+.Pp
+.Dl set -A complete_ssh_add -- $(find ~/.ssh -name '*_rsa')
 .It complete-command: ^X^[
 Automatically completes as much as is unique of the command name having the
 partial word up to the cursor as its prefix, as in the



Re: Question on getcwd(3) behavior on OpenBSD

2017-06-02 Thread Alexander Bochmann
...on Wed, May 31, 2017 at 02:46:59PM -0400, Kurt Mosiejczuk wrote:

 > to OpenBSD 6.1.  I've found out that git will abort in one scenario
 > where there is a directory in the tree where the user has execute
 > permissions but not read permissions.

Did you use the git version from ports (2.12.2)? Between that and 
git 2.13 they added a patch "for FreeBSD", which ignores the EACCES:

https://github.com/git/git/commit/49a8fe8e962ed929cf5bed5520e581025f5bfe9a

Since I don't see any conditionals around that, I assume it should 
solve the problem on OpenBSD too? (Didn't try though.)

Alex.
(Yeah, same as over on Mastodon.)



Re: fortune(6): fix an infinite loop

2017-06-02 Thread Theo Buehler
On Fri, Jun 02, 2017 at 04:02:02PM +0200, Frederic Cambus wrote:
> Hi tech@,
> 
> When invoking fortune with the -l option (to get long dictums only),
> the program gets stuck in an infinite loop because fortlen() doesn't
> return the fortune length correctly.
> 
> Comments? OK?

nice, ok

note that netbsd fixed this 13 years ago with the same diff:
http://cvsweb.netbsd.org/bsdweb.cgi/src/games/fortune/fortune/fortune.c.diff?r1=1.40=1.41_with_tag=MAIN

> 
> Index: games/fortune/fortune/fortune.c
> ===
> RCS file: /cvs/src/games/fortune/fortune/fortune.c,v
> retrieving revision 1.55
> diff -u -p -r1.55 fortune.c
> --- games/fortune/fortune/fortune.c   7 Mar 2016 22:49:45 -   1.55
> +++ games/fortune/fortune/fortune.c   2 Jun 2017 14:00:16 -
> @@ -218,7 +218,7 @@ fortlen(void)
>   charline[BUFSIZ];
>  
>   if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED)))
> - nchar = (Seekpts[1] - Seekpts[0] <= SLEN);
> + nchar = Seekpts[1] - Seekpts[0];
>   else {
>   open_fp(Fortfile);
>   (void) fseek(Fortfile->inf, (long)Seekpts[0], SEEK_SET);
> 



fortune(6): fix an infinite loop

2017-06-02 Thread Frederic Cambus
Hi tech@,

When invoking fortune with the -l option (to get long dictums only),
the program gets stuck in an infinite loop because fortlen() doesn't
return the fortune length correctly.

Comments? OK?

Index: games/fortune/fortune/fortune.c
===
RCS file: /cvs/src/games/fortune/fortune/fortune.c,v
retrieving revision 1.55
diff -u -p -r1.55 fortune.c
--- games/fortune/fortune/fortune.c 7 Mar 2016 22:49:45 -   1.55
+++ games/fortune/fortune/fortune.c 2 Jun 2017 14:00:16 -
@@ -218,7 +218,7 @@ fortlen(void)
charline[BUFSIZ];
 
if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED)))
-   nchar = (Seekpts[1] - Seekpts[0] <= SLEN);
+   nchar = Seekpts[1] - Seekpts[0];
else {
open_fp(Fortfile);
(void) fseek(Fortfile->inf, (long)Seekpts[0], SEEK_SET);



Re: backport from clang trunk

2017-06-02 Thread Patrick Wildt
On Fri, Jun 02, 2017 at 12:18:06PM +0200, Marc Espie wrote:
> I managed to get this one in.
> 
> the rationale being that -Wno-#warnings, while highly descriptive, is a total
> bitch to pass through shell-scripts, configure, makefiles... and gcc names
> the same option -Wno-cpp anyway.
> 
> 
> okay ?

ok

> 
> Index: DiagnosticGroups.td
> ===
> RCS file: 
> /cvs/src/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td,v
> retrieving revision 1.1.1.3
> diff -u -p -r1.1.1.3 DiagnosticGroups.td
> --- DiagnosticGroups.td   24 Jan 2017 08:33:03 -  1.1.1.3
> +++ DiagnosticGroups.td   2 Jun 2017 10:16:32 -
> @@ -719,6 +719,7 @@ def Pedantic : DiagGroup<"pedantic">;
>  // Aliases.
>  def : DiagGroup<"", [Extra]>;   // -W = -Wextra
>  def : DiagGroup<"endif-labels", [ExtraTokens]>; // 
> -Wendif-labels=-Wextra-tokens
> +def : DiagGroup<"cpp", [PoundWarning]>; // -Wcpp = -W#warnings
>  def : DiagGroup<"comments", [Comment]>; // -Wcomments = -Wcomment
>  def : DiagGroup<"conversion-null",
>  [NullConversion]>; // -Wconversion-null = -Wnull-conversion
> 



Re: backport from clang trunk

2017-06-02 Thread Mark Kettenis
> Date: Fri, 2 Jun 2017 12:18:06 +0200
> From: Marc Espie 
> 
> I managed to get this one in.
> 
> the rationale being that -Wno-#warnings, while highly descriptive, is a total
> bitch to pass through shell-scripts, configure, makefiles... and gcc names
> the same option -Wno-cpp anyway.
> 
> 
> okay ?

Sure.

> Index: DiagnosticGroups.td
> ===
> RCS file: 
> /cvs/src/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td,v
> retrieving revision 1.1.1.3
> diff -u -p -r1.1.1.3 DiagnosticGroups.td
> --- DiagnosticGroups.td   24 Jan 2017 08:33:03 -  1.1.1.3
> +++ DiagnosticGroups.td   2 Jun 2017 10:16:32 -
> @@ -719,6 +719,7 @@ def Pedantic : DiagGroup<"pedantic">;
>  // Aliases.
>  def : DiagGroup<"", [Extra]>;   // -W = -Wextra
>  def : DiagGroup<"endif-labels", [ExtraTokens]>; // 
> -Wendif-labels=-Wextra-tokens
> +def : DiagGroup<"cpp", [PoundWarning]>; // -Wcpp = -W#warnings
>  def : DiagGroup<"comments", [Comment]>; // -Wcomments = -Wcomment
>  def : DiagGroup<"conversion-null",
>  [NullConversion]>; // -Wconversion-null = -Wnull-conversion
> 
> 



backport from clang trunk

2017-06-02 Thread Marc Espie
I managed to get this one in.

the rationale being that -Wno-#warnings, while highly descriptive, is a total
bitch to pass through shell-scripts, configure, makefiles... and gcc names
the same option -Wno-cpp anyway.


okay ?

Index: DiagnosticGroups.td
===
RCS file: 
/cvs/src/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 DiagnosticGroups.td
--- DiagnosticGroups.td 24 Jan 2017 08:33:03 -  1.1.1.3
+++ DiagnosticGroups.td 2 Jun 2017 10:16:32 -
@@ -719,6 +719,7 @@ def Pedantic : DiagGroup<"pedantic">;
 // Aliases.
 def : DiagGroup<"", [Extra]>;   // -W = -Wextra
 def : DiagGroup<"endif-labels", [ExtraTokens]>; // 
-Wendif-labels=-Wextra-tokens
+def : DiagGroup<"cpp", [PoundWarning]>; // -Wcpp = -W#warnings
 def : DiagGroup<"comments", [Comment]>; // -Wcomments = -Wcomment
 def : DiagGroup<"conversion-null",
 [NullConversion]>; // -Wconversion-null = -Wnull-conversion