Non-const basename: usr.bin/cvs

2020-10-16 Thread Christian Weisgerber
Accommodate POSIX basename(3) that takes a non-const parameter and
may modify the string buffer.

There were only two compiler warnings about discarded const, but
there are numerous instances where the code assumes non-POSIX
semantics for basename() and dirname().  Given that there is at
least a FreeBSD port of OpenCVS, cleaning this up is more than
cosmetic.

This could definitely use proofreading.

I chose __func__ (otherwise not used anywhere) over breaking an overly
long "function_" "name" into parts like that.

OK?

Index: usr.bin/cvs/admin.c
===
RCS file: /cvs/src/usr.bin/cvs/admin.c,v
retrieving revision 1.68
diff -u -p -r1.68 admin.c
--- usr.bin/cvs/admin.c 1 Jun 2017 08:08:24 -   1.68
+++ usr.bin/cvs/admin.c 16 Oct 2020 21:14:05 -
@@ -246,12 +246,17 @@ cvs_admin_local(struct cvs_file *cf)
struct cvs_file *ocf;
struct rcs_access *acp;
int ofd;
-   char *d, *f, fpath[PATH_MAX], repo[PATH_MAX];
+   char *d, dbuf[PATH_MAX], *f, fbuf[PATH_MAX];
+   char fpath[PATH_MAX], repo[PATH_MAX];
 
-
-   if ((f = basename(oldfilename)) == NULL)
+   if (strlcpy(fbuf, oldfilename, sizeof(fbuf)) >= sizeof(fbuf))
+   fatal("cvs_admin_local: truncation");
+   if ((f = basename(fbuf)) == NULL)
fatal("cvs_admin_local: basename failed");
-   if ((d = dirname(oldfilename)) == NULL)
+
+   if (strlcpy(dbuf, oldfilename, sizeof(dbuf)) >= sizeof(dbuf))
+   fatal("cvs_admin_local: truncation");
+   if ((d = dirname(dbuf)) == NULL)
fatal("cvs_admin_local: dirname failed");
 
