🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #2013

Re: [PATCH v3 4/4] fast-import: use early_scan_options() for --allow-unsafe-features

#2013
From: Cynthia Uche
Date: Sat, 31 Oct 2026 14:22
56 lines
13119 bytes
Hi Christian,

I read through the series and ran t0040 and t9300 on the
cc/early-scan-options topic, as in origin/seen (tip dabb68a20d).
All 118 tests in t0040 pass, including the new early-scan tests, and
all 261 tests in t9300 pass, including the new R: tests.

> +	 * The scan uses the same options as parse_options() below, so the
> +	 * two agree on which options take a value and on abbreviations. In
> +	 * case of doubt, the scan stops early, so unsafe features are then
> +	 * refused rather than wrongly allowed.
> +	 */
> +	early_scan_options(argc - 1, argv + 1, fast_import_options,
> +			   EARLY_SCAN_STOP_AT_NON_OPTION,
> +			   option_parse_early_allow_unsafe, &state);

The call passes EARLY_SCAN_STOP_AT_NON_OPTION, but the 3/4 header says
to pass it when parse_options() is called with
PARSE_OPT_STOP_AT_NON_OPTION or with subcommands. That is not the case
here: parse_argv() calls parse_options() with only PARSE_OPT_KEEP_ARGV0,
and the table has no subcommands. Stopping at the first non-option is
the safe direction, and it matches the old loop, which also broke at
the first argument not starting with a dash. But the comment only says
the scan stops early "in case of doubt", and does not mention this flag.

With an input file containing
"feature import-marks-if-exists=nonexistent.marks", I tried:

  ./git fast-import --depth 5 --allow-unsafe-features <input

which succeeds (exit=0), and

  ./git fast-import --depth 5 extra --allow-unsafe-features <input

which dies with "forbidden in input without --allow-unsafe-features"
(exit=128). The stray "extra" would make parse_options() fail with a
usage error, but that only happens after the stream's feature lines
have been processed.

To see what the flag changes, I replaced EARLY_SCAN_STOP_AT_NON_OPTION
with 0 locally and ran the second command again. It then failed with
the usage error (exit=129) instead, so the scan had gone past "extra",
seen --allow-unsafe-features, and the unsafe feature line was accepted
before parse_options() rejected the command line.

I would suggest adding a sentence to the comment saying that the scan
stops at the first non-option through EARLY_SCAN_STOP_AT_NON_OPTION,
even though parse_options() is not called with
PARSE_OPT_STOP_AT_NON_OPTION, so that readers know why the flag is
passed.

I did not find other issues in this patch :)

Thanks,
Cynthia
Technical Details
Message-ID: <20261031142255.4941-1-herroyalpriestess@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74011-linux-kernel-git=dewy.ru
References: <20261012074413.337183-5-christian.couder@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74011-linux-kernel-git=dewy.ru
From: herroyalpriestess@gmail.com (Cynthia Uche)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v3 4/4] fast-import: use early_scan_options() for --allow-unsafe-features
Date: Sat, 31 Oct 2026 15:22:55 +0100
Organization: Usenet Network
Message-ID: <20261031142255.4941-1-herroyalpriestess@gmail.com>
References: <20261012074413.337183-5-christian.couder@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2475067"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:OR4pV3cJ503CZUbIjiaX/cAHgH8= sha256:yWu6qQbIM9zfFtnjZUn+vxk5atALE2CAYCSFAD69n54=
	sha1:0BZvZLrzpS1LFPbPlTpDlAwZRK0= sha256:+HI6rS6JBhydmKq19YpPA+dx69dNHirqXEkIQXKlNWw=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 0B6D4125CB6; Sat, 31 Oct 2026 17:29:11 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.452
