The Unix Heritage Society mailing list
 help / color / Atom feed
* [TUHS] Diff and Patch on v7
@ 2020-07-25 13:52 Will Senn
  2020-07-25 14:03 ` Leah Neukirchen
  0 siblings, 1 reply; 6+ messages in thread
From: Will Senn @ 2020-07-25 13:52 UTC (permalink / raw)
  To: TUHS main list


[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

I got a diff for adding actual backspace and delete to v7, linked off of 
gunkies... Anyhow, I can manually edit the referenced files and rebuild, 
but I would rather do it canonically. I don't see patch anywhere, so did 
v7 users use diffs to patch source and if so what's the magic?

Thanks,

Will

-- 
GPG Fingerprint: 68F4 B3BD 1730 555A 4462  7D45 3EAA 5B6D A982 BAAF


[-- Attachment #2: Type: text/html, Size: 668 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [TUHS] Diff and Patch on v7
  2020-07-25 13:52 [TUHS] Diff and Patch on v7 Will Senn
@ 2020-07-25 14:03 ` Leah Neukirchen
  2020-07-25 14:28   ` Will Senn
  0 siblings, 1 reply; 6+ messages in thread
From: Leah Neukirchen @ 2020-07-25 14:03 UTC (permalink / raw)
  To: Will Senn; +Cc: TUHS main list

Will Senn <will.senn@gmail.com> writes:

> I got a diff for adding actual backspace and delete to v7, linked off
> of gunkies... Anyhow, I can manually edit the referenced files and
> rebuild, but I would rather do it canonically. I don't see patch
> anywhere, so did v7 users use diffs to patch source and if so what's
> the magic?

patch(1) was written by Larry Wall in 1985, and released over Usenet.

v7 users likely used diff -e, and piped to ed to apply it.

-- 
Leah Neukirchen  <leah@vuxu.org>  https://leahneukirchen.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [TUHS] Diff and Patch on v7
  2020-07-25 14:03 ` Leah Neukirchen
@ 2020-07-25 14:28   ` Will Senn
  2020-07-25 14:39     ` Clem Cole
  2020-07-25 15:45     ` Richard Salz
  0 siblings, 2 replies; 6+ messages in thread
From: Will Senn @ 2020-07-25 14:28 UTC (permalink / raw)
  To: Leah Neukirchen; +Cc: TUHS main list

On 7/25/20 9:03 AM, Leah Neukirchen wrote:
> Will Senn <will.senn@gmail.com> writes:
>
>> I got a diff for adding actual backspace and delete to v7, linked off
>> of gunkies... Anyhow, I can manually edit the referenced files and
>> rebuild, but I would rather do it canonically. I don't see patch
>> anywhere, so did v7 users use diffs to patch source and if so what's
>> the magic?
> patch(1) was written by Larry Wall in 1985, and released over Usenet.
>
> v7 users likely used diff -e, and piped to ed to apply it.
>
That makes sense. So, if that's how it went then I'm wondering if my 
diff is meant to run against source on the host and the results placed 
into v7, rather than run in v7. Does this look like a modern diff vs the 
old stuff?:

--- usr/src/cmd/getty.c    1979-05-05 08:19:21.000000000 +0100
+++ usr.fix/src/cmd/getty.c    2018-01-09 11:07:37.157953044 +0100
@@ -5,11 +5,11 @@

  #include <sgtty.h>
  #include <signal.h>
-#define ERASE    '#'
-#define KILL    '@'
+#define ERASE    '\177'
+#define KILL    '\025'

  struct sgttyb tmode;
-struct tchars tchars = { '\177', '\034', '\021', '\023', '\004', '\377' };
+struct tchars tchars = { '\003', '\034', '\021', '\023', '\004', '\377' };

  struct    tab {
      char    tname;        /* this table name */


Will

-- 
GPG Fingerprint: 68F4 B3BD 1730 555A 4462  7D45 3EAA 5B6D A982 BAAF


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [TUHS] Diff and Patch on v7
  2020-07-25 14:28   ` Will Senn
