[Fakeroot-devel] getopt version string

Timmy Weerwag timmy at timmyweerwag.nl
Thu Nov 27 10:41:16 UTC 2014


Fakeroot tries to detect which getopt is installed by parsing its 
version string (lines 46-54 of the fakeroot script). However, in some 
locales, the version string does not start with "getopt". For example:

$ LANG=nl_NL.UTF-8 getopt --version
'getopt' uit util-linux 2.25.2

In that case, getopt isn't recognized as a GNU one, and that eventually 
causes problems with quoting:
$ getopt -- a "echo 'hello world'"
  -- 'echo '\''hello world'\'''
$ getopt a "echo 'hello world'"
  -- echo 'hello world'
After the 'eval set --', in the first case, $2 is "echo 'hello world'", 
and in the second case just "echo" (and $3 is "hello world").

 From the man page of getopt:

> SYNOPSIS
> getopt optstring parameters
> getopt [options] [--] optstring parameters
> [...]
> Quoting is not enabled if the environment variable GETOPT_COMPATIBLE is 
> set, if the first form of the
> SYNOPSIS is used, or if the option '-u' is found.

Timmy Weerwag



More information about the Fakeroot-devel mailing list