X-Spam-Status: No, score=-0.452 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_SBL=2.596,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id sMd8EYPeK_Ex;
	Sat, 31 Oct 2026 17:29:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-74011-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 157AA125CB7; Sat, 31 Oct 2026 17:28:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id D11DD2C02A; Sat, 31 Oct 2026 14:25:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793456729;
	b=OyhmG4sg/wgu+EkOeygwjgpaq62fTGVWlruQExHmSRtPBzyCLZzwe6mhjYCFMFbm2lkX
	 GN3fLgWk6JkHQ7XFvuSGV+T/6WaYGkyl9+titBg9yUMhfmUO6V2p1pZonrtoRaFR+Z/HB
	 P9SBvIWDPuKHEcdamIK+Knu0GtSynEf4f7FFOhE+ccApgz2y++jdOvp+q46T6V+3qg9u3
	 RU7NejdG5KuJNOf8miMtOXJX1S9fPw3LQEBP5qTyWJz4g9uqFh7EfFdHiQKakeMp/Qg2k
	 TOShaSzoywzZ3x6HoStd1jwioIW0bxEB8LZyn5XIHxEAecPErMdJK/3dYefh7ZSlGfg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793456729;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=8sWgtpDDsU5STAyixtP/tV4jyvckanoIgoSJYAQ3Z0M=;
	b=CMGCuNyKy94OMuaVlWA0V2N04k11gIuRa0KOsUx75WHqtm2atT15WwN/0Br3ZHeuc9Yg
	 P7joIXAE5cxhTanI1u8CVuArfowSr6rl4FtHmc+w/JtWkdZIMXeZJtO47h+B8ZsFZEGXJ
	 2CQdsnUiNQ4kuPd+g+vxVhyaKBZ6q3t60yc7/6P9HCYcNuvht6EPKADy18rkNMYeCP5ji
	 auTiJwGw6FGr0fCdDA9bsQ7GQ5uWHhLc479EyjRDFTheUu5BDHgidvAMqieMfEOVdHZWX
	 ywYevYJb66lnutOKgz51VyO4Uu34xLfF45YOgQ6NBJwoZ+wCdRqF1R067AFsWm+Xtng==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=QoNn87ka;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A74F4606A32C;
	Sat, 31 Oct 2026 14:25:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=QoNn87ka
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.49
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793456723;
	b=HQdfY4BRSV+TiEeEb07mraZ4BoaVP+jITzP6sRCkZeEBezZpM6YH25nO2Ju5FulzdAqA
	 s9MVzrNnQWeZoY3ngGUC4e3Zu0tUn/t8HSDT09mJwQr6IvtVuHdHCmUK/fRDHKfo5c7No
	 ET2844W3DqBepp9IgHEVclQ1rmpZWSpKyhNH8ttqvChw2rbLkrm+E1yzYPaw8U30ppuLO
	 ST3842YnVl1qIyyh5tjT6r8yIY0BgRRtcjqhoNoU+d+H/myCv8wpov49QAS1WQEUIFMya
	 AmC6Fhwi4LvHaQjCub/Hdqgu50MTtbzqjNoLC5UgueqKiEIVVpV5jESoj20kHqhUsbg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793456723;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=8sWgtpDDsU5STAyixtP/tV4jyvckanoIgoSJYAQ3Z0M=;
	b=GyWdXhS1fcsYSNdBIkfvMXhuOjXNgc0xvOvmZz1KtdmoF/ZXaclAD4w5NZWyjrO/p67y
	 UeHsKrft/g7k3tyWX/k0Ppan/UPlzQPB1Q7nZ94jHDFpuOimtFL1sq+RZmuRIeOHQz4Uv
	 cpoP7kjVluWAjIlM4i9FIrlgeb62l/dyUbFV3CJ6d5Kg45+14z17IK8Ru1b0xybP2/bAF
	 y5Pu0XzlGAUfUakk2rjW6xKfm/uE3TTnubBObzPeBOrOuuqF/+fDVEOeVKOOvKTj09IIK
	 CtSy1ghqOp930U9vg1rKKi+nheStHpdY74iViH4N6aDgjqx+s74kmLnrCwjLVwVUrgQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=QoNn87ka;
	arc=none smtp.remote-ip=209.85.128.49
