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-next>] [day] [month] [year] [list]
Date:   Thu, 10 Aug 2017 20:40:25 +0300
From:   Cihangir Akturk <cakturk@...il.com>
To:     Julia.Lawall@...6.fr
Cc:     Gilles.Muller@...6.fr, nicolas.palix@...g.fr, mmarek@...e.com,
        cocci@...teme.lip6.fr, linux-kernel@...r.kernel.org,
        Cihangir Akturk <cakturk@...il.com>
Subject: [PATCH] coccicheck: improve pattern for getting relative path

When invoked with V=1, coccicheck script prints the information about
which semantic patch (*.cocci file) used for this operation.  Actually,
it prints out the relative path of the related semantic patch. The
script uses sed to remove the source tree part from cocci file path like
so:

FILE=`echo $COCCI | sed "s|$srctree/||"`

This pattern works well most of the time. But in cases where $COCCI
doesn't start with "./" characters, it doesn't remove the right part.

Consider the following scenario:

$ make coccicheck COCCI=scripts/coccinelle/api/drm-get-put.cocci \
                        MODE=patch M=drivers/staging V=1

where

COCCI=scripts/coccinelle/api/drm-get-put.cocci and srctree=.

In this case, out pattern matches the first "s/", and we end up
assigning "scriptcoccinelle/api/drm-get-put.cocci" to $FILE.

Fix this by adding a caret ^ at the beginning of regex pattern, so that
it matches only start of the path.

Signed-off-by: Cihangir Akturk <cakturk@...il.com>
---
 scripts/coccicheck | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/coccicheck b/scripts/coccicheck
index ec487b8..8de4245 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -193,7 +193,7 @@ coccinelle () {
 
     if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then
 
-	FILE=`echo $COCCI | sed "s|$srctree/||"`
+	FILE=`echo $COCCI | sed "s|^$srctree/||"`
 
 	echo "Processing `basename $COCCI`"
 	echo "with option(s) \"$OPT\""
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