git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Emily Shaffer <emilyshaffer@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Derrick Stolee <stolee@gmail.com>, git@vger.kernel.org
Subject: Re: ds/maintenance-part-3 (was Re: What's cooking in git.git (Nov 2020, #02; Mon, 9))
Date: Mon, 16 Nov 2020 17:07:09 -0800
Message-ID: <20201117010709.GB15562@google.com> (raw)
In-Reply-To: <xmqqh7po7r3w.fsf@gitster.c.googlers.com>

On Mon, Nov 16, 2020 at 04:40:35PM -0800, Junio C Hamano wrote:
> 
> Emily Shaffer <emilyshaffer@google.com> writes:
> 
> > Because 'git maintenance unregister' spins a child process to call 'git
> > config --unset maintenance.repo <cwd>', it actually fails if "cwd"
> > contains a POSIX regular expression special character:
> >
> >   git config [<file-option>] --unset name [value_regex]
> 
> Good find.  And it is even worse that value_regex uses ERE, not BRE,
> which means even an otherwise innocuous letter like '+' cannot be
> used without quoting.

I should have mentioned in the first letter than Jonathan Nieder was the
one who made the jump from "this is breaking in the buildbot but not
locally" to regular expression metachars. Credit where it's due.

> 
> > You can demo it for yourself like so:
> >
> >   git init repro+for+maintenance
> >   git maintenance register
> >   git maintenance unregister
> >   echo $?	# returns '5'
> >   git config --list --global
> >
> > I see two paths forward:
> >
> 
> 0. Quote the value_regex properly, instead of blindly using a value
>    that comes from the environment.
> 
> > 1. Teach 'git config' to learn either which regex parser to use
> > (including fixed), or at least to learn "value isn't a regex", or
> >
> > 2. Don't spin a child process in 'git maintenance [un]register' and
> > instead just call the config API.
> 
> > I'd suggest #2. The config API is very nice, and seems to have a simple
> > way to add or remove configs to your global file in just a couple of
> > lines. If there's a reason why it's not simpler to do it that way, it's
> > my fault for missing the review :)
> 
> My short-to-mid-term preference is to do #1 to allow a value to be
> spelled literally (i.e. remove entry with _this_ value, and add this
> one instead), and optionally do #2 as an optimization that is not
> essential.  I do not offhand know how you can make #2 alone fly
> without doing some form of #1, as I think the same value_regex that
> ought to be ERE to specify entries to be replaced needs to be used
> under the cover even if you use "config API" anyway.

Ah, right you are - I had figured the regex parsing was done earlier,
but it indeed looks to happen in
config.c:git_config_set_multivar_in_file_gently. Thanks.

 - Emily

  reply	other threads:[~2020-11-17  1:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09 23:42 What's cooking in git.git (Nov 2020, #02; Mon, 9) Junio C Hamano
2020-11-10  0:44 ` Elijah Newren
2020-11-10  1:03   ` Jeff King
2020-11-10 13:31 ` ds/maintenance-part-3 (was Re: What's cooking in git.git (Nov 2020, #02; Mon, 9)) Derrick Stolee
2020-11-16 23:56   ` Emily Shaffer
2020-11-17  0:40     ` Junio C Hamano
2020-11-17  1:07       ` Emily Shaffer [this message]
2020-11-17 13:56         ` Derrick Stolee
2020-11-17 19:18           ` Emily Shaffer
2020-11-17 19:34           ` Junio C Hamano
2020-11-17 21:12             ` Derrick Stolee
2020-11-19  2:16               ` Junio C Hamano
2020-11-19 13:25                 ` Derrick Stolee
2020-11-19 15:53                   ` Derrick Stolee
2020-11-19 18:06                   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201117010709.GB15562@google.com \
    --to=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=stolee@gmail.com \
    --subject='Re: ds/maintenance-part-3 (was Re: What'\''s cooking in git.git (Nov 2020, #02; Mon, 9))' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git