From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 449D83B9613 for ; Tue, 21 Apr 2026 10:30:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776767434; cv=none; b=VbWEOUNQbUB2XxWsdwW3jK/P5o5DxdWWbC16A/+mrgaBSf3Pelcu/PrcjnwjrjPH22wFOHRGdhwpjBmxIln0/YNgu2JX3JMcaL+NnZtlaOLsSo+kru4qSMEx+873QdEwpqQAPqbeuTLZe9qs+od1+LEUnN3tGsbHvKqHNv8RYrY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776767434; c=relaxed/simple; bh=oXClD1JaNnv2fQj34nruK3f5TMg7a47DCaAh82Ekyy8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UXMEz5r24aWJ22a5Ec2+XwPPKIvh6hIuVFCxjf29xIle2IaFTnHCQfIQ+zdg1f8ClacxFgQrjL3fdeU+diccpJ8tW7AoSxGzdBkoKQSKLhNitdqtYp7eHCdthYt/7DMwxYYnT+dtb9G9G4pZ5PdRQbh55l8FcAoovmDS8Idnhwo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=r/yv4wHv; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=xgpd1XCW; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=r/yv4wHv; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=xgpd1XCW; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="r/yv4wHv"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="xgpd1XCW"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="r/yv4wHv"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="xgpd1XCW" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0EF656A83B; Tue, 21 Apr 2026 10:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1776767429; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=07B6aRqYXicu7TSELby0uk4hvQrXDA7VEM4xl5vnAVs=; b=r/yv4wHvb7apW70bEXSIbi1RG5QecOZKiCV/Q/KAz5SPCAQCxPXjGxRcf+CMKLoc7KmHNu re5Pm5FXPpLbR9qKg01DsjlpgNN8MoSVPOHUXM97MalN/PHNO2GvWGTgGzmGjWntOlrLxs 8VOtq0N5L+qyE1NCU+EdK8z4moFPeoM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1776767429; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=07B6aRqYXicu7TSELby0uk4hvQrXDA7VEM4xl5vnAVs=; b=xgpd1XCWF161zXathoZQ2Y1c3RiMUZMsfrRU0l8/ZEPjqYH7k+uzkNGYFbxraj52BuUlCr yl5o/Nxis3GvCRBQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="r/yv4wHv"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=xgpd1XCW DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1776767429; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=07B6aRqYXicu7TSELby0uk4hvQrXDA7VEM4xl5vnAVs=; b=r/yv4wHvb7apW70bEXSIbi1RG5QecOZKiCV/Q/KAz5SPCAQCxPXjGxRcf+CMKLoc7KmHNu re5Pm5FXPpLbR9qKg01DsjlpgNN8MoSVPOHUXM97MalN/PHNO2GvWGTgGzmGjWntOlrLxs 8VOtq0N5L+qyE1NCU+EdK8z4moFPeoM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1776767429; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=07B6aRqYXicu7TSELby0uk4hvQrXDA7VEM4xl5vnAVs=; b=xgpd1XCWF161zXathoZQ2Y1c3RiMUZMsfrRU0l8/ZEPjqYH7k+uzkNGYFbxraj52BuUlCr yl5o/Nxis3GvCRBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2391B593AF; Tue, 21 Apr 2026 10:30:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ZdFPBsRR52mjXAAAD6G6ig (envelope-from ); Tue, 21 Apr 2026 10:30:28 +0000 Date: Tue, 21 Apr 2026 12:30:21 +0200 From: Petr Vorel To: linux-kernel@vger.kernel.org Cc: Joe Perches , Simon Glass , Dwaipayan Ray , Lukas Bulwahn Subject: Re: [PATCH v6 1/2] checkpatch: Allow passing config directory Message-ID: <20260421103021.GA506589@pevik> Reply-To: Petr Vorel References: <20260420133014.484162-1-pvorel@suse.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260420133014.484162-1-pvorel@suse.cz> X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-2.21 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; HAS_REPLYTO(0.30)[pvorel@suse.cz]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.cz:+]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.cz:dkim,suse.cz:replyto]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[perches.com,chromium.org,gmail.com]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; REPLYTO_EQ_FROM(0.00)[] X-Rspamd-Queue-Id: 0EF656A83B X-Spam-Flag: NO X-Spam-Score: -2.21 X-Spam-Level: Hi Simon, all, > checkpatch.pl searches for .checkpatch.conf in $CWD, $HOME and > $CWD/.scripts. Allow passing a single directory via > CHECKPATCH_CONFIG_DIR environment variable. This allows to directly use > project configuration file for projects which vendored checkpatch.pl > (e.g. LTP or u-boot). > Although it'd be more convenient for user to have --conf-dir option > (instead of using environment variable), code would get ugly because > options from the configuration file needs to be read before processing > command line options with Getopt::Long. > While at it, document directories and environment variable in -h help > and HTML doc. I'm sorry for the noise, I need to send v7, with diff below. 1) Fix empty variable, (I was thinking about but in the end forget). 2) Print $HOME in help instead the actual value of $HOME environment variable. Kind regards, Petr +++ scripts/checkpatch.pl @@ -57,7 +57,8 @@ my %ignore_type = (); my @ignore = (); my $help = 0; my $configuration_file = ".checkpatch.conf"; -my $def_configuration_dirs = ".:$ENV{HOME}:.scripts"; +my $def_configuration_dirs_help = '.:$HOME:.scripts'; +(my $def_configuration_dirs = $def_configuration_dirs_help) =~ s/\$(\w+)/$ENV{$1} /g; my $env_config_dir = 'CHECKPATCH_CONFIG_DIR'; my $max_line_length = 100; my $ignore_perl_version = 0; @@ -151,7 +152,7 @@ When FILE is - read standard input. CONFIGURATION FILE Default configuration options can be stored in $configuration_file, -search path: '$def_configuration_dirs' or in a directory specified by +search path: '$def_configuration_dirs_help' or in a directory specified by \$$env_config_dir environment variable (fallback to the default search path). EOM @@ -1541,7 +1542,7 @@ sub which_conf { my ($conf, $env_key, $paths) = @_; my $env_dir = $ENV{$env_key}; - if (defined($env_dir)) { + if (defined($env_dir) && $env_dir ne "") { return "$env_dir/$conf" if (-e "$env_dir/$conf"); warn "$P: Can't find a readable $conf in '$env_dir', falling back to default search paths\n"; }