QNX4: error in diff with -R option

Hi folks,

running diff (v1.1) with -r or -R should compare the files with same name of
different directories. Doing so we detected an error:

  • we put 2 files (binary executable images) into 2 different directories and
    spatch’ed one of them at 2 locations (somewhere in static text area where we
    found some debug messages of the executable).

  • then we ran diff:

$ diff -R dir1 dir2
Common subdirectories: ./. and /pss.rev/pss.4.11.1/bin/.
Common subdirectories: ./… and /pss.rev/pss.4.11.1/bin/…

  • but a single diff, cksum and cmp will decide these files being different:

$ diff dir1/txe dir2/txe
4c4
<stuffstuffSTRING1stuff

stuffstuffSTRING2stuff

$ cksum dir1/txe dir2/txe
542297641 89105 dir1/txe
3771645721 89105 dir2/txe

$ cmp -l dir/txe dir2/txe
225 146 144
226 146 151

What’s the reason for that ? Will it become an update ?

/martin

…nobody knows…nobody cares…
???

Martin Koehler <software@pcds.de> schrieb in im Newsbeitrag:
8urk44$l6b$1@inn.qnx.com

Hi folks,

running diff (v1.1) with -r or -R should compare the files with same name
of
different directories. Doing so we detected an error:

  • we put 2 files (binary executable images) into 2 different directories
    and
    spatch’ed one of them at 2 locations (somewhere in static text area where
    we
    found some debug messages of the executable).

  • then we ran diff:

$ diff -R dir1 dir2
Common subdirectories: ./. and /pss.rev/pss.4.11.1/bin/.
Common subdirectories: ./… and /pss.rev/pss.4.11.1/bin/…

  • but a single diff, cksum and cmp will decide these files being
    different:

$ diff dir1/txe dir2/txe
4c4
stuffstuffSTRING1stuff

stuffstuffSTRING2stuff

$ cksum dir1/txe dir2/txe
542297641 89105 dir1/txe
3771645721 89105 dir2/txe

$ cmp -l dir/txe dir2/txe
225 146 144
226 146 151

What’s the reason for that ? Will it become an update ?

/martin

Hi Martin,

I don’t know the answer to your question, but am a little puzzled as from my
reading of the utilities on diff I thought that it was for text files rather
than binaries. This is because of all the references to ‘lines’ and also
because it has options for output in RCS format.

Is my understanding incorrect ?

We wrote a little utility for comparing binaries because we did not have
much success with diff. It doesn’t have all the nice options for recursion,
but at least it seems to work.

Sue King

“Martin Koehler” <software@pcds.de> wrote in message
news:8urk44$l6b$1@inn.qnx.com

Hi folks,

running diff (v1.1) with -r or -R should compare the files with same name
of
different directories. Doing so we detected an error:

  • we put 2 files (binary executable images) into 2 different directories
    and
    spatch’ed one of them at 2 locations (somewhere in static text area where
    we
    found some debug messages of the executable).

  • then we ran diff:

$ diff -R dir1 dir2
Common subdirectories: ./. and /pss.rev/pss.4.11.1/bin/.
Common subdirectories: ./… and /pss.rev/pss.4.11.1/bin/…

  • but a single diff, cksum and cmp will decide these files being
    different:

$ diff dir1/txe dir2/txe
4c4
stuffstuffSTRING1stuff

stuffstuffSTRING2stuff

$ cksum dir1/txe dir2/txe
542297641 89105 dir1/txe
3771645721 89105 dir2/txe

$ cmp -l dir/txe dir2/txe
225 146 144
226 146 151

What’s the reason for that ? Will it become an update ?

/martin

Sue King wrote:

Hi Martin,

I don’t know the answer to your question, but am a little puzzled as from my
reading of the utilities on diff I thought that it was for text files rather
than binaries. This is because of all the references to ‘lines’ and also
because it has options for output in RCS format.

Is my understanding incorrect ?

We wrote a little utility for comparing binaries because we did not have
much success with diff. It doesn’t have all the nice options for recursion,
but at least it seems to work.

So the “cmp” util wasn’t good enough? You could also combine that with
“find” to recurs through a directory tree. Something like

cd dir1
find . -type f -exec cmp {} fullpath_to_dir2/{} ; -print

You can add more sophisticated selection criteria, such as objects only
(-name option) or executables only (-perm option).

Sue King

“Martin Koehler” <> software@pcds.de> > wrote in message
news:8urk44$l6b$> 1@inn.qnx.com> …
Hi folks,

running diff (v1.1) with -r or -R should compare the files with same name
of
different directories. Doing so we detected an error:

  • we put 2 files (binary executable images) into 2 different directories
    and
    spatch’ed one of them at 2 locations (somewhere in static text area where
    we
    found some debug messages of the executable).

  • then we ran diff:

$ diff -R dir1 dir2
Common subdirectories: ./. and /pss.rev/pss.4.11.1/bin/.
Common subdirectories: ./… and /pss.rev/pss.4.11.1/bin/…

  • but a single diff, cksum and cmp will decide these files being
    different:

$ diff dir1/txe dir2/txe
4c4
stuffstuffSTRING1stuff

stuffstuffSTRING2stuff

$ cksum dir1/txe dir2/txe
542297641 89105 dir1/txe
3771645721 89105 dir2/txe

$ cmp -l dir/txe dir2/txe
225 146 144
226 146 151

What’s the reason for that ? Will it become an update ?

/martin

