Re: Removal of troff, ditroff and dvi/tex variables, etc

2016-02-22 Thread Chris Bennett
I forgot to put in a diff. Sorry.


Index: pathnames.h
===
RCS file: /cvs/src/usr.sbin/lpr/common_source/pathnames.h,v
retrieving revision 1.6
diff -u -p -r1.6 pathnames.h
--- pathnames.h 28 Oct 2015 13:25:55 -  1.6
+++ pathnames.h 23 Feb 2016 04:29:04 -
@@ -40,8 +40,3 @@
 #define_PATH_PR"/usr/bin/pr"
 #define_PATH_PRINTCAP  "/etc/printcap"
 #define_PATH_SOCKETNAME"/var/run/printer"
-#define_PATH_VFONT "/usr/libdata/vfont/"
-#define_PATH_VFONTB"/usr/libdata/vfont/B"
-#define_PATH_VFONTI"/usr/libdata/vfont/I"
-#define_PATH_VFONTR"/usr/libdata/vfont/R"
-#define_PATH_VFONTS"/usr/libdata/vfont/S"



Removal of troff, ditroff and dvi/tex variables, etc

2016-02-22 Thread Chris Bennett
These should be correct diff's this time. My vim was too perl oriented,
not now.

These three are intimately tied together, so I think they should be
completely removed. If one of these types of printing is done by
someone, it can be dealt with by some future filter.
tex or dvi are names used for the same items.
OK?

Chris


Index: printjob.c
===
RCS file: /cvs/src/usr.sbin/lpr/lpd/printjob.c,v
retrieving revision 1.57
diff -u -p -r1.57 printjob.c
--- printjob.c  29 Jan 2016 21:23:11 -  1.57
+++ printjob.c  23 Feb 2016 03:14:23 -
@@ -317,16 +317,6 @@ again:
goto again;
 }
 
-#defineFONTLEN 50
-char   fonts[4][FONTLEN];  /* fonts for troff */
-
-char ifonts[4][40] = {
-   _PATH_VFONTR,
-   _PATH_VFONTI,
-   _PATH_VFONTB,
-   _PATH_VFONTS,
-};
-
 /*
  * The remaining part is the reading of the control file (cf)
  * and performing the various actions.
@@ -348,14 +338,6 @@ printit(char *file)
(void)close(fd);
return(OK);
}
-   /*
-* Reset troff fonts.
-*/
-   for (i = 0; i < 4; i++)
-   strlcpy(fonts[i], ifonts[i], FONTLEN);
-   (void)snprintf([2], sizeof(width) - 2, "%ld", PW);
-   indent[2] = '0';
-   indent[3] = '\0';
 
/*
 *  read the control file for work to do
@@ -376,16 +358,9 @@ printit(char *file)
 *  f -- "file name" name of text file to print
 *  l -- "file name" text file with control chars
 *  p -- "file name" text file to print with pr(1)
-*  t -- "file name" troff(1) file to print
-*  n -- "file name" ditroff(1) file to print
-*  d -- "file name" dvi file to print
 *  g -- "file name" plot(1G) file to print
 *  v -- "file name" plain raster file to print
 *  c -- "file name" cifplot file to print
-*  1 -- "R font file" for troff
-*  2 -- "I font file" for troff
-*  3 -- "B font file" for troff
-*  4 -- "S font file" for troff
 *  N -- "name" of file (used by lpq)
 *  U -- "unlink" name of file to remove
 *(after we print it. (Pass 2 only)).
@@ -453,14 +428,6 @@ printit(char *file)
banner(line+1, jobname);
continue;
 
-   case '1':   /* troff fonts */
-   case '2':
-   case '3':
-   case '4':
-   if (line[1] != '\0')
-   strlcpy(fonts[line[0]-'1'], line+1, FONTLEN);
-   continue;
-
case 'W':   /* page width */
strlcpy(width+2, line+1, sizeof(width) - 2);
continue;
@@ -524,7 +491,7 @@ pass2:
 
 /*
  * Print a file.
- * Set up the chain [ PR [ | {IF, OF} ] ] or {IF, RF, TF, NF, DF, CF, VF}.
+ * Set up the chain [ PR [ | {IF, OF} ] ] or {IF, RF, CF, VF}.
  * Return -1 if a non-recoverable error occurred,
  * 2 if the filter detected some errors (but printed the job anyway),
  * 1 if we should try to reprint this job and
@@ -646,28 +613,6 @@ print(int format, char *file)
av[2] = length;
n = 3;
break;
-   case 't':   /* print troff output */
-   case 'n':   /* print ditroff output */
-   case 'd':   /* print tex output */
-   (void)unlink(".railmag");
-   if ((fo = open(".railmag", O_CREAT|O_WRONLY|O_EXCL, FILMOD)) < 
0) {
-   syslog(LOG_ERR, "%s: cannot create .railmag", printer);
-   (void)unlink(".railmag");
-   } else {
-   for (n = 0; n < 4; n++) {
-   if (fonts[n][0] != '/')
-   (void)write(fo, _PATH_VFONT,
-   sizeof(_PATH_VFONT) - 1);
-   (void)write(fo, fonts[n], strlen(fonts[n]));
-   (void)write(fo, "\n", 1);
-   }
-   (void)close(fo);
-   }
-   prog = (format == 't') ? TF : (format == 'n') ? NF : DF;
-   av[1] = pxwidth;
-   av[2] = pxlength;
-   n = 3;
-   break;
case 'c':   /* print cifplot output */
prog = CF;
av[1] = pxwidth;
@@ -1327,9 +1272,6 @@ init(void)
cgetstr(bp, "of", );
cgetstr(bp, "if", );
cgetstr(bp, "rf", );
-   cgetstr(bp, "tf", );
-   cgetstr(bp, "nf", );
-   cgetstr(bp, "df", );
cgetstr(bp, "gf", );
cgetstr(bp, "vf", );
cgetstr(bp, "cf", );



Index: 

rdist.1 patch

2016-02-22 Thread Edgar Pettijohn

--- rdist.1.origMon Feb 22 18:48:45 2016
+++ rdist.1Mon Feb 22 18:49:29 2016
@@ -117,7 +117,7 @@
 .Pp
 Otherwise,
 .Nm
-run will run the command:
+will run the command:
 .Bd -literal -offset indent
 ssh \*(Lthost\*(Gt -l \*(Ltlogin_name\*(Gt rdistd -S
 .Ed



Re: cwm: avoid displaying empty menu

2016-02-22 Thread Martin Brandenburg
On Mon, 22 Feb 2016, Martin Brandenburg wrote:

> Is there another sort of menu I'm not thinking of? I'll
> admit to not using all of cwm's features.

Ooh! Right after sending this I accidentally hit CM-n,
and it crashed since menu_filter wasn't supposed to
return NULL.

Well what was in there before 1.89 is better than my
patch.

-- Martin



Re: cwm: avoid displaying empty menu

2016-02-22 Thread Martin Brandenburg
On Sat, 20 Feb 2016, Okan Demirmen wrote:

> On Sat 2016.02.20 at 12:29 -0500, Martin Brandenburg wrote:
> > This avoids an empty square in the upper left corner if
> > there is nothing to display in some menu the user
> > requests.
> 
> Sorry, but I think that is a big hammer; in fact there is evidence of
> why these checks are no longer there in the calling functions, such as:
> 
> 
> revision 1.89
> date: 2015/06/07 19:10:00;  author: okan;  state: Exp;  lines: +1 -7; 
> commitid: DuQBUgWvLWBQOJbB;
> even if the menuq is empty, at least show an empty menu instead of just
> bailing making it look like the binding isn't working.
> 
> 
> So if your application menu is empty, do you want to see the
> 'application' header with an empty list below it, or zero indication
> (not even the header) that anything is working (or is it but empty?)?

No I still see that with my patch. E.g. M-? brings an
empty (really one item) menu that says "exec." I don't
see any menu at all for e.g. left clicking when there
are no hidden windows. I don't think I should.  What I
describe below hardly demonstrates that anything is
working.

Is there another sort of menu I'm not thinking of? I'll
admit to not using all of cwm's features.

> 
> ..that's the rationale at least.
> 
> OR, is this empty square something else -what (empty) menu do you see
> just an empty square with no indicator/header in it?

If the border is set to 1px, you will see a 3px square
in the upper corner

With a larger border it looks like

http://www.martinbrandenburg.com/2016/ss/0222.cwm.png

I wouldn't have noticed if I wasn't playing with border
width one day.

-- Martin

> 
> Thanks,
> Okan
> 
> > -- Martin
> > 
> > Index: menu.c
> > ===
> > RCS file: /cvs/xenocara/app/cwm/menu.c,v
> > retrieving revision 1.89
> > diff -u -p -r1.89 menu.c
> > --- menu.c  11 Nov 2015 14:22:01 -  1.89
> > +++ menu.c  20 Feb 2016 17:26:17 -
> > @@ -89,6 +89,9 @@ menu_filter(struct screen_ctx *sc, struc
> > int  evmask, focusrevert;
> > int  xsave, ysave, xcur, ycur;
> >  
> > +   if (TAILQ_EMPTY(menuq))
> > +   return NULL;
> > +
> > TAILQ_INIT();
> >  
> > (void)memset(, 0, sizeof(mc));
> > 
> 



Re: Harmful casts in ufs

2016-02-22 Thread Martin Natano
On Mon, Feb 22, 2016 at 06:31:00AM -0700, Todd C. Miller wrote:
> On Sun, 21 Feb 2016 16:33:27 +0100, Stefan Kempf wrote:
> 
> > Should we really mount the FS in that case? If the FS was of the
> > "new" format, then short symlinks would store the destination path in the
> > inode directly. I think we'd not be able to correctly follow these symlinks
> > if we set fs_maxsymlinklen to 0 when encountering a negative value.
> 
> I was concerned about old 4.2/4.3 filesystems having garbage in
> that location.  It's not really an issue since we'll never really
> encounter such a file system that was not created by our own newfs
> (which will zero it on the disk).
> 
> Since fs_maxsymlinklen should be ignored for the old inode format
> we could do something like this just to be safe.

Yeah, I think that's a good idea; updated diff below.

natano


Index: sys/mount.h
===
RCS file: /cvs/src/sys/sys/mount.h,v
retrieving revision 1.121
diff -u -p -r1.121 mount.h
--- sys/mount.h 8 Sep 2014 01:47:06 -   1.121
+++ sys/mount.h 22 Feb 2016 14:53:23 -
@@ -355,7 +355,7 @@ struct mount {
struct vnodelst mnt_vnodelist;  /* list of vnodes this mount */
struct rwlock   mnt_lock;   /* mount structure lock */
int mnt_flag;   /* flags */
-   int mnt_maxsymlinklen;  /* max size of short symlink */
+   unsigned intmnt_maxsymlinklen;  /* max size of short symlink */
struct statfs   mnt_stat;   /* cache of filesystem stats */
void*mnt_data;  /* private data */
 };
Index: ufs/ext2fs/ext2fs_readwrite.c
===
RCS file: /cvs/src/sys/ufs/ext2fs/ext2fs_readwrite.c,v
retrieving revision 1.37
diff -u -p -r1.37 ext2fs_readwrite.c
--- ufs/ext2fs/ext2fs_readwrite.c   16 Feb 2016 17:56:12 -  1.37
+++ ufs/ext2fs/ext2fs_readwrite.c   22 Feb 2016 14:53:23 -
@@ -95,7 +95,7 @@ ext2_ind_read(struct vnode *vp, struct i
panic("%s: mode", "ext2fs_read");
 
if (vp->v_type == VLNK) {
-   if ((int)ext2fs_size(ip) < vp->v_mount->mnt_maxsymlinklen ||
+   if (ext2fs_size(ip) < vp->v_mount->mnt_maxsymlinklen ||
(vp->v_mount->mnt_maxsymlinklen == 0 &&
ip->i_e2fs_nblock == 0))
panic("%s: short symlink", "ext2fs_read");
Index: ufs/ext2fs/ext2fs_vnops.c
===
RCS file: /cvs/src/sys/ufs/ext2fs/ext2fs_vnops.c,v
retrieving revision 1.74
diff -u -p -r1.74 ext2fs_vnops.c
--- ufs/ext2fs/ext2fs_vnops.c   16 Feb 2016 17:56:12 -  1.74
+++ ufs/ext2fs/ext2fs_vnops.c   22 Feb 2016 14:53:23 -
@@ -322,7 +322,7 @@ ext2fs_setattr(void *v)
if (vap->va_mode != (mode_t)VNOVAL) {
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
-   error = ext2fs_chmod(vp, (int)vap->va_mode, cred, p);
+   error = ext2fs_chmod(vp, vap->va_mode, cred, p);
}
return (error);
 }
Index: ufs/ffs/ffs_vfsops.c
===
RCS file: /cvs/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.150
diff -u -p -r1.150 ffs_vfsops.c
--- ufs/ffs/ffs_vfsops.c12 Jan 2016 11:41:00 -  1.150
+++ ufs/ffs/ffs_vfsops.c22 Feb 2016 14:53:23 -
@@ -642,6 +642,11 @@ ffs_validate(struct fs *fsp)
if ((u_int)fsp->fs_frag > MAXFRAG || fragtbl[fsp->fs_frag] == NULL)
return (0); /* Invalid number of fragments */
 
+   if (fsp->fs_inodefmt == FS_42INODEFMT)
+   fsp->fs_maxsymlinklen = 0;
+   else if (fsp->fs_maxsymlinklen < 0)
+   return (0); /* Invalid max size of short symlink */
+
return (1); /* Super block is okay */
 }
 
Index: ufs/ffs/ffs_vnops.c
===
RCS file: /cvs/src/sys/ufs/ffs/ffs_vnops.c,v
retrieving revision 1.82
diff -u -p -r1.82 ffs_vnops.c
--- ufs/ffs/ffs_vnops.c 16 Feb 2016 17:56:12 -  1.82
+++ ufs/ffs/ffs_vnops.c 22 Feb 2016 14:53:23 -
@@ -207,7 +207,7 @@ ffs_read(void *v)
panic("ffs_read: mode");
 
if (vp->v_type == VLNK) {
-   if ((int)DIP(ip, size) < vp->v_mount->mnt_maxsymlinklen ||
+   if (DIP(ip, size) < vp->v_mount->mnt_maxsymlinklen ||
(vp->v_mount->mnt_maxsymlinklen == 0 &&
 DIP(ip, blocks) == 0))
panic("ffs_read: short symlink");



Re: Make uftdi(4) support aftermarket FTDI devices

2016-02-22 Thread lists
Sun, 21 Feb 2016 12:41:06 -0700 Theo de Raadt 
> As to the 0x entry, I'm wondering whether it should be named something
> like the following, as a historical reminder:
> 
> +product FTDI FT232_JERKS   0xSerial

Others followed suit too, HL_340 bricked clones here.  Not sure how to
resolve the 0x mapping uniformly.  Have to invent a separate twerp
category.

I can't even remember what they were using originally when they used to
work, electrically the device is fine.  Just got reprogrammed to comply
with the FTDI clones in the 0x device ID.



Re: Harmful casts in ufs

2016-02-22 Thread Todd C. Miller
On Sun, 21 Feb 2016 16:33:27 +0100, Stefan Kempf wrote:

> Should we really mount the FS in that case? If the FS was of the
> "new" format, then short symlinks would store the destination path in the
> inode directly. I think we'd not be able to correctly follow these symlinks
> if we set fs_maxsymlinklen to 0 when encountering a negative value.

I was concerned about old 4.2/4.3 filesystems having garbage in
that location.  It's not really an issue since we'll never really
encounter such a file system that was not created by our own newfs
(which will zero it on the disk).

Since fs_maxsymlinklen should be ignored for the old inode format
we could do something like this just to be safe.

 - todd

Index: ufs/ffs/ffs_vfsops.c
===
RCS file: /cvs/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.150
diff -u -p -u -r1.150 ffs_vfsops.c
--- ufs/ffs/ffs_vfsops.c12 Jan 2016 11:41:00 -  1.150
+++ ufs/ffs/ffs_vfsops.c22 Feb 2016 13:27:09 -
@@ -642,6 +642,11 @@ ffs_validate(struct fs *fsp)
if ((u_int)fsp->fs_frag > MAXFRAG || fragtbl[fsp->fs_frag] == NULL)
return (0); /* Invalid number of fragments */
 
+   if (fsp->fs_inodefmt == FS_42INODEFMT)
+   fsp->fs_maxsymlinklen = 0;
+   else if (fsp->fs_maxsymlinklen < 0)
+   return (0); /* Invalid max size of short symlink */
+
return (1); /* Super block is okay */
 }
 

Index: ufs/ffs/ffs_vfsops.c
===
RCS file: /cvs/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.150
diff -u -p -u -r1.150 ffs_vfsops.c
--- ufs/ffs/ffs_vfsops.c12 Jan 2016 11:41:00 -  1.150
+++ ufs/ffs/ffs_vfsops.c22 Feb 2016 13:27:09 -
@@ -642,6 +642,11 @@ ffs_validate(struct fs *fsp)
if ((u_int)fsp->fs_frag > MAXFRAG || fragtbl[fsp->fs_frag] == NULL)
return (0); /* Invalid number of fragments */
 
+   if (fsp->fs_inodefmt == FS_42INODEFMT)
+   fsp->fs_maxsymlinklen = 0;
+   else if (fsp->fs_maxsymlinklen < 0)
+   return (0); /* Invalid max size of short symlink */
+
return (1); /* Super block is okay */
 }