Closed yilmazdurmaz closed 2 years ago
wait, that's exactly the issue that I fixed in 3.8....: $ ./cobra -cpp -terse cobra.h : !echo $ARGS cobra.h cobra_fe.h cobra_prim.h : !$ARGS sh: cobra.h: command not found
@nimble-code
actually it is not, if you mean the one I posted before, issue #35 .
This time $ARGS
comes empty at some point before line 213.
but all the examples you give just work on my system, using version 3.8: $ ./cobra -cpp -terse cobra.h : !echo $ARGS cobra.h cobra_fe.h cobra_prim.h : !echo C: $COBRA , A: $ARGS and F: $FLAGS C: /home/USER/Dropbox/GitHub/Cobra/rules/../bin , A: -cpp -terse cobra.h cobra_fe.h cobra_prim.h and F:
ah, but I see your point, the flags are grouped under A: ? is that the issue?
@nimble-code
hmm, now you mentioned it, it seems my "dummy" files cause the main problem. They have no content in them created by touch
.
I thought the filename would be held in $ARGS
, but it seems the current implementation does that only when there is content in it. I put a single non-space character in it and now $ARGS
is filled. But now seeing this, I am not sure about the fix for file names with spaces as it does not show quotes.
: !echo $ARGS
with space.c
And then what you last wrote seems another problem: anything between $FLAG
and $ARGS
is removed, the , Args:
part in the below case.
: !echo Cobra: $COBRA , Flags: $FLAGS , Args: $ARGS c:41 p:10 n:148 Cobra: /workspace/Cobra/rules/../bin , Flags: -cpp -terse Cobra/src/cobra_prim.h Cobra/src/cobra_fe.h Cobra/src/cobra.h
currently, I don't have a practical example, but this might be a problem for writing flexible rulesets using spawned processes.
by the way, we may move part of this issue to a new one, because apparently the main title gets solved by having a file with some content, or you can keep this open as at any time, some source repos may have empty placeholder files.
I take back the spaces-fix part. it does work! :)
ok, i'll close this one for now
C
is not my main language, but I feel I am grasping bit by bit. I might come up with a solution later before you do.
Cheers, YILMAZ
Somewhere else in the code with update 3.8 changed the behavior for
check_args
, or they were silent bugs awaiting this moment.I run the program with a dummy empty file with a few flags
cobra -cpp -terse nospace.c
.if I try only
!$ARGS
, the following assertion error comes up.I have added a printf statement before that line and also changed it to
... < n+1
to see a result. I have found that this assertion failure happens because$ARGS
is now empty. the assertion passes only when there are more characters after $ARGS.for the use of
$FLAGS
, I found this by accident while trying the following command. at first, I thought it was$ARGS
filled wrong, but since it is already empty, then it is only the$FLAGS
being redirected in the wrong orderlastly, if I use
$FLAGS
before$ARGS
(which it normally should be), the command is cut short after the use of$FLAGS
I hope the solution will be easy and fast because especially the rulesets using
scope_check
and similar shell spawns are now compromised with this empty$ARGS
.PS: I was trying to see your changes for filenames containing spaces, but this problem happens with no spaces too.