I have also seen this here (with text files, not binaries)
I got two different source distributions for the same product (and verified
differences in the source of several modules)
when I did a diff -r to collect all of the differences, it only reported
file differences, never differences in text within the files.
In my limited understanding, diff -r should also report the text differences
within the files!


Martin Koehler <software@pcds.de> wrote in message
news:8vdh5h$jj5$1@inn.qnx.com

…nobody knows…nobody cares…
???

Martin Koehler <> software@pcds.de> > schrieb in im Newsbeitrag:
8urk44$l6b$> 1@inn.qnx.com> …
Hi folks,

running diff (v1.1) with -r or -R should compare the files with same
name
of
different directories. Doing so we detected an error:

  • we put 2 files (binary executable images) into 2 different directories
    and
    spatch’ed one of them at 2 locations (somewhere in static text area
    where
    we
    found some debug messages of the executable).

  • then we ran diff:

$ diff -R dir1 dir2
Common subdirectories: ./. and /pss.rev/pss.4.11.1/bin/.
Common subdirectories: ./… and /pss.rev/pss.4.11.1/bin/…

  • but a single diff, cksum and cmp will decide these files being
    different:

$ diff dir1/txe dir2/txe
4c4
stuffstuffSTRING1stuff

stuffstuffSTRING2stuff

$ cksum dir1/txe dir2/txe
542297641 89105 dir1/txe
3771645721 89105 dir2/txe

$ cmp -l dir/txe dir2/txe
225 146 144
226 146 151

What’s the reason for that ? Will it become an update ?

/martin
\

Try the cmp utility.

In article <904ckk$i90$1@inn.qnx.com>, sue@torrensbs.com.au says…

Hi Martin,

I don’t know the answer to your question, but am a little puzzled as from my
reading of the utilities on diff I thought that it was for text files rather
than binaries. This is because of all the references to ‘lines’ and also
because it has options for output in RCS format.

Is my understanding incorrect ?

We wrote a little utility for comparing binaries because we did not have
much success with diff. It doesn’t have all the nice options for recursion,
but at least it seems to work.

Sue King

“Martin Koehler” <> software@pcds.de> > wrote in message
news:8urk44$l6b$> 1@inn.qnx.com> …
Hi folks,

running diff (v1.1) with -r or -R should compare the files with same name
of
different directories. Doing so we detected an error:

  • we put 2 files (binary executable images) into 2 different directories
    and
    spatch’ed one of them at 2 locations (somewhere in static text area where
    we
    found some debug messages of the executable).

  • then we ran diff:

$ diff -R dir1 dir2
Common subdirectories: ./. and /pss.rev/pss.4.11.1/bin/.
Common subdirectories: ./… and /pss.rev/pss.4.11.1/bin/…

  • but a single diff, cksum and cmp will decide these files being
    different:

$ diff dir1/txe dir2/txe
4c4
stuffstuffSTRING1stuff

stuffstuffSTRING2stuff

$ cksum dir1/txe dir2/txe
542297641 89105 dir1/txe
3771645721 89105 dir2/txe

$ cmp -l dir/txe dir2/txe
225 146 144
226 146 151

What’s the reason for that ? Will it become an update ?

/martin
\

Rick,

Our utility was originally written for QNX 2 which did not have a cmp. When
we were new to QNX4 we simply converted it. As it did what we needed on the
odd occasions that we did need to use it, we didn’t look any further at the
utilities.

Thanks for pointing it out to me.

Sue King


“Rick Lake” <rwlake@SPAM.REDIRECTED.TO.DEV.NULL> wrote in message
news:3A2616C4.CA13EEA1@SPAM.REDIRECTED.TO.DEV.NULL

Sue King wrote:

Hi Martin,

I don’t know the answer to your question, but am a little puzzled as
from my
reading of the utilities on diff I thought that it was for text files
rather
than binaries. This is because of all the references to ‘lines’ and
also
because it has options for output in RCS format.

Is my understanding incorrect ?

We wrote a little utility for comparing binaries because we did not have
much success with diff. It doesn’t have all the nice options for
recursion,
but at least it seems to work.

So the “cmp” util wasn’t good enough? You could also combine that with
“find” to recurs through a directory tree. Something like

cd dir1
find . -type f -exec cmp {} fullpath_to_dir2/{} ; -print

You can add more sophisticated selection criteria, such as objects only
(-name option) or executables only (-perm option).


Sue King

“Martin Koehler” <> software@pcds.de> > wrote in message
news:8urk44$l6b$> 1@inn.qnx.com> …
Hi folks,

running diff (v1.1) with -r or -R should compare the files with same
name
of
different directories. Doing so we detected an error:

  • we put 2 files (binary executable images) into 2 different
    directories
    and
    spatch’ed one of them at 2 locations (somewhere in static text area
    where
    we
    found some debug messages of the executable).

  • then we ran diff:

$ diff -R dir1 dir2
Common subdirectories: ./. and /pss.rev/pss.4.11.1/bin/.
Common subdirectories: ./… and /pss.rev/pss.4.11.1/bin/…

  • but a single diff, cksum and cmp will decide these files being
    different:

$ diff dir1/txe dir2/txe
4c4
stuffstuffSTRING1stuff

stuffstuffSTRING2stuff

$ cksum dir1/txe dir2/txe
542297641 89105 dir1/txe
3771645721 89105 dir2/txe

$ cmp -l dir/txe dir2/txe
225 146 144
226 146 151

What’s the reason for that ? Will it become an update ?

/martin