[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #44768] gdiffmk(1) is not Solaris 10 /bin/sh compatible - PATCH pro

From: Peter Bray
Subject: [bug #44768] gdiffmk(1) is not Solaris 10 /bin/sh compatible - PATCH provided
Date: Mon, 13 Apr 2015 01:45:55 +0000
User-agent: Mozilla/5.0 (X11; SunOS i86pc; rv:29.0) Gecko/20100101 Firefox/29.0

Follow-up Comment #7, bug #44768 (project groff):


Further testing and hacking shows the following
- Solaris sed(1) is not up to the task of showing deletions
  but GNU sed(1) is. Added -s SEDCMD
- DIFFCMD was set but not used in the most critical place ;-)
- if ! <command> is not portable, replaced with "test $? -ne 0"
- test <file> -ef <file> is not portable (NO FIX PROVIDED)
- inconsistent uppercase vs lowercase use in variable names (NOT FIXED)
  fixed only cmd -> CMD
- $# and $? are numbers and don't need quoting (to the best of my knowledge)
- I always use ${1} rather than $1, that way ${10} does not look out of
  and all variables references are the same (${thing}).
- in theory any file path could contain spaces (thankfully most Unix people
  never do that), but most user provided variables should be surrounded by
  double quotes (at least that is what I have found in my 25+ years working
  with many different Bourne shell implementations)
- replaced "for VAR" usage with "while test $# -gt 0"
- numeric comparisons in Bourne shell are -lt -le -eq -ne -ge -gt, though
  many people seem to use "${x}" = "3", and this is probably reasonable, if
  you don't if x actually contains a number, the numeric operator break
  badly for the empty string and non-numeric values.

The attached script that seems to work for the basic case (two file
arguments to stdout), the three file arguments does not work due to
the use of "test <f> -ef <f>".

Further testing is still required. <shell> -n <file> passes for
Solaris 10 /bin/sh, Solaris 10 ksh, zsh 4.3.9 and bash 4.0.0 (this is
an older system). But as demonstrated this does not detect things like
"test <f> -ef <f>".

I have attached the whole script (the original .sh file, not the
generated one), rather than a patch, it up to you what you deem
reasonable for inclusion in the groff code base. And I personally do
not wish to be credited as an author (I try to practice ego-less


PS: Formalities: I have requested copyright assignment "paperwork" via
address@hidden, but that probably won't arrive until tomorrow my
time. I hereby donate the changes to the author / current maintainer
to do with as he/she pleases, without the need or requirement for
attribution, copyright or ownership in any form, now or in the future.

(file #33662)

Additional Item Attachment:

File name: gdiffmk.sh                     Size:7 KB


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]