cvs_get_repository_path(d, repo, PATH_MAX);
Index: usr.bin/cvs/checkout.c
===
RCS file: /cvs/src/usr.bin/cvs/checkout.c,v
retrieving revision 1.171
diff -u -p -r1.171 checkout.c
--- usr.bin/cvs/checkout.c  1 Jun 2017 08:08:24 -   1.171
+++ usr.bin/cvs/checkout.c  16 Oct 2020 21:46:33 -
@@ -239,7 +239,7 @@ checkout_check_repository(int argc, char
struct module_checkout *mc;
struct cvs_ignpat *ip;
struct cvs_filelist *fl, *nxt;
-   char repo[PATH_MAX], fpath[PATH_MAX], *f[1];
+   char repo[PATH_MAX], fpath[PATH_MAX], path[PATH_MAX], *f[1];
 
build_dirs = print_stdout ? 0 : 1;
 
@@ -329,14 +329,25 @@ checkout_check_repository(int argc, char
cr.flags = flags;
 
if (!(mc->mc_flags & MODULE_ALIAS)) {
+   if (strlcpy(path, fl->file_path,
+   sizeof(path)) >= sizeof(path))
+   fatal("%s: truncation",
+   __func__);
module_repo_root =
-   xstrdup(dirname(fl->file_path));
+   xstrdup(dirname(path));
d = wdir;
+   if (strlcpy(path, fl->file_path,
+   sizeof(path)) >= sizeof(path))
+   fatal("%s: truncation",
+   __func__);
(void)xsnprintf(fpath, sizeof(fpath),
-   "%s/%s", d,
-   basename(fl->file_path));
+   "%s/%s", d, basename(path));
} else {
-   d = dirname(wdir);
+   if (strlcpy(path, wdir,
+   sizeof(path)) >= sizeof(path))
+   fatal("%s: truncation",
+   __func__);
+   d = dirname(path);
strlcpy(fpath, fl->file_path,
sizeof(fpath));
}
@@ -387,7 +398,7 @@ checkout_check_repository(int argc, char
 static int
 checkout_classify(const char *repo, const char *arg)
 {
-   char *d, *f, fpath[PATH_MAX];
+   char *d, dbuf[PATH_MAX], *f, fbuf[PATH_MAX], fpath[PATH_MAX];
struct stat sb;
 
if (stat(repo, &sb) == 0) {
@@ -395,8 +406,13 @@ checkout_classify(const char *repo, cons
return CVS_DIR;
}
 
-   d = dirname(repo);
-   f = basename(repo);
+   if (strlcpy(dbuf, repo, sizeof(dbuf)) >= sizeof(dbuf))
+   fatal("checkout_classify: truncation");
+   d =

Re: uvm_grow(): serialize updates

2020-10-16 Thread Theo de Raadt
Mark Kettenis  wrote:

> > /* For user defined stacks (from sendsig). */
> > if (sp < (vaddr_t)vm->vm_maxsaddr)
> > -   return;
> > +   goto out;
> 
> Since vm_maxsaddr is ummutable, this check can be done without holding
> the lock.  I think that's worth it as it will prevent contention in
> multi-threaded processes as this check will almost always be true for
> anything but the first thread since those will use a user-defined
> stack.

at k2k20 when revamping trap.c, we puzzled about the double check, and
the next day you pointed this out this is lock avoidance for the common
case.

I agree it should remain.  If I recall correctly one of the trap.c was
coded to grab the kernel lock for uvm_fault, release it, and then
re-grab it for uvm_grow.  Such double grabs also seem harmful.



Re: uvm_grow(): serialize updates

2020-10-16 Thread Mark Kettenis
> Date: Wed, 14 Oct 2020 12:01:10 +0200
> From: Martin Pieuchot 
> 
> Getting uvm_fault() out of the KERNEL_LOCK() alone is not enough to
> reduce the contention due to page faults.  A single part of the handler
> spinning on the lock is enough to hide bugs and increase latency.  One
> recent example is the uvm_map_inentry() check.
> 
> uvm_grow() is another small function called in trap that currently needs
> the KERNEL_LOCK().  Diff below changes this requirement without removing
> the KERNEL_LOCK() yet. 
> 
> It uses the underlying vm_space lock to serialize writes to the fields
> of "truct vmspace". 
> 
> While here I also documented that the reference counting is currently
> protected by the KERNEL_LOCK() and introduced a wrapper to help with
> future changes and reduce the differences with NetBSD.
> 
> Once uvm_grow() is safe to be called without the KERNEL_LOCK() MD trap
> functions can be adapted on a case-per-case basis.
> 
> Comments, Oks?

I considered the same approach of using the lock of the underlying
vm_map.  I have seen some evidence of contention on that lock, but I
don't think it is too bad (yet).  I looked at a lock-free approach as
well, but it got a bit messy.  So I think the approach is fine.
However...

> 
> Index: kern/kern_sysctl.c
> ===
> RCS file: /cvs/src/sys/kern/kern_sysctl.c,v
> retrieving revision 1.379
> diff -u -p -r1.379 kern_sysctl.c
> --- kern/kern_sysctl.c1 Sep 2020 01:53:50 -   1.379
> +++ kern/kern_sysctl.c14 Oct 2020 09:35:00 -
> @@ -1783,7 +1783,7 @@ sysctl_proc_args(int *name, u_int namele
>   /* Execing - danger. */
>   if ((vpr->ps_flags & PS_INEXEC))
>   return (EBUSY);
> - 
> +
>   /* Only owner or root can get env */
>   if ((op == KERN_PROC_NENV || op == KERN_PROC_ENV) &&
>   (vpr->ps_ucred->cr_uid != cp->p_ucred->cr_uid &&
> @@ -1792,7 +1792,7 @@ sysctl_proc_args(int *name, u_int namele
>  
>   ps_strings = vpr->ps_strings;
>   vm = vpr->ps_vmspace;
> - vm->vm_refcnt++;
> + uvmspace_addref(vm);
>   vpr = NULL;
>  
>   buf = malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
> Index: kern/sys_process.c
> ===
> RCS file: /cvs/src/sys/kern/sys_process.c,v
> retrieving revision 1.83
> diff -u -p -r1.83 sys_process.c
> --- kern/sys_process.c16 Mar 2020 11:58:46 -  1.83
> +++ kern/sys_process.c14 Oct 2020 09:35:00 -
> @@ -850,13 +850,12 @@ process_domem(struct proc *curp, struct 
>   if ((error = process_checkioperm(curp, tr)) != 0)
>   return error;
>  
> - /* XXXCDC: how should locking work here? */
>   vm = tr->ps_vmspace;
>   if ((tr->ps_flags & PS_EXITING) || (vm->vm_refcnt < 1))
>   return EFAULT;
>   addr = uio->uio_offset;
>  
> - vm->vm_refcnt++;
> + uvmspace_addref(vm);
>  
>   error = uvm_io(&vm->vm_map, uio,
>   (uio->uio_rw == UIO_WRITE) ? UVM_IO_FIXPROT : 0);
> @@ -892,7 +891,7 @@ process_auxv_offset(struct proc *curp, s
>   if ((tr->ps_flags & PS_EXITING) || (vm->vm_refcnt < 1))
>   return EFAULT;
>  
> - vm->vm_refcnt++;
> + uvmspace_addref(vm);
>   error = uvm_io(&vm->vm_map, &uio, 0);
>   uvmspace_free(vm);
>  
> Index: uvm/uvm_extern.h
> ===
> RCS file: /cvs/src/sys/uvm/uvm_extern.h,v
> retrieving revision 1.153
> diff -u -p -r1.153 uvm_extern.h
> --- uvm/uvm_extern.h  13 Sep 2020 10:05:25 -  1.153
> +++ uvm/uvm_extern.h  14 Oct 2020 09:35:00 -
> @@ -192,11 +192,13 @@ struct pmap;
>   * Several fields are temporary (text, data stuff).
>   *
>   *  Locks used to protect struct members in this file:
> + *   K   kernel lock
>   *   I   immutable after creation
> + *   v   vm_map's lock
>   */
>  struct vmspace {
>   struct  vm_map vm_map;  /* VM address map */
> - int vm_refcnt;  /* number of references */
> + int vm_refcnt;  /* [K] number of references */
>   caddr_t vm_shm; /* SYS5 shared memory private data XXX */
>  /* we copy from vm_startcopy to the end of the structure on fork */
>  #define vm_startcopy vm_rssize
> @@ -205,9 +207,9 @@ struct vmspace {
>   segsz_t vm_tsize;   /* text size (pages) XXX */
>   segsz_t vm_dsize;   /* data size (pages) XXX */
>   segsz_t vm_dused;   /* data segment length (pages) XXX */
> - segsz_t vm_ssize;   /* stack size (pages) */
> - caddr_t vm_taddr;   /* user virtual address of text XXX */
> - caddr_t vm_daddr;   /* user virtual address of data XXX */
> + segsz_t vm_ssize;   /* [v] stack size (pages) */
> + caddr_t vm_taddr;   /* [I] user virtual address of text */
> + caddr_t vm_daddr;   /* [I] user virtual address of data */
>   caddr_t vm_maxsaddr;/* [I] user VA at max stack

[PATCH ssh] VisualHostKey: unknown keys

2020-10-16 Thread Lapshin Dmitry
I've sent this patch some time ago, but I haven't got any replies and
have received a bunch of email delivery problems. Hopefully this time
it works well, sorry if you receive the same patch twice.

After using VisualHostKey ssh client option for some time, I've found
out that for me it's quite useful for manual host key verification
(where DNS-signed host keys are not available, for example), but it's
too noisy for casual usage when it outputs ASCII art on every login. So,
I've implemented a new value for VisualHostKey option, "unknown", that
only displays ASCII art when prompting for unknown host key, but is
silent for already known ones.

I'm not an OpenBSD user myself, but ported SSH is used world wide and I
find this feature useful, so I propose my patch for it here. I have
tested the patch on the portable repository. I'll happily fix any issues
if you find any problems while finding the contribution a welcome one,
sorry in advance if I've done something wrong.

In case the patch is good as it is now,

Signed-off-by: Dmitry Lapshin 
---
 readconf.c   | 11 ++-
 readconf.h   |  4 
 ssh.1|  4 +++-
 ssh_config.5 |  4 
 sshconnect.c |  2 +-
 5 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c
index 554efd7..dd2c720 100644
--- a/usr.bin/ssh/readconf.c
+++ b/usr.bin/ssh/readconf.c
@@ -876,6 +876,14 @@ static const struct multistate
multistate_compression[] = {
{ "no", COMP_NONE },
{ NULL, -1 }
 };
+static const struct multistate multistate_visualhostkey[] = {
+   { "true",   SSH_VISUAL_HOSTKEY_YES },
+   { "false",  SSH_VISUAL_HOSTKEY_NO },
+   { "yes",SSH_VISUAL_HOSTKEY_YES },
+   { "no", SSH_VISUAL_HOSTKEY_NO },
+   { "unknown",SSH_VISUAL_HOSTKEY_UNKNOWN },
+   { NULL, -1 }
+};

 static int
 parse_multistate_value(const char *arg, const char *filename, int linenum,
@@ -1607,7 +1615,8 @@ parse_keytypes:

case oVisualHostKey:
intptr = &options->visual_host_key;
-   goto parse_flag;
+   multistate_ptr = multistate_visualhostkey;
+   goto parse_multistate;

case oInclude:
if (cmdline)
diff --git a/usr.bin/ssh/readconf.h b/usr.bin/ssh/readconf.h
index d6a1555..06ebd4d 100644
--- a/usr.bin/ssh/readconf.h
+++ b/usr.bin/ssh/readconf.h
@@ -200,6 +200,10 @@ typedef struct {
 #define SSH_STRICT_HOSTKEY_YES 2
 #define SSH_STRICT_HOSTKEY_ASK 3

+#define SSH_VISUAL_HOSTKEY_NO  0
+#define SSH_VISUAL_HOSTKEY_YES 1
+#define SSH_VISUAL_HOSTKEY_UNKNOWN 2
+
 const char *kex_default_pk_alg(void);
 char   *ssh_connection_hash(const char *thishost, const char *host,
 const char *portstr, const char *user);
diff --git a/usr.bin/ssh/ssh.1 b/usr.bin/ssh/ssh.1
index 5553178..44ab019 100644
--- a/usr.bin/ssh/ssh.1
+++ b/usr.bin/ssh/ssh.1
@@ -1240,7 +1240,9 @@ By setting the
 option to
 .Dq yes ,
 a small ASCII graphic gets displayed on every login to a server, no matter
-if the session itself is interactive or not.
+if the session itself is interactive or not. Option value
+.Dq unknown
+will display random art only for unknown keys.
 By learning the pattern a known server produces, a user can easily
 find out that the host key has changed when a completely different pattern
 is displayed.
diff --git a/usr.bin/ssh/ssh_config.5 b/usr.bin/ssh/ssh_config.5
index 6be1f1a..97f97fa 100644
--- a/usr.bin/ssh/ssh_config.5
+++ b/usr.bin/ssh/ssh_config.5
@@ -1785,6 +1785,10 @@ an ASCII art representation of the remote host
key fingerprint is
 printed in addition to the fingerprint string at login and
 for unknown host keys.
 If this flag is set to
+.Cm unknown ,
+no fingerprint strings are printed at login, but an ASCII art and
+a fingerprint string are printed for unknown host keys.
+If this flag is set to
 .Cm no
 (the default),
 no fingerprint strings are printed at login and
diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c
index 9ec0618..fe59ac5 100644
--- a/usr.bin/ssh/sshconnect.c
+++ b/usr.bin/ssh/sshconnect.c
@@ -830,7 +830,7 @@ check_host_key(char *hostname, struct sockaddr
*hostaddr, u_short port,
logit("Warning: Permanently added the %s host "
"key for IP address '%.128s' to the list "
"of known hosts.", type, ip);
-   } else if (options.visual_host_key) {
+   } else if (options.visual_host_key == SSH_VISUAL_HOSTKEY_YES) {
fp = sshkey_fingerprint(host_key,
options.fingerprint_hash, SSH_FP_DEFAULT);
ra = sshkey_fingerprint(host_key,



push NET_LOCK() down in pf_ioctl.c

2020-10-16 Thread Alexandr Nedvedicky
Hello,

I've just found a forgotten diff in my tree. The diff pushes the NET_LCOK()
further down in PF driver ioctl() path.  The idea is to avoid sleeping while
holding a NET_LOCK().  this typically may happen when we need to allocate
memory. The diff is the first step as it takes care of easy/straightforward
cases of such allocations. The allocations, which still may happen under
the NET_LOCK() require more work in areas:
PF tables,
packet queues,
transactions,

the change is fairly large, but mostly mechanical.

OK?

thanks and
regards
sashan

8<---8<---8<--8<
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index ef7d995e5a7..bac644fa6d1 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1006,10 +1006,10 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
return (EACCES);
}
 
-   NET_LOCK();
switch (cmd) {
 
case DIOCSTART:
+   NET_LOCK();
PF_LOCK();
if (pf_status.running)
error = EEXIST;
@@ -1025,9 +1025,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
DPFPRINTF(LOG_NOTICE, "pf: started");
}
PF_UNLOCK();
+   NET_UNLOCK();
break;
 
case DIOCSTOP:
+   NET_LOCK();
PF_LOCK();
if (!pf_status.running)
error = ENOENT;
@@ -1038,6 +1040,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
DPFPRINTF(LOG_NOTICE, "pf: stopped");
}
PF_UNLOCK();
+   NET_UNLOCK();
break;
 
case DIOCGETQUEUES: {
@@ -1045,6 +1048,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
struct pf_queuespec *qs;
u_int32_tnr = 0;
 
+   NET_LOCK();
PF_LOCK();
pq->ticket = pf_main_ruleset.rules.active.ticket;
 
@@ -1056,6 +1060,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
}
pq->nr = nr;
PF_UNLOCK();
+   NET_UNLOCK();
break;
}
 
@@ -1064,10 +1069,12 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
struct pf_queuespec *qs;
u_int32_tnr = 0;
 
+   NET_LOCK();
PF_LOCK();
if (pq->ticket != pf_main_ruleset.rules.active.ticket) {
error = EBUSY;
PF_UNLOCK();
+   NET_UNLOCK();
break;
}
 
@@ -1078,10 +1085,12 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
if (qs == NULL) {
error = EBUSY;
PF_UNLOCK();
+   NET_UNLOCK();
break;
}
memcpy(&pq->queue, qs, sizeof(pq->queue));
PF_UNLOCK();
+   NET_UNLOCK();
break;
}
 
@@ -1091,10 +1100,12 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
u_int32_tnr;
int  nbytes;
 
+   NET_LOCK();
PF_LOCK();
if (pq->ticket != pf_main_ruleset.rules.active.ticket) {
error = EBUSY;
PF_UNLOCK();
+   NET_UNLOCK();
break;
}
nbytes = pq->nbytes;
@@ -1107,6 +1118,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
if (qs == NULL) {
error = EBUSY;
PF_UNLOCK();
+   NET_UNLOCK();
break;
}
memcpy(&pq->queue, qs, sizeof(pq->queue));
@@ -1121,6 +1133,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
if (error == 0)
pq->nbytes = nbytes;
PF_UNLOCK();
+   NET_UNLOCK();
break;
}
 
@@ -1128,38 +1141,44 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
struct pfioc_queue  *q = (struct pfioc_queue *)addr;
struct pf_queuespec *qs;
 
-   PF_LOCK();
-   if (q->ticket != pf_main_ruleset.rules.inactive.ticket) {
-   error = EBUSY;
-   PF_UNLOCK();
-   break;
-   }
qs = pool_get(&pf_queue_pl, PR_WAITOK|PR_LIMITFAIL|PR_ZERO);

Re: Typo Diffs

2020-10-16 Thread Jason McIntyre
On Fri, Oct 16, 2020 at 02:36:39AM +, Varik Valefor wrote:
> Sir or Madam:
> 
> Included within this message should be some diffs which can be applied to
> fix some typographical errors and general wording problems which exist
> within the OpenBSD manual pages, as well as some other files.
> 
> These changes are proposed because typographical errors look bad and can
> lead to assumptions of incompetence.
> 
> KUTGW,
> Varik "NOT A COMPUTER PROGRAMMER!!!" Valefor
> 

hi.

thanks for your mail - typo fixes are always welcome! i have committed
fixes for the two instances of "the the". i'm afraid the other parts
of the diff are really just questions of preference, and don;t
represent enough of a clear improvement to be committed. none of
them are errors (at least, not in 2020).

thanks,
jmc

> - BEGIN DIFFS -
> diff --git a/lib/libutil/ober_add_string.3 b/lib/libutil/ober_add_string.3
> index 5eb6bd32ea0..77a13e629a0 100644
> --- a/lib/libutil/ober_add_string.3
> +++ b/lib/libutil/ober_add_string.3
> @@ -134,7 +134,7 @@ creates zero or more
>  structures.
>  For each byte in
>  .Fa fmt ,
> -arguments of the the types given in the following table are consumed
> +arguments of the types given in the following table are consumed
>  and passed to the listed function, creating one
>  .Vt ber_element
>  per byte.
> 
> diff --git a/share/man/man9/physio.9 b/share/man/man9/physio.9
> index 528581eedaa..2977813bbe8 100644
> --- a/share/man/man9/physio.9
> +++ b/share/man/man9/physio.9
> @@ -56,7 +56,7 @@ The maximum amount of data to transfer with each call to
>  is determined by the
>  .Fa minphys
>  routine.
> -Since
> +Because
>  .Fa uio
>  normally describes user space addresses,
>  .Fn physio
> @@ -85,7 +85,9 @@ A break-down of the arguments follows:
>  The device strategy routine to call for each chunk of data to initiate
>  device I/O.
>  .It Fa dev
> -The device number identifying the device to interact with.
> +The device number of the device with which
> +.Nm
> +should interact.
>  .It Fa flags
>  Direction of transfer; the only valid settings are
>  .Dv B_READ
> 
> diff --git a/usr.bin/ftp/ftp.1 b/usr.bin/ftp/ftp.1
> index 4f4bfd8d5d5..b5683b0d546 100644
> --- a/usr.bin/ftp/ftp.1
> +++ b/usr.bin/ftp/ftp.1
> @@ -316,7 +316,7 @@ slow connection after
>  The host with which
>  .Nm
>  is to communicate may be specified on the command line.
> -If this is done,
> +If this host is specified,
>  .Nm
>  will immediately attempt to establish a connection to an
>  FTP server on that host; otherwise,
> @@ -1675,7 +1675,7 @@ entry cannot be utilized by multiple
>  .Ic machine
>  definitions; rather, it must be defined following each
>  .Ic machine
> -it is intended to be used with.
> +with which it is to be used.
>  If a macro named
>  .Ic init
>  is defined, it is automatically executed as the last step in the
> 
> diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1
> index 87a5d04aa4a..4d4b0d3660c 100644
> --- a/usr.bin/sed/sed.1
> +++ b/usr.bin/sed/sed.1
> @@ -427,7 +427,7 @@ string for the first instance of the regular expression
>  in the pattern space.
>  Any character other than backslash or newline can be used instead of
>  a slash to delimit the regular expression and the replacement.
> -Also see the the section about
> +Also see the section about
>  .Sx SED REGULAR EXPRESSIONS .
>  .Pp
>  An ampersand
> 
> diff --git a/usr.bin/openssl/openssl.1 b/usr.bin/openssl/openssl.1
> index e364586f5ad..f1f4361c472 100644
> --- a/usr.bin/openssl/openssl.1
> +++ b/usr.bin/openssl/openssl.1
> @@ -408,10 +408,10 @@ are assumed to be the names of files containing 
> certificate requests.
>  The
>  .Fa password
>  used to encrypt the private key.
> -Since on some systems the command line arguments are visible,
> +On some systems, the command line arguments are visible; therefore,
>  this option should be used with caution.
>  .It Fl keyfile Ar file
> -The private key to sign requests with.
> +The private key with which requests should be signed.
>  .It Fl keyform Cm pem | der
>  Private key file format.
>  The default is
> 
> diff --git a/usr.bin/x99token/x99token.1 b/usr.bin/x99token/x99token.1
> index 1d004dea440..8a29f22ce99 100644
> --- a/usr.bin/x99token/x99token.1
> +++ b/usr.bin/x99token/x99token.1
> @@ -49,7 +49,7 @@ is not specified,
>  is in calculator mode.
>  In this mode you must enter the same PIN as used in the initialization step.
>  The PIN is used to decode the key read from the keyfile.
> -Next you enter the challenge you have been presented with.
> +Next, you enter the challenge which has been presented to you.
>  The
>  .Nm
>  program will provide you with a response to the challenge.
> 
> diff --git a/usr.bin/openssl/openssl.1 b/usr.bin/openssl/openssl.1
> index e364586f5ad..da4b73aee3c 100644
> --- a/usr.bin/openssl/openssl.1
> +++ b/usr.bin/openssl/openssl.1
> @@ -371,7 +371,7 @@ If reading the serial from the text file as specified in 
> the
>  configuration fails, create a new random serial 

Re: Typo Diffs

2020-10-16 Thread Stuart Henderson
On 2020/10/16 02:36, Varik Valefor wrote:
> Sir or Madam:
> 
> Included within this message should be some diffs which can be applied to
> fix some typographical errors and general wording problems which exist
> within the OpenBSD manual pages, as well as some other files.
> 
> These changes are proposed because typographical errors look bad and can
> lead to assumptions of incompetence.
> 
> KUTGW,
> Varik "NOT A COMPUTER PROGRAMMER!!!" Valefor

The "the the" fixes are good; the others seem to mostly be stylistic
changes which are a matter of opinion, a diff in the reverse direction 
would be equally valid, we don't usually commit changes like that though
the maintainers of the relevant parts of the tree may take some of them.
One proposed change in openssl(1) is clearly worse ("to for").


> - BEGIN DIFFS -
> diff --git a/lib/libutil/ober_add_string.3 b/lib/libutil/ober_add_string.3
> index 5eb6bd32ea0..77a13e629a0 100644
> --- a/lib/libutil/ober_add_string.3
> +++ b/lib/libutil/ober_add_string.3
> @@ -134,7 +134,7 @@ creates zero or more
>  structures.
>  For each byte in
>  .Fa fmt ,
> -arguments of the the types given in the following table are consumed
> +arguments of the types given in the following table are consumed
>  and passed to the listed function, creating one
>  .Vt ber_element
>  per byte.
> 
> diff --git a/share/man/man9/physio.9 b/share/man/man9/physio.9
> index 528581eedaa..2977813bbe8 100644
> --- a/share/man/man9/physio.9
> +++ b/share/man/man9/physio.9
> @@ -56,7 +56,7 @@ The maximum amount of data to transfer with each call to
>  is determined by the
>  .Fa minphys
>  routine.
> -Since
> +Because
>  .Fa uio
>  normally describes user space addresses,
>  .Fn physio
> @@ -85,7 +85,9 @@ A break-down of the arguments follows:
>  The device strategy routine to call for each chunk of data to initiate
>  device I/O.
>  .It Fa dev
> -The device number identifying the device to interact with.
> +The device number of the device with which
> +.Nm
> +should interact.
>  .It Fa flags
>  Direction of transfer; the only valid settings are
>  .Dv B_READ
> 
> diff --git a/usr.bin/ftp/ftp.1 b/usr.bin/ftp/ftp.1
> index 4f4bfd8d5d5..b5683b0d546 100644
> --- a/usr.bin/ftp/ftp.1
> +++ b/usr.bin/ftp/ftp.1
> @@ -316,7 +316,7 @@ slow connection after
>  The host with which
>  .Nm
>  is to communicate may be specified on the command line.
> -If this is done,
> +If this host is specified,
>  .Nm
>  will immediately attempt to establish a connection to an
>  FTP server on that host; otherwise,
> @@ -1675,7 +1675,7 @@ entry cannot be utilized by multiple
>  .Ic machine
>  definitions; rather, it must be defined following each
>  .Ic machine
> -it is intended to be used with.
> +with which it is to be used.
>  If a macro named
>  .Ic init
>  is defined, it is automatically executed as the last step in the
> 
> diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1
> index 87a5d04aa4a..4d4b0d3660c 100644
> --- a/usr.bin/sed/sed.1
> +++ b/usr.bin/sed/sed.1
> @@ -427,7 +427,7 @@ string for the first instance of the regular expression
>  in the pattern space.
>  Any character other than backslash or newline can be used instead of
>  a slash to delimit the regular expression and the replacement.
> -Also see the the section about
> +Also see the section about
>  .Sx SED REGULAR EXPRESSIONS .
>  .Pp
>  An ampersand
> 
> diff --git a/usr.bin/openssl/openssl.1 b/usr.bin/openssl/openssl.1
> index e364586f5ad..f1f4361c472 100644
> --- a/usr.bin/openssl/openssl.1
> +++ b/usr.bin/openssl/openssl.1
> @@ -408,10 +408,10 @@ are assumed to be the names of files containing 
> certificate requests.
>  The
>  .Fa password
>  used to encrypt the private key.
> -Since on some systems the command line arguments are visible,
> +On some systems, the command line arguments are visible; therefore,
>  this option should be used with caution.
>  .It Fl keyfile Ar file
> -The private key to sign requests with.
> +The private key with which requests should be signed.
>  .It Fl keyform Cm pem | der
>  Private key file format.
>  The default is
> 
> diff --git a/usr.bin/x99token/x99token.1 b/usr.bin/x99token/x99token.1
> index 1d004dea440..8a29f22ce99 100644
> --- a/usr.bin/x99token/x99token.1
> +++ b/usr.bin/x99token/x99token.1
> @@ -49,7 +49,7 @@ is not specified,
>  is in calculator mode.
>  In this mode you must enter the same PIN as used in the initialization step.
>  The PIN is used to decode the key read from the keyfile.
> -Next you enter the challenge you have been presented with.
> +Next, you enter the challenge which has been presented to you.
>  The
>  .Nm
>  program will provide you with a response to the challenge.
> 
> diff --git a/usr.bin/openssl/openssl.1 b/usr.bin/openssl/openssl.1
> index e364586f5ad..da4b73aee3c 100644
> --- a/usr.bin/openssl/openssl.1
> +++ b/usr.bin/openssl/openssl.1
> @@ -371,7 +371,7 @@ If reading the serial from the text file as specified in 
> the
>  configuration fails, create a new random serial 

Typo Diffs

2020-10-16 Thread Varik Valefor
Sir or Madam:

Included within this message should be some diffs which can be applied to
fix some typographical errors and general wording problems which exist
within the OpenBSD manual pages, as well as some other files.

These changes are proposed because typographical errors look bad and can
lead to assumptions of incompetence.

KUTGW,
Varik "NOT A COMPUTER PROGRAMMER!!!" Valefor

- BEGIN DIFFS -
diff --git a/lib/libutil/ober_add_string.3 b/lib/libutil/ober_add_string.3
index 5eb6bd32ea0..77a13e629a0 100644
--- a/lib/libutil/ober_add_string.3
+++ b/lib/libutil/ober_add_string.3
@@ -134,7 +134,7 @@ creates zero or more
 structures.
 For each byte in
 .Fa fmt ,
-arguments of the the types given in the following table are consumed
+arguments of the types given in the following table are consumed
 and passed to the listed function, creating one
 .Vt ber_element
 per byte.

diff --git a/share/man/man9/physio.9 b/share/man/man9/physio.9
index 528581eedaa..2977813bbe8 100644
--- a/share/man/man9/physio.9
+++ b/share/man/man9/physio.9
@@ -56,7 +56,7 @@ The maximum amount of data to transfer with each call to
 is determined by the
 .Fa minphys
 routine.
-Since
+Because
 .Fa uio
 normally describes user space addresses,
 .Fn physio
@@ -85,7 +85,9 @@ A break-down of the arguments follows:
 The device strategy routine to call for each chunk of data to initiate
 device I/O.
 .It Fa dev
-The device number identifying the device to interact with.
+The device number of the device with which
+.Nm
+should interact.
 .It Fa flags
 Direction of transfer; the only valid settings are
 .Dv B_READ

diff --git a/usr.bin/ftp/ftp.1 b/usr.bin/ftp/ftp.1
index 4f4bfd8d5d5..b5683b0d546 100644
--- a/usr.bin/ftp/ftp.1
+++ b/usr.bin/ftp/ftp.1
@@ -316,7 +316,7 @@ slow connection after
 The host with which
 .Nm
 is to communicate may be specified on the command line.
-If this is done,
+If this host is specified,
 .Nm
 will immediately attempt to establish a connection to an
 FTP server on that host; otherwise,
@@ -1675,7 +1675,7 @@ entry cannot be utilized by multiple
 .Ic machine
 definitions; rather, it must be defined following each
 .Ic machine
-it is intended to be used with.
+with which it is to be used.
 If a macro named
 .Ic init
 is defined, it is automatically executed as the last step in the

diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1
index 87a5d04aa4a..4d4b0d3660c 100644
--- a/usr.bin/sed/sed.1
+++ b/usr.bin/sed/sed.1
@@ -427,7 +427,7 @@ string for the first instance of the regular expression
 in the pattern space.
 Any character other than backslash or newline can be used instead of
 a slash to delimit the regular expression and the replacement.
-Also see the the section about
+Also see the section about
 .Sx SED REGULAR EXPRESSIONS .
 .Pp
 An ampersand

diff --git a/usr.bin/openssl/openssl.1 b/usr.bin/openssl/openssl.1
index e364586f5ad..f1f4361c472 100644
--- a/usr.bin/openssl/openssl.1
+++ b/usr.bin/openssl/openssl.1
@@ -408,10 +408,10 @@ are assumed to be the names of files containing 
certificate requests.
 The
 .Fa password
 used to encrypt the private key.
-Since on some systems the command line arguments are visible,
+On some systems, the command line arguments are visible; therefore,
 this option should be used with caution.
 .It Fl keyfile Ar file
-The private key to sign requests with.
+The private key with which requests should be signed.
 .It Fl keyform Cm pem | der
 Private key file format.
 The default is

diff --git a/usr.bin/x99token/x99token.1 b/usr.bin/x99token/x99token.1
index 1d004dea440..8a29f22ce99 100644
--- a/usr.bin/x99token/x99token.1
+++ b/usr.bin/x99token/x99token.1
@@ -49,7 +49,7 @@ is not specified,
 is in calculator mode.
 In this mode you must enter the same PIN as used in the initialization step.
 The PIN is used to decode the key read from the keyfile.
-Next you enter the challenge you have been presented with.
+Next, you enter the challenge which has been presented to you.
 The
 .Nm
 program will provide you with a response to the challenge.

diff --git a/usr.bin/openssl/openssl.1 b/usr.bin/openssl/openssl.1
index e364586f5ad..da4b73aee3c 100644
--- a/usr.bin/openssl/openssl.1
+++ b/usr.bin/openssl/openssl.1
@@ -371,7 +371,7 @@ If reading the serial from the text file as specified in the
 configuration fails, create a new random serial to be used as the
 next serial number.
 .It Fl days Ar arg
-The number of days to certify the certificate for.
+The number of days for which the certificate should be certified.
 .It Fl enddate Ar date
 Set the expiry date.
 The format of the date is [YY]YYMMDDHHMMSSZ,
@@ -408,10 +408,10 @@ are assumed to be the names of files containing 
certificate requests.
 The
 .Fa password
 used to encrypt the private key.
-Since on some systems the command line arguments are visible,
+On some systems, the command-line arguments are visible; therefore,
 this option should be used with caution.
 .It Fl keyfile Ar file
-The private key to sign requests wit