bug-groff
[Top][All Lists]
Advanced

[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: Michael H Bianchi
Subject: [bug #44768] gdiffmk(1) is not Solaris 10 /bin/sh compatible - PATCH provided
Date: Mon, 13 Apr 2015 14:01:29 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Iceweasel/36.0.4

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

> Michael is the Author. 

I am happy to share authorship.  I am 67 years old and won't be here forever.
       What say you, Peter?  Want to share with me?
Everything I see says to me you should.

> 0. The canonical reference for sh compatibility issues the automake manual.

I witnessed the Shell Wars at Bell Labs in the 70s.  John Mashey and Steve
Bourne had a friendly rivalery while Brian Kernighan was referee.  Both shells
improved as a result, and Bourne's was the "winner" in the end.

 #! /bin/sh  is a permanent error because you cannot say simply what it
means.
Until there is a /bin/posix_sh from Gnu, this is going to remain a mess.  M4sh
illustrates that point, I claim.

In _my_ opinion,  /bin/bash  should be portable, a standard GNU offering, and
therefore a reasonable requirement for shell scripts.
 #! /bin/bash  would fix _all_ these problems.


> - 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"
All Done.
((But shouldn't we able to require GNU diff and sed as prerequisites?))

> - test <file> -ef <file> is not portable (NO FIX PROVIDED)
I consider this Shell Wars.  Still broken.

> - 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)
A matter of style, but in this case I think you are right enough.  The script
is easier to read this way.
All Done.

> - I always use ${1} rather than $1, that way ${10} does not look out of
place, and all variables references are the same (${thing}).
A matter of style.  Not changed.


> - 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)
Done.

> - replaced "for VAR" usage with "while test $# -gt 0"
That was _so_ wrong!  I hang my head is shame.
Done.

> - 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.
Numeric comparisons are unquoted.

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>".
I did not take your fixes from this file.  Instead I did them by hand because
I already had been stomping through the file.

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've extended the tests in  contrib/gdiffmk/tests to include both the  -aA and
-a A cases, and fixed  runtests.sh .
 make check  now passes or fails properly.  Before is always Passed, even when
things were completely broken.

Commit coming soon.  Thanks for the pointers Werner.  My education continues
...

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?44768>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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