← Back to team overview

touch-packages team mailing list archive

[Bug 1319655] Re: getopt example in docs incorrectly implies /bin/sh may not be used (PATCH)

 

The attachment "patch.txt" seems to be a patch.  If it isn't, please
remove the "patch" flag from the attachment, remove the "patch" tag, and
if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by
~brian-murray, for any issues please contact him.]

** Tags added: patch

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to util-linux in Ubuntu.
https://bugs.launchpad.net/bugs/1319655

Title:
  getopt example in docs incorrectly implies /bin/sh may not be used
  (PATCH)

Status in util-linux package in Ubuntu:
  Confirmed

Bug description:
  getopt(1) works with /bin/sh, bash, and probably other Bourne-ish
  shells (as well as csh-family shells with the appropriate option).

  However the included examples give the impression that something about
  getopt(1) makes it incompatible with /bin/sh, leading one to assume
  that scripts MUST use bash instead of sh.    The author probably meant
  merely that the "bash" example would not work with tcsh; however less-
  experienced script writers might not find that to be obvious.

  First of all, the Bourne-syntax example unnecessarily uses bash, i.e.
  leading one to wonder why the more-universal sh shell could not be
  used.   And there is a comment in the example saying "This program
  will only work with bash(1)".

  
  SUGGESTED IMPROVEMENT (patch attached):

  . Rename /usr/share/doc/util-linux/examples/getopt-parse.bash to
  getopt-parse.sh

  . Change the example to use /bin/sh instead of bash, and change the
  comment to say that that example works only with sh-compatible shells,
  including bash.


  P.S.  The --shell option to getopt(1) accepts arguments 'sh', 'bash',
  'csh', and 'tcsh', however internally there is no difference between
  'sh' and 'bash' (or between 'csh' and 'tcsh').   See source code at
  https://kernel.googlesource.com/pub/scm/utils/util-linux/util-
  linux/+/v2.22.2/misc-utils/getopt.c

  ProblemType: Bug
  DistroRelease: Ubuntu 13.10
  Package: util-linux 2.20.1-5.1ubuntu9
  ProcVersionSignature: Ubuntu 3.11.0-20.34-generic 3.11.10.6
  Uname: Linux 3.11.0-20-generic x86_64
  NonfreeKernelModules: nvidia
  ApportVersion: 2.12.5-0ubuntu2.2
  Architecture: amd64
  Date: Wed May 14 21:00:48 2014
  InstallationDate: Installed on 2013-08-06 (282 days ago)
  InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Release amd64 (20130424)
  MarkForUpload: True
  SourcePackage: util-linux
  UpgradeStatus: Upgraded to saucy on 2013-10-24 (202 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1319655/+subscriptions