From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a7-smtp.messagingengine.com (fhigh-a7-smtp.messagingengine.com [103.168.172.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B315126BE1 for ; Sat, 15 Aug 2026 02:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.158 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786760259; cv=none; b=toCPkD3kg+LBa74ODhxx/oHqiUvJdMaTGH+mUnxXjjfDGc/mNno7vtKhxRp8l9p8169oB/8VkrCho4R/cLrSFWaWEL7hieHYSUtqCKJw+RkA0fLQHnNT7J/xDtU9alr58ZJNyDAPnN+DMy1gUv1JF/FEzWs6NxAcwYz5lHxUcJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786760259; c=relaxed/simple; bh=vBQ7/blEJkaJtvjKH//BslV31njg3mlSbnBy1NhN6LQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=ttHUZSJiONdqjKVoaaUHuaZERHEaDoDPmxERaAfs8/DIdSin13SVssXziwRoGzJDVSQ2SVWiYlUmh1CN1ruIo5ZiSnuIAUp0DQevTM0YpXfwxgwstXKSqUcQ+FzewypcDRuHZbl/qmKO9NGiZlLFQiji6linAN1xqZdT5jirbII= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=hMDpApE3; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ObTBa0uv; arc=none smtp.client-ip=103.168.172.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="hMDpApE3"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ObTBa0uv" Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id CF6C814000C4; Fri, 14 Aug 2026 22:17:36 -0400 (EDT) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-10.internal (MEProxy); Fri, 14 Aug 2026 22:17:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1786760256; x=1786846656; bh=jhz5W70UgU j9XskKO3mufBL2nem0K4u6HTIxpH6NcfQ=; b=hMDpApE3W5yBE+s86mE6alW/Zq h5xqo8900edFTf+/M2gON/hfUjl9Bss05B8qByNGHIpW2afjaSf6i4wGF5qUBc+v +9FdV7y5D69kMooX9IkiHdR52aqphhIuFCBrVq8g+AyVQBIp54hnle8GXxz/NZBq sAhkY94wZbrh2Dzg0AZ+ukSVxOR4IV/zB4asmmxXntZuNGqA/HGS996pXNSHXKHA riA0rGIMNZ4kmjsyCh0mxkRWcRiW13HY8EYqWNFwOi300gf8ipNlBPVlH2/3OJ3L RlyieroURY9OZt6bkwyREZpyoScIQRuBF5zLfRR0Xm1ei5av054zxA+Y+C7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1786760256; x=1786846656; bh=jhz5W70UgUj9XskKO3mufBL2nem0K4u6HTI xp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xy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Aug 2026 22:17:36 -0400 (EDT) From: Junio C Hamano To: kristofferhaugsbakk@fastmail.com Cc: git@vger.kernel.org, Kristoffer Haugsbakk Subject: Re: [PATCH 4/4] format-rev: learn --abbrev, --color, and --date In-Reply-To: (kristofferhaugsbakk@fastmail.com's message of "Thu, 13 Aug 2026 19:24:00 +0200") References: Date: Fri, 14 Aug 2026 19:17:34 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain kristofferhaugsbakk@fastmail.com writes: > +static int date_cb(const struct option *option, > + const char *arg, > + int unset) > +{ > + struct rev_info *data = option->value; > + parse_date_format(arg, &data->date_mode); > + data->date_mode_explicit = 1; > + BUG_ON_OPT_NEG(unset); > + return 0; > +} This BUG_ON_OPT_NEG(unset) is a bit curious and confusing to me. If the caller could pass unset==1 (e.g., "--no-date"), option->value would be NULL, and we would already have dereferenced data->date_mode when preparing to call parse_date_format(). On the other hand, ... > + OPT_CALLBACK_F(0, "date", &data.rev, N_("date"), > + N_("date format"), > + PARSE_OPT_NONEG, date_cb), ... because we mark the option entry with PARSE_OPT_NONEG, "--no-date" would not cause date_cb() to be called with unset==1. I guess, from existing uses of BUG_ON_OPT_NEG() elsewhere (like apply.c), that the intention is to notice when this callback function is broken by future changes, i.e., somebody careless makes the calling parse_options(), or an additional side caller that calls this callback directly, pass unset==1 and option->value==NULL combinations. But then the assertion should come before the first potentially problematic use, i.e., in this order: struct rev_info *data = option->value; BUG_ON_OPT_NEG(unset); parse_date_format(arg, &data->date_mode); data->date_mode_explicit = 1; return 0; or the assertion will not trigger before the code segfaults, no? Thanks.