@ 2020-07-25 14:39     ` Clem Cole
  2020-07-25 15:19       ` Warner Losh
  2020-07-25 15:45     ` Richard Salz
  1 sibling, 1 reply; 6+ messages in thread
From: Clem Cole @ 2020-07-25 14:39 UTC (permalink / raw)
  To: Will Senn; +Cc: TUHS main list, Leah Neukirchen


[-- Attachment #1: Type: text/plain, Size: 2054 bytes --]

Will that is the output that would have go into patch(1).  As Leah says,
the old days we used diff -e to create the patch and then ed file
<diff_output
That said, when Larry wrote patch, V7 was still very much alive and kicking
and Larry had come from that world/his code would be likely to be fairly
clean of vax-isms.  I bet if you can find a version that will compile and
run on V7.   V6 is likely to be more difficult since the language changes
for stdio.  But patch(1) is small and simple so I bet even that would be
pretty straight forward.


On Sat, Jul 25, 2020 at 10:29 AM Will Senn <will.senn@gmail.com> wrote:

> On 7/25/20 9:03 AM, Leah Neukirchen wrote:
> > Will Senn <will.senn@gmail.com> writes:
> >
> >> I got a diff for adding actual backspace and delete to v7, linked off
> >> of gunkies... Anyhow, I can manually edit the referenced files and
> >> rebuild, but I would rather do it canonically. I don't see patch
> >> anywhere, so did v7 users use diffs to patch source and if so what's
> >> the magic?
> > patch(1) was written by Larry Wall in 1985, and released over Usenet.
> >
> > v7 users likely used diff -e, and piped to ed to apply it.
> >
> That makes sense. So, if that's how it went then I'm wondering if my
> diff is meant to run against source on the host and the results placed
> into v7, rather than run in v7. Does this look like a modern diff vs the
> old stuff?:
>
> --- usr/src/cmd/getty.c    1979-05-05 08:19:21.000000000 +0100
> +++ usr.fix/src/cmd/getty.c    2018-01-09 11:07:37.157953044 +0100
> @@ -5,11 +5,11 @@
>
>   #include <sgtty.h>
>   #include <signal.h>
> -#define ERASE    '#'
> -#define KILL    '@'
> +#define ERASE    '\177'
> +#define KILL    '\025'
>
>   struct sgttyb tmode;
> -struct tchars tchars = { '\177', '\034', '\021', '\023', '\004', '\377' };
> +struct tchars tchars = { '\003', '\034', '\021', '\023', '\004', '\377' };
>
>   struct    tab {
>       char    tname;        /* this table name */
>
>
> Will
>
> --
> GPG Fingerprint: 68F4 B3BD 1730 555A 4462  7D45 3EAA 5B6D A982 BAAF
>
>

[-- Attachment #2: Type: text/html, Size: 3287 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [TUHS] Diff and Patch on v7
  2020-07-25 14:39     ` Clem Cole
@ 2020-07-25 15:19       ` Warner Losh
  0 siblings, 0 replies; 6+ messages in thread
From: Warner Losh @ 2020-07-25 15:19 UTC (permalink / raw)
  To: Clem Cole; +Cc: TUHS main list, Leah Neukirchen


[-- Attachment #1: Type: text/plain, Size: 3464 bytes --]

On Sat, Jul 25, 2020 at 8:41 AM Clem Cole <clemc@ccc.com> wrote:

> Will that is the output that would have go into patch(1).  As Leah says,
> the old days we used diff -e to create the patch and then ed file
> <diff_output
> That said, when Larry wrote patch, V7 was still very much alive and
> kicking and Larry had come from that world/his code would be likely to be
> fairly clean of vax-isms.  I bet if you can find a version that will
> compile and run on V7.   V6 is likely to be more difficult since the
> language changes for stdio.  But patch(1) is small and simple so I bet even
> that would be pretty straight forward.
>

I'd start with the last larry wall version of patch, before gnu took it up.
It likely will compile there out of the box. There's a copy in 2.11BSD
that's version 2 that at least fits into a PDP-11 with separate I&D space.
It's also on the 2.10.1BSD tape as well. configure will almost certainly
work on the V7 shell. Not sure about v6, unlikely. It will compile under
V7's c compiler as well, since it's pure K&R. It also runs well enough to
apply all the diffs 2.11BSD has produced over the years. It looks like it
doesn't require separate I&D space to load, but it's big enough that it
helps a lot. V7 had separate i&D space, so you're good there.

However, it will only accept context diffs, not unified diffs. You may have
to convert newer unified diffs to context diffs. Well, it also accepts
normal diffs and ed scripts too :)

Looking at the size of FreeBSD's patch, it's only 53kB text and 8kB data on
amd64, so there's a chance newer versions will fit (this is the last
BSD-licensed version, with bug fixes). It groks everything that gnu patch
groks. gnu patch is 175k of text and 8k of data and is quite likely a lost
cause on the pdp-11 (with overlays, 176k is the absolute max, but 150k is
where it gets hard... but V7 didn't have an overlay linker).

Warner

>
> On Sat, Jul 25, 2020 at 10:29 AM Will Senn <will.senn@gmail.com> wrote:
>
>> On 7/25/20 9:03 AM, Leah Neukirchen wrote:
>> > Will Senn <will.senn@gmail.com> writes:
>> >
>> >> I got a diff for adding actual backspace and delete to v7, linked off
>> >> of gunkies... Anyhow, I can manually edit the referenced files and
>> >> rebuild, but I would rather do it canonically. I don't see patch
>> >> anywhere, so did v7 users use diffs to patch source and if so what's
>> >> the magic?
>> > patch(1) was written by Larry Wall in 1985, and released over Usenet.
>> >
>> > v7 users likely used diff -e, and piped to ed to apply it.
>> >
>> That makes sense. So, if that's how it went then I'm wondering if my
>> diff is meant to run against source on the host and the results placed
>> into v7, rather than run in v7. Does this look like a modern diff vs the
>> old stuff?:
>>
>> --- usr/src/cmd/getty.c    1979-05-05 08:19:21.000000000 +0100
>> +++ usr.fix/src/cmd/getty.c    2018-01-09 11:07:37.157953044 +0100
>> @@ -5,11 +5,11 @@
>>
>>   #include <sgtty.h>
>>   #include <signal.h>
>> -#define ERASE    '#'
>> -#define KILL    '@'
>> +#define ERASE    '\177'
>> +#define KILL    '\025'
>>
>>   struct sgttyb tmode;
>> -struct tchars tchars = { '\177', '\034', '\021', '\023', '\004', '\377'
>> };
>> +struct tchars tchars = { '\003', '\034', '\021', '\023', '\004', '\377'
>> };
>>
>>   struct    tab {
>>       char    tname;        /* this table name */
>>
>>
>> Will
>>
>> --
>> GPG Fingerprint: 68F4 B3BD 1730 555A 4462  7D45 3EAA 5B6D A982 BAAF
>>
>>

[-- Attachment #2: Type: text/html, Size: 5097 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [TUHS] Diff and Patch on v7
  2020-07-25 14:28   ` Will Senn
  2020-07-25 14:39     ` Clem Cole
@ 2020-07-25 15:45     ` Richard Salz
  1 sibling, 0 replies; 6+ messages in thread