X-Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D0EB606A324
	for <git@vger.kernel.org>; Sat, 31 Oct 2026 14:25:23 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6D0EB606A324
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4a35ac4475dso11080535e9.2
        for <git@vger.kernel.org>; Sat, 31 Oct 2026 07:25:23 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793456722; x=1794061522; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=8sWgtpDDsU5STAyixtP/tV4jyvckanoIgoSJYAQ3Z0M=;
        b=QoNn87kaJ1wnUgpwwAfkoAmmlqpHyeErCpOnXh9m1jpIaaYr7OGw9tOphT+r2+oBgH
         USCPFaon6+J33drUzInSJQ8pYyP3n67cNhhB0LtI9pU7DcNuhxne1OZUKmfDX1V4qopA
         TdQcGSYg+iQeFon8iB/ODynasVTbP2/A2NGL11yIqx6iHZOo6Y9nkCCNvWZTPf71PH8n
         KJos9sLh/cAK6dGQPJwfY+BUPGcTfYqjZg/+603MsMQHOAby+q7GEmoaceXqUnVUEb4j
         E7wqs3dk/MYTq9oU2LDiyGa+DINimTxYXNoqerJZzOt5HzrnLZkI62dRMoJ+l+P1qNgO
         sXZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793456722; x=1794061522;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=8sWgtpDDsU5STAyixtP/tV4jyvckanoIgoSJYAQ3Z0M=;
        b=syglu0VlDA3acFfWBUzu8okK586Bc+AetSqFoW4hfYPOHhmRMk4AEDGhkEzQN7/eTz
         kiXVi/P30fYlenwEmnfRgBLCM303GRDkeSEWcvSw1XmDUcEWlvpbg1O6xmtKo7B7ytQr
         YxfkoPIBouuVjVujOXUSkJHCxC9BCx+i9bcEQzEoOQfXTQkwKq/ttz8Wa0g0vHReMkGR
         +OArAePag+YWwIhxR+FKB3S8gVTmJY3zqA76yVlrgLh3YG5++L9JjgfvY8ZfivkSFxIC
         QZLyAsVXJj4gPTzub7oUFqc3Qa+6EZDtw/5RTn8H0r3zOQsy5tNnljSHYRAkF6eNcbX5
         dLHw==
X-Gm-Message-State: AFq9FYI2OwVUC7NTC6Xvz1/csDugNcAxQ7KvYAITdNk96UNfWalHLWZc
	QSyBsfafvyDEtORg485vJiNjQzCKcl7YdgxFCELZBapOzJN/LLrG5+Ce
X-Gm-Gg: AYBFou0mz8H6GwtFHd6K2ntxzGTAy8rGrxW/ZojR2cd0EImtkih4xlOA2gtKKZEyek9
	Bzu9xvtQsOkUOQJJmPcABaYwMlHx6UlosisFDngPIdyEMKwQUMotBLRjGQNix1Wh1Q/8KKqjqbc
	5XwV+MRHm1/TDjnXD8b5fuzIGiljCKOMTCiEJr4ckrGB2LRizumaM5zMIN9LR2Ghpc51Vrif5a2
	h6QFPdio1TcjMJNWeshz8dIdeKSjUEVGCCKCl1wvR9WvfYlEWKrKYEKwZeb4YydaOseCWkAbTpm
	OueAzzZReDf5u/nl6PShv7hQdjmsxLSYQwFm5VQRCMAK9IoDxrrakjO11pw0YO3xkCMD8oy4dnE
	JjcUDd8sJTa1H8kkq+xmldWQjOEa2/Db94OzWDXgGkbRHhYXYBGFoksbRgdMqVZmw7dEM9LthAz
	DiLcCiTgwBpk0o1vqy0Dd8w72xgG4GwBFf/up5gyWmBttGze3bct4j/3ArsMfI5ntJ352BTfzvf
	27o7cb2dUzHm27s/yR4VlBDCQ6FrtXoZE+n3tRhxRuDgKvZ0EJI4rPJ69lJALfuT0XjX00jbgFo
	qSVBqzIeHDq2SDEGgvcAiVMjxPA++4SOh6pveuubRVz8CTq4qFPv
X-Received: by 2002:a05:600c:3b2a:b0:4a4:3a2d:15da with SMTP id 5b1f17b1804b1-4ac1709a2c3mr114845195e9.15.1793456721599;
        Sat, 31 Oct 2026 07:25:21 -0700 (PDT)
X-Received: from GODS-GIFT.localdomain ([197.211.58.196])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e71b80306sm9721477f8f.33.2026.10.31.07.25.15
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 31 Oct 2026 07:25:21 -0700 (PDT)
X-Cc: git@vger.kernel.org,
	gitster@pobox.com,
	kaartic.sivaraam@gmail.com,
	ps@pks.im,
	newren@gmail.com,
	peff@peff.net,
	sandals@crustytoothpaste.net,
	Johannes.Schindelin@gmx.de,
	jltobler@gmail.com,
	cynthianuchepro@gmail.com
X-Mailer: git-send-email 2.56.GIT
X-In-Reply-To: <20261012074413.337183-5-christian.couder@gmail.com>
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list