git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/5] Update git-sh-setup(1) to allow transparent use of git-rev-parse --parseopt

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 4, 2007, 07:43 UTC
Message-ID
<7vd4uqtpza.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1194043193-29601-3-git-send-email-madcoder@debian.org>
Pierre Habouzit <madcoder@debian.org> writes:
Show 17 quoted lines
> If you set OPTIONS_SPEC, git-sh-setups uses git-rev-parse --parseopt
> automatically.
>
> It also diverts usage to re-exec $0 with the -h option as parse-options.c
> will catch that.
>
> PARSEOPT_OPTS can also be used to pass options git git-rev-parse --parseopt
> mode (like --keep-dashdash).
>
> Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> ...
> +if test -n "$OPTIONS_SPEC"; then
> +	usage() {
> +		exec "$0" -h
> +	}
> +
> +	eval `echo "$OPTIONS_SPEC" | git rev-parse --parseopt $PARSEOPT_OPTS -- "$@" || echo exit $?`

I do not quite get why you use $PARSEOPT_OPTS without setting any yourself, which means that the users can screw themselves by having something random and insane in their environments.

Trust me that this kind of backdoor, especially when the intended uses of the backdoor is not documented well, will be abused by (perhaps clueless, perhaps curious, perhaps fearless) users and you will get blamed.

So I'd rather (1) first find out what _you_ wanted to use this backdoor for, (2) see if that is a useful feature to share with others instead of keeping that to yourself, and (3) if so to have a much narrower interface to allow such an option that cannot be abused.

The same comment applies to the git-clone one which has a similar invocation of "rev-parse --parseopt" because it cannot source git-sh-setup.

Previous: Pierre HabouzitNext: Pierre Habouzit
Message 20 of 25 in “let's retry this based on git-rev-parse --parseopt”
  1. Pierre HabouzitNov 2, 2007
  2. 1/5 Add a parseopt mode to git-rev-parse to bring parse-options to shell scripts.Pierre Habouzit, Nov 2, 2007
  3. 2/5 Update git-sh-setup(1) to allow transparent use of git-rev-parse --parseoptPierre Habouzit, Nov 2, 2007
  4. 3/5 Migrate git-clean.sh to use git-rev-parse --parseopt.Pierre Habouzit, Nov 2, 2007
  5. 4/5 Migrate git-clone to use git-rev-parse --parseoptPierre Habouzit, Nov 2, 2007
  6. 5/5 Migrate git-am.sh to use git-rev-parse --parseoptPierre Habouzit, Nov 2, 2007
  7. Alex RiesenNov 3, 2007
  8. Pierre HabouzitNov 3, 2007
  9. Pierre HabouzitNov 3, 2007
  10. 5/5 Migrate git-am.sh to use git-rev-parse --parseoptPierre Habouzit, Nov 3, 2007
  11. 6/5 Migrate git-merge.sh to use git-rev-parse --parseoptPierre Habouzit, Nov 3, 2007
  12. 8/5 Migrate git-instaweb.sh to use git-rev-parse --parseoptPierre Habouzit, Nov 3, 2007
  13. 9/5 Migrate git-checkout.sh to use git-rev-parse --parseopt --keep-dashdashPierre Habouzit, Nov 3, 2007
  14. 10/5 Migrate git-quiltimport.sh to use git-rev-parse --parseoptPierre Habouzit, Nov 3, 2007
  15. 11/5 Migrate git-repack.sh to use git-rev-parse --parseoptPierre Habouzit, Nov 3, 2007
  16. Junio C HamanoNov 4, 2007
  17. Pierre HabouzitNov 4, 2007
  18. Johannes SchindelinNov 4, 2007
  19. Pierre HabouzitNov 4, 2007
  20. Junio C HamanoNov 4, 2007
  21. 3/5 Update git-sh-setup(1) to allow transparent use of git-rev-parse --parseoptPierre Habouzit, Nov 4, 2007
  22. 5/5 Migrate git-clone to use git-rev-parse --parseoptPierre Habouzit, Nov 4, 2007
  23. 9/5 Migrate git-checkout.sh to use git-rev-parse --parseopt --keep-dashdashPierre Habouzit, Nov 4, 2007
  24. Pierre HabouzitNov 4, 2007
  25. Pierre HabouzitNov 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.