lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 Nov 2020 10:14:52 -0800
From:   Joe Perches <joe@...ches.com>
To:     Dwaipayan Ray <dwaipayanray1@...il.com>
Cc:     linux-kernel-mentees@...ts.linuxfoundation.org,
        linux-kernel@...r.kernel.org, lukas.bulwahn@...il.com
Subject: Re: [PATCH] checkpatch: add --fix option for OPEN_BRACE issues

On Wed, 2020-11-18 at 18:10 +0530, Dwaipayan Ray wrote:
> Brace style misuses of the following types are now
> corrected:
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3937,9 +3937,23 @@ sub process {
>  			#print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n";
>  
> 
>  			if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
> -				ERROR("OPEN_BRACE",
> -				      "that open brace { should be on the previous line\n" .
> -					"$here\n$ctx\n$rawlines[$ctx_ln - 1]\n");
> +				if (ERROR("OPEN_BRACE",
> +					  "that open brace { should be on the previous line\n" .
> +						"$here\n$ctx\n$rawlines[$ctx_ln - 1]\n") &&
> +				    $fix) {
> +					my $line1 = $rawlines[$ctx_ln - 2];

How are you sure that in a patch context this line always starts with /^\+/ ?

> +					my $line2 = $rawlines[$ctx_ln - 1];
> +					fix_delete_line($ctx_ln - 2, $line1);
> +					fix_delete_line($ctx_ln - 1, $line2);
> +
> +					my $fixedline = rtrim($line1) . " {";
> +					fix_insert_line($ctx_ln - 1, $fixedline);
> +					$fixedline = $line2;
> +					$fixedline =~ s/^(.\s*)\{\s*/$1\t/;
> +					if ($fixedline !~ /^\+\s*$/) {
> +						fix_insert_line($ctx_ln - 1, $fixedline);
> +					}
> +				}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