Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DIFF strange behavior

15 views
Skip to first unread message

Pierre

unread,
Feb 7, 2012, 5:39:48 AM2/7/12
to
hi, I intended to use DIFF to compare 2 directories but doing so I
found something that looks strange to me. it must be me who don't
understand something.

$ type dir_1.txt
toto.txt;1
toto.txt;2
toto.txt;3
toto.txt;4
toto.txt;5
toto.txt;6

$ type dir_2.txt
toto.txt;1
toto.txt;6
toto.txt;7
toto.txt;8
toto.txt;9
toto.txt;10

obviously version 2 to 5 were deleted while versions 7 to 10 where
added.

OK, DIFF finds the differences:

$ diff/par/match=1/wid=80 dir_1.txt dir_2.txt
-------------------------------------------------------------------------------
File USER_DISK:[toto]dir_1.txt;1 | File USER_DISK:
[toto]dir_2.txt;1
------------------- 2 ------------------------------------- 2
-----------------
toto.txt;2 |
toto.txt;3 |
toto.txt;4 |
toto.txt;5 |
------------------- 7 ------------------------------------- 3
-----------------
| toto.txt;7
| toto.txt;8
| toto.txt;9
| toto.txt;10
-------------------------------------------------------------------------------

Number of difference sections found: 2
Number of difference records found: 8

DIFFERENCES /WIDTH=80/MATCH=1/PARALLEL-
USER_DISK:[toto]dir_1.txt;1-
USER_DISK:[toto]dir_2.txt;1

I can list the lines deleted from dir_1.txt

$ diff/match=1/wid=80 dir_1.txt dir_2.txt/sep=master
************
File USER_DISK:[toto]dir_1.txt;1
2 toto.txt;2
3 toto.txt;3
4 toto.txt;4
5 toto.txt;5
************

Number of difference sections found: 2
Number of difference records found: 8

DIFFERENCES /WIDTH=80/MATCH=1/SEPARATED=MASTER-
USER_DISK:[toto]dir_1.txt;1-
USER_DISK:[toto]dir_2.txt;1

or those added to dir_2.txt :

$ diff/match=1/wid=80 dir_1.txt dir_2.txt/sep=revision
************
File USER_DISK:[toto]dir_2.txt;1
3 toto.txt;7
4 toto.txt;8
5 toto.txt;9
6 toto.txt;10
************

Number of difference sections found: 2
Number of difference records found: 8

DIFFERENCES /WIDTH=80/MATCH=1/SEPARATED=REVISION-
USER_DISK:[toto]dir_1.txt;1-
USER_DISK:[toto]dir_2.txt;1

but if now I want to highlight the differences in term of add/delete,
the fist command works:

$ diff/match=1/wid=80 dir_1.txt/change="-" dir_2.txt
************
File USER_DISK:[toto]dir_1.txt;1
1 toto.txt;1
2 - toto.txt;2
3 - toto.txt;3
4 - toto.txt;4
5 - toto.txt;5
6 toto.txt;6
************

Number of difference sections found: 2
Number of difference records found: 8

DIFFERENCES /WIDTH=80/MATCH=1-
USER_DISK:[toto]dir_1.txt;1/CHANGE_BAR=("-")-
USER_DISK:[toto]dir_2.txt;1

but the second don't (version 6 was not added...) :(

$ diff/match=1/wid=80 dir_1.txt dir_2.txt/change="+"
************
File USER_DISK:[toto]dir_2.txt;1
1 toto.txt;1
2 + toto.txt;6
3 + toto.txt;7
4 + toto.txt;8
5 + toto.txt;9
6 + toto.txt;10
************

Number of difference sections found: 2
Number of difference records found: 8

DIFFERENCES /WIDTH=80/MATCH=1-
USER_DISK:[toto]dir_1.txt;1-
USER_DISK:[toto]dir_2.txt;1/CHANGE_BAR=("+")

did I miss something about /CHANGE ?

TIA, Pierre.

Alan Feldman

unread,
Feb 7, 2012, 10:35:52 PM2/7/12
to
$ diff/match=1 dir_1.txt dir_2.txt
************
File DISK$DATA1:[FELDMAN.DIFF]DIR_1.TXT;1
2 toto.txt;2
3 toto.txt;3
4 toto.txt;4
5 toto.txt;5
6 toto.txt;6
******
File DISK$DATA1:[FELDMAN.DIFF]DIR_2.TXT;1
2 toto.txt;6
************
************
File DISK$DATA1:[FELDMAN.DIFF]DIR_1.TXT;1
******
File DISK$DATA1:[FELDMAN.DIFF]DIR_2.TXT;1
3 toto.txt;7
4 toto.txt;8
5 toto.txt;9
6 toto.txt;10
************

