RFR: JDK-8034199 Add 'reconfigure' target for re-creating a configuration

Martin Buchholz martinrb at google.com
Wed Feb 12 18:19:32 UTC 2014

> >
> >>>
> >>> Have you tried running with complex arguments, like
> --with-extra-cflags="-flag1 -flag2"?
> >>
> >> No. It will probably fail. :( Maybe we can detect this and warn/refuse
> to run, but I don't even want to start thinking how we could support that
> in the reconfigure target. It's probably not worth it.
> This worries me. If someone does use complicated options that would fail
> on re-run perhaps it's best to fail immediately rather than leave a
> mysterious (possibly silent) failure for some later point. Either fully
> support it or don't support it at all.
> Imagine --with-extra-cflags="-flag1 -q"
> If the -q gets turned into a configure option on reconfigure what havoc
> might this wreak?
I agree with not flaking out randomly and getting this right.

I'm not sure exactly what the problem is, but do you need a contribution
like this:

# Prints the shell-escaped version of the argument words.  If the
# result is later passed within input to any Bourne-family or csh-family
# the original words will be reconstituted, with the sole exception that the
# newline character is not reconstituted properly in a csh-family shell.
# This function is a good choice for providing a readable version of a
# command, used for example in log files, so that they can later be
# copy/pasted into a shell and executed with the original meaning.
function shell_quote() {
  local word
  local -a quoted_words=()
  for word in "$@"; do
    # Uses only shell-safe characters?  No quoting needed.
    # '=' is a zsh meta-character, but only in word-initial position.
    if [[ "${word}" =~
          && ! "${word}" =~ ^= ]]; then
      if [[ "${word}" =~ [\'!] ]]; then
        # csh does history expansion within single quotes, but not
        # when backslash-escaped!
        local quoted_quote="'\\''" quoted_exclam="'\\!'"
  local IFS=' '
  printf "%s" "${quoted_words[*]}"

More information about the build-dev mailing list