From: Richard Salz @ 2020-07-25 15:45 UTC (permalink / raw)
  To: Will Senn; +Cc: TUHS main list, Leah Neukirchen


[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

> -#define ERASE    '#'
> -#define KILL    '@'
> +#define ERASE    '\177'
> +#define KILL    '\025'
>

That is a context diff.  The wikipedia page
https://en.wikipedia.org/wiki/Diff#Context_format has a reasonable
history.  Short answer is context diffs appeared in 2.8BSD in 1981 and
unified context diffs were posted to Usenet in 1990. Context diffs are more
robust if you have made local changes (patch's "fuzz" messages), and
unified are more compact version and can be more useful to see exactly
before/after lines.

A comparison of the outputs follows:
; diff a.cpp.orig a.cpp
3d2
<     int size;
6c5
< : elem{new int[s]}, size{s}
---
> : elem{new int[s]}

; diff -e a.cpp.orig a.cpp
6c
: elem{new int[s]}
.
3d

; diff -c a.cpp.orig a.cpp
*** a.cpp.orig Sat Jul 25 11:37:29 2020
--- a.cpp Sat Jul 25 11:42:21 2020
***************
*** 1,9 ****
  class x {
      int *elem;
-     int size;
  public:
      x(int s)
! : elem{new int[s]}, size{s}
      {
      }
      ~x() { delete[] elem; }
--- 1,8 ----
  class x {
      int *elem;
  public:
      x(int s)
! : elem{new int[s]}
      {
      }
      ~x() { delete[] elem; }

; diff -u a.cpp.orig a.cpp
--- a.cpp.orig 2020-07-25 11:37:29.000000000 -0400
+++ a.cpp 2020-07-25 11:42:21.000000000 -0400
@@ -1,9 +1,8 @@
 class x {
     int *elem;
-    int size;
 public:
     x(int s)
- : elem{new int[s]}, size{s}
+ : elem{new int[s]}
     {
     }
     ~x() { delete[] elem; }

;

[-- Attachment #2: Type: text/html, Size: 2066 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-25 13:52 [TUHS] Diff and Patch on v7 Will Senn
2020-07-25 14:03 ` Leah Neukirchen
2020-07-25 14:28   ` Will Senn
2020-07-25 14:39     ` Clem Cole
2020-07-25 15:19       ` Warner Losh
2020-07-25 15:45     ` Richard Salz

The Unix Heritage Society mailing list

Archives are clonable: git clone --mirror http://inbox.vuxu.org/tuhs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.tuhs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git