Skip to contentSkip to conversation

file not found with id-utils and include-headers

Cocci Wolfram Sang 2 participants 2 messages Oct 13, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

using the latest Debian package from testing (rc18) and the following spatch on the Linux Kernel:

@@
expression e;
@@
- INIT_COMPLETION(e);
+ reinit_completion(&e);

Running with:

spatch --sp-file /tmp/reinit_completion.cocci --use-idutils --include-headers ./

I get:

init_defs_builtins: /usr/share/coccinelle/standard.h
got files
HANDLING: INIT_COMPLETION drivers/hid/hid-wiimote.h
egrep: INIT_COMPLETION: No such file or directory EXN:Sys_error("INIT_COMPLETION drivers/hid/hid-wiimote.h: No such file or directory")
...

The following files are processeed correctly. This call works on the file which fails above:

spatch --sp-file /tmp/reinit_completion.cocci --include-headers ./drivers/hid/

I hope you can reproduce.

Regards,

Wolfram

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20131013/e3f85649/attachment.asc>

#1 lore raw
Quoted 14 lines · Wolfram Sang

Hi,

using the latest Debian package from testing (rc18) and the following spatch on the Linux Kernel:

@@
expression e;
@@

(quoted diff) +1 -1
-	INIT_COMPLETION(e);
+	reinit_completion(&e);

Running with:

Quoted 8 lines

spatch --sp-file /tmp/reinit_completion.cocci --use-idutils --include-headers ./

I get:

init_defs_builtins: /usr/share/coccinelle/standard.h got files
HANDLING: INIT_COMPLETION drivers/hid/hid-wiimote.h
egrep: INIT_COMPLETION: No such file or directory

Idutils seems to put the matched pattern at the beginning of the first line of output, if there is any. This is fixed by the patch below.

julia

parsing_cocci/id_utils.ml +9 -1
index d7052dc..a121be9 100644
@@ -19,7 +19,15 @@ let rec interpret dir exp =
 	    let cmd =
 	      Printf.sprintf "lid -f %s/%s -l %s -S newline"
 		dir !Flag_parsing_cocci.id_utils_index oo in
-	    Common.cmd_to_list cmd
+	    (* lid puts the matched word at the beginning of the first line of
+	       the output... *)
+	    (match Common.cmd_to_list cmd with
+	      [] -> []
+	    | x::xs ->
+		(match Str.split (Str.regexp "[ \t]+") x with
+		  [oop;file] when oo = oop ->
+		    file :: xs
+		| _ -> failwith (Printf.sprintf "unexpected output of %s" cmd)))
 	| GC.And l ->
 	    let rec loop = function
 		[] -> failwith "bad and"