From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796504035; b=bR0nzhgG0lTozTWj4iNoflbBDHzhBl+AYstE29wpl7sF9+htUC/QOHr184HoJZoQw+5r p8480RSs+MOuEVA1+ENy+J846jetupQFnHEITpxEQ6+qkmW8RtW0YTsepNN/PLs8CuBYu hzrHs7AsXz92gor54pbkj5gyMQK4svKdlu/ZqeFMdJ2eITtGeu2pLXI/OobWD58doDKw4 3Fs3j9/NtkeqDH3MfbMhyWR7Ea+PDUKVOHbyMmL70g7c4KAUG9mHiLNnfhS/ad2GJNSkL GTkaDYWtnuO2jVgquXWX943cCfRLjmHj2gj7Mtze6sQo9KZFVQkthbL0VjXPvA08OvQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796504035; 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=eAZe6eO3NkGb1pO+ufpQEO7xmrlBY4Kdm+d6x6PQGi0=; b=YTTjkcyWc0ppEHlgplsOJYgC6yrF3WGskQCMn4ghF8pYexPD3srV8iHbtFKaIINwWv4t yIvj21THauJPha5jWvPs3cuiu01GlguF+Ufzjqtn2SDaGyqf1CB9ERTeTkdtY+BFmtEN6 FTEKxelc2y7J9x78GUXb8RFLkCsyhC05uPlTApS5IQUGVFwMxHgyZAp6rZhdda1JozwaR JBCFKUcAyzuvVlFjnduVylEl9n15k2AjtixWY4BoogDYfDw77N8yn9o14Uy45nFHdksrf VUpdgR6X2Y/Be8pqGdTnChyUq+PQ6LM72sDZ5oThaIBS7ugsqSmw3KSRTpbX5fP1arg== 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=yAkd64TR; arc=none smtp.remote-ip=74.125.82.47 Received: from mail-dl1-f47.google.com (mail-dl1-f47.google.com [74.125.82.47]) (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 379F7606A31F for ; Sat, 5 Dec 2026 20:53:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 379F7606A31F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=yAkd64TR Received: by mail-dl1-f47.google.com with SMTP id a92af1059eb24-1b5d60183f9so2573849c88.1 for ; Sat, 05 Dec 2026 12:53:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796504034; x=1797108834; 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=eAZe6eO3NkGb1pO+ufpQEO7xmrlBY4Kdm+d6x6PQGi0=; b=yAkd64TRe00X7U40FmJ41gcbZl13oBsLlRqYmr2NH/ZH0T2dnSgRT+vCYgOEumGXS2 Usad8PuZIZvf4eimAIJywQdzeQtwQ+w28huh/AjjOHFL+n0zceXHpxXN7y/o7RJHlxAv 33+x+jk007Nunq8BKO4CZoM9zyiu5BvAff0xuJ/HJVdhtvE8YPQMxkLZ/pPDU3fFA9zY xv6QpVzudkXbkomn5xMdQ9XHJzEHf1ENBjQbb0+4PVPB6ERd5qqrX4i1pH0p8ell5UgF J6lMH9d3s1Pve24ONsjyN45wV0LZW591CpYSlLe92NBlE+3+DO8Lim5aWRaIUMf5O4mH jHpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796504034; x=1797108834; 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=eAZe6eO3NkGb1pO+ufpQEO7xmrlBY4Kdm+d6x6PQGi0=; b=MSKPd0hJ4+LpkLnYz9V/j2FnW0639KsJrHmBE513yIIE+Cyg8oBB/Bnmf+ljDm6piv ocBd1fChmXYvbLMsrMaH7i5Y67KZAqNr0EGPrMVIvZQk3g9UZaq/8lDMwA02TynkVeAh JoMS+QvpK3QAMIeKTg/lLR+cXrQWD9Ofstk1AKXl3EIbhUzk++uYZTRcJM8cmgHZC8Cv SyeCJ10so+jhtGoeBcve9to/y0ujAT7iZ6dt0jbNtZzs1Ewm6KtMC/cTKTcjgzw0RaYw UbvZ/wSrZ+MtbQvSyfEkX2eoNKa1q262h5YDGKMw6nmrmXVHePIovGlE8lJ4aY7olVzM ELdg== X-Gm-Message-State: AB4q+uFNjTvWwMfvJRV2k4QNr2uiBfWwMzzPkoMHp4Ns4JzF8PwNIHGW IFe4ttKNLxZyYVaOM7ffrmh2xA6lzK5zoYvZZBmSHiOfhhhL/G7D++9INY+KgAJm X-Gm-Gg: AZFdTZdIsgixVZvzeUNnKNzPmqaVSIdYUhkykuDVRhr58AqOqXTxuOR0kyTgbyl7fVt G7nvsYWFOlTOTDQNZLfl5j/JFQSFncWzahDWqlb3bFSZReEUW4/BlwZp1ehEGtZVIoKoM8vrTKG WZj45EWfQTb4cgiNHLbvfA6q1VwKxoUlVRAfKbN/3x+g1jMiyVnbXyk0DzAPFbxLPccA5nBJx7Z OlaWsLW1yOUUm3XlOu/oJepqW3T0lTjl9+7K2CH7G+kaOAxJgMOzMhKOTM79lW43vZ+zMdfPiq/ w9GkSV6pvat+CqhUbmsoN/zj11nfFVHahJvkETKTB6uOOZKq65OX8QMAiR1bbNMJQbJgfuw3vyg Zd5M8Gw4ghlF8mcFePFTzOcmXAjnARtwlPIPdDIdCc4I5NfMiBUUXQFz4uE862NMxSYC0ifuW70 Q7tvzSB/1dSuqz/Iy1WRTxFrBWK1633J4o953tMLL+Zcdfc8okxSKQ5s4ByeJ2la4JCeMhvfeVw /nvgdvEHdsNUxkGb1AqvdXZzcjm0fNVvUDAgEsq8CdPTyKnC8/zOUGbH9Br06lhAIc2ih2GNGe4 f53lmPBeGDrqz2pfQMWVrt68ew2ceb9NphbML+6BJBGmFkhwHQ== X-Received: by 2002:a05:7300:a506:b0:385:bc4e:dbbf with SMTP id 5a478bee46e88-38752169f20mr6275354eec.37.1796504034233; Sat, 05 Dec 2026 12:53:54 -0800 (PST) Received: from aeron-host ([103.177.178.109]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-387521c17a3sm25440377eec.11.2026.12.05.12.53.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2026 12:53:53 -0800 (PST) From: Abhishek Agarwal To: Patrick Steinhardt Cc: git@vger.kernel.org, Junio C Hamano , Jacob Keller , Adrian Ratiu Subject: Re: [PATCH 1/2] clone: reject a negative --jobs before cloning Date: Sun, 6 Dec 2026 02:22:18 +0530 Message-ID: <20261205205218.46612-1-agab0323@gmail.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: References: <20261202171328.805150-1-agab0323@gmail.com> <20261202171328.805150-2-agab0323@gmail.com> X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Thu, Dec 03, 2026 at 10:56:03AM +0100, Patrick Steinhardt wrote: > Does this really warrant `OPT_CALLBACK()`? Can't we use `OPT_UNSIGNED()` > instead? > > Well, the answer is "not trivially" because of the sentinel value, which > is "-1". But we could convert `max_jobs` to an unsigned value and use a > sentinel value of `UINT_MAX`. I don't think anyone would ever configure > a maximum job count of multiple billions of jobs, so that might be an > alternative that requires less plumbing overall. > > The status quo isn't all that bad either, though, so I'll leave it up to > you to decide whether you want to take this suggestion. Thanks for the review. I tried it. The catch is that the value still ends up in an int: fetch hands it to fetch_multiple() and fetch_submodules(), and clone passes it on to "submodule update", whose --jobs is still OPT_INTEGER(). So a value above INT_MAX gets past OPT_UNSIGNED() and goes wrong later: - "git fetch --jobs=3000000000" turns negative in max_children and is silently replaced by fetch.parallel again. If I compare max_jobs with UINT_MAX instead, it dies with "data too large to fit into virtual memory space". - "git clone --recurse-submodules --jobs=3000000000" clones the superproject first and is only rejected by "submodule update" afterwards. A range check after parse_options() in both commands fixes that, and the result is still a bit smaller than the callback. But it adds a message for the range check, and since OPT_UNSIGNED() sets PARSE_OPT_NONEG, "--no-jobs" (which OPT_INTEGER() parses as 0) would stop working unless I spell the option out by hand. The callback accepts the same values as before, except negative ones, and gives the same message as "submodule update --jobs", so I would prefer to keep it. If you or Junio prefer the unsigned version, I am happy to send a v2. The same goes for 2/2. Thanks, Abhishek