Number of difference sections found: 2
Number of difference records found: 8

DIFFERENCES /IGNORE=()/MATCH=1/MERGED=1-
DISK$DATA1:[FELDMAN.DIFF]DIR_1.TXT;1-
DISK$DATA1:[FELDMAN.DIFF]DIR_2.TXT;1
$

I don't know. It just does it differently in some cases.

AEF

hb

unread,
Feb 8, 2012, 4:18:37 AM2/8/12
to
Looks like a bug in /change which seems independent of the /match
(V8.3/Alpha).
Can you use GNV (aka GNU) diff?

$ mc psx$root:[bin]diff -u dir_1.txt dir_2.txt
--- dir_1.txt Wed Feb 8 02:55:54 2012
+++ dir_2.txt Wed Feb 8 02:56:38 2012
@@ -1,6 +1,6 @@
toto.txt;1
-toto.txt;2
-toto.txt;3
-toto.txt;4
-toto.txt;5
toto.txt;6
+toto.txt;7
+toto.txt;8
+toto.txt;9
+toto.txt;10
$

Pierre

unread,
Feb 8, 2012, 5:19:48 PM2/8/12
to
On Feb 8, 10:18 am, hb <becker....@gmail.com> wrote:
> Looks like a bug in /change which seems independent of the /match
> (V8.3/Alpha).
> Can you use GNV (aka GNU) diff?
>
> $ mc psx$root:[bin]diff -u dir_1.txt dir_2.txt
> --- dir_1.txt   Wed Feb  8 02:55:54 2012
> +++ dir_2.txt   Wed Feb  8 02:56:38 2012
> @@ -1,6 +1,6 @@
>  toto.txt;1
> -toto.txt;2
> -toto.txt;3
> -toto.txt;4
> -toto.txt;5
>  toto.txt;6
> +toto.txt;7
> +toto.txt;8
> +toto.txt;9
> +toto.txt;10
> $

yes, I'll have to use GNV version :(
Pierre.

Steven Schweda

unread,
Feb 8, 2012, 8:22:53 PM2/8/12
to Steven M. Schweda
> > Can you use GNV (aka GNU) diff?

GNU is not GNV.

> yes, I'll have to use GNV version :(

GNU diff for VMS does not require GNV.

http://antinode.info/dec/sw/diffutils.html

hb

unread,
Feb 9, 2012, 4:42:45 AM2/9/12
to
On Feb 9, 2:22 am, Steven Schweda <sms.antin...@gmail.com> wrote:
> > > Can you use GNV (aka GNU) diff?
>
>    GNU is not GNV.

I know. Maybe my English is not good enough to express in a few words
that the GNV diff advertises itself as a GNU diff. Run the GNV diff
utility with -v and you will see.

> > yes, I'll have to use GNV version :(
>
>    GNU diff for VMS does not require GNV.
>
>      http://antinode.info/dec/sw/diffutils.html

The GNU diff which comes with GNV requires GNV to be installed or the
diff utility to be extracted from the GNV PCSI kit. You can run it
from the command line like

$ mc psx$root:[bin]diff -v
diff (GNU diffutils) 3.0
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/
gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.
$

As pointed out in another post, the GNU diff which comes with GNV does
not work with VMS file versions. That's a result of enabling a DECC
feature: DECC$FILENAME_UNIX_ONLY. That feature is enabled for almost
all utilities which come with GNV. That doesn't really "require" GNV
but it looks like a restriction imposed by GNV. Enabling that DECC
feature for other GNU utilities for VMS very likely results in
unexpected behavior.

Steven Schweda

unread,
Feb 9, 2012, 9:55:07 AM2/9/12
to Steven M. Schweda
On Feb 9, 3:42 am, hb <becker....@gmail.com> wrote:

> As pointed out in another post, the GNU diff which comes with GNV does
> not work with VMS file versions. That's a result of enabling a DECC
> feature: DECC$FILENAME_UNIX_ONLY.  That feature is enabled for almost
> all utilities which come with GNV. That doesn't really "require" GNV
> but it looks like a restriction imposed by GNV. Enabling that DECC
> feature for other GNU utilities for VMS very likely results in
> unexpected behavior.

And, as I demonstrated in another post, my GNU diff for
VMS does not suffer from that limitation.

If you're looking for "another post" in this context, then
a search for:
"Linux style diff"
may help.
0 new messages