Re: patch: tedu sccs support

2014-11-20 Thread Tobias Stoeckmann
On Wed, Nov 19, 2014 at 10:02:33PM -0500, Ted Unangst wrote:
 Are we still tracking upstream patch in any way? I think we've
 diverged in a few places, but there still is an upstream, yes?

I don't think so.  Looking at the past, the first version was written
by Larry Wall who licensed it to FSF in GPL and to BSD in, well, BSD
license.

The README's commit states: patch(1) is now free, thanks Larry!

Which means that there are at least two license-incompatible versions,
the GNU patch and the BSD patch.  As we can't use the former, let's look
at the latter:

FreeBSD stays in sync with our implementation.
DragonflyBSD stays in sync with FreeBSD.
NetBSD stays in sync with DragonflyBSD/FreeBSD.

So, if there is any form of upstream among the larger BSDs, it's our
implementation.

GNU patch and our patch are kinda sibblings, yet GNU patch has more
features than our patch has.  The patches I've sent lately mostly apply
to our patch only, but there are also bugs that hit the GNU patch
version (and some that are exclusive to GNU patch, like using off_t for
indexing memory).

I've sent one larger diff to GNU patch and got asked if I would want
to sign a contributor agreement, but no... I'm not interested in that.
So before I send these common bug fixes to them, I would like to have
them published in our patch, first.  So they are clearly licensed in
our terms and there is no further discussion about it.

So whoever reads this:  Reviewing my diffs would help me to make faster
progress.  Will have quite some time for patch development this week
and next one, so the amount of diffs will be very likely higher than
reviewing can happen.  But every small review helps. :)


Tobias



patch: tedu sccs support

2014-11-19 Thread Tobias Stoeckmann
Hi,

as we don't even have the get command in base, there is no need to
support SCCS files anymore.  I also remember that we removed the
SCCS IDs from source files so...

Time to tedu sccs?


Tobias

Index: common.h
===
RCS file: /cvs/src/usr.bin/patch/common.h,v
retrieving revision 1.26
diff -u -p -r1.26 common.h
--- common.h11 Mar 2006 19:41:30 -  1.26
+++ common.h19 Nov 2014 18:23:01 -
@@ -39,10 +39,6 @@
 #define MAXLINELEN 8192
 #define BUFFERSIZE 1024
 
-#define SCCSPREFIX s.
-#define GET get -e %s
-#define SCCSDIFF get -p %s | diff - %s /dev/null
-
 #define RCSSUFFIX ,v
 #define CHECKOUT co -l %s
 #define RCSDIFF rcsdiff %s  /dev/null
Index: inp.c
===
RCS file: /cvs/src/usr.bin/patch/inp.c,v
retrieving revision 1.39
diff -u -p -r1.39 inp.c
--- inp.c   15 Nov 2014 16:35:47 -  1.39
+++ inp.c   19 Nov 2014 18:23:01 -
@@ -163,7 +163,7 @@ plan_a(const char *filename)
}
if (statfailed  check_only)
fatal(%s not found, -C mode, can't probe further\n, filename);
-   /* For nonexistent or read-only files, look for RCS or SCCS versions.  
*/
+   /* For nonexistent or read-only files, look for RCS versions.  */
if (statfailed ||
/* No one can write to it.  */
(filestat.st_mode  0222) == 0 ||
@@ -187,11 +187,6 @@ plan_a(const char *filename)
snprintf(buf, sizeof buf, CHECKOUT, filename);
snprintf(lbuf, sizeof lbuf, RCSDIFF, filename);
cs = RCS;
-   } else if (try(%s/SCCS/%s%s, filedir, SCCSPREFIX, filebase) ||
-   try(%s/%s%s, filedir, SCCSPREFIX, filebase)) {
-   snprintf(buf, sizeof buf, GET, s);
-   snprintf(lbuf, sizeof lbuf, SCCSDIFF, s, filename);
-   cs = SCCS;
} else if (statfailed)
fatal(can't find %s\n, filename);
/*
Index: patch.1
===
RCS file: /cvs/src/usr.bin/patch/patch.1,v
retrieving revision 1.27
diff -u -p -r1.27 patch.1
--- patch.1 15 Apr 2014 06:26:54 -  1.27
+++ patch.1 19 Nov 2014 18:23:01 -
@@ -481,8 +481,8 @@ the shortest basename, and the shortest 
 .It
 If no file exists,
 .Nm
-checks for the existence of the files in an SCCS or RCS directory
-(using the appropriate prefix or suffix) using the criteria specified
+checks for the existence of the files in an RCS directory
+(using the appropriate suffix) using the criteria specified
 above.
 If found,
 .Nm
Index: pch.c
===
RCS file: /cvs/src/usr.bin/patch/pch.c,v
retrieving revision 1.43
diff -u -p -r1.43 pch.c
--- pch.c   18 Nov 2014 17:03:35 -  1.43
+++ pch.c   19 Nov 2014 18:23:02 -
@@ -1451,7 +1451,7 @@ posix_name(const struct file_name *names
if (path == NULL  !assume_exists) {
/*
 * No files found, look for something we can checkout from
-* RCS/SCCS dirs.  Same order as above.
+* RCS dirs.  Same order as above.
 */
for (i = 0; i  MAX_FILE; i++) {
if (names[i].path != NULL 
Index: util.c
===
RCS file: /cvs/src/usr.bin/patch/util.c,v
retrieving revision 1.36
diff -u -p -r1.36 util.c
--- util.c  26 Nov 2013 13:19:07 -  1.36
+++ util.c  19 Nov 2014 18:23:02 -
@@ -374,7 +374,7 @@ fetchname(const char *at, bool *exists, 
 }
 
 /*
- * Takes the name returned by fetchname and looks in RCS/SCCS directories
+ * Takes the name returned by fetchname and looks in RCS directory
  * for a checked in version.
  */
 char *
@@ -391,9 +391,7 @@ checked_in(char *file)
 
if (try(%s/RCS/%s%s, filedir, filebase, RCSSUFFIX) ||
try(%s/RCS/%s%s, filedir, filebase, ) ||
-   try(%s/%s%s, filedir, filebase, RCSSUFFIX) ||
-   try(%s/SCCS/%s%s, filedir, SCCSPREFIX, filebase) ||
-   try(%s/%s%s, filedir, SCCSPREFIX, filebase))
+   try(%s/%s%s, filedir, filebase, RCSSUFFIX))
return file;
 
return NULL;