-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: Replace binary data blobs under test_JSON with uuencoded blobs #239
Comments
Good call on these tools. I tend to forget them as I rarely need them. I am not sure if I will do this as I should focus on A question to consider: the option letters to specify the paths to the tools. My thinking is:
But maybe you think it should be the other way round? What do you think? (Disclaimer: typing this on the phone: but if I made a typo on the tools and their names you know what I mean!) |
I just remembered this issue and I know nothing has happened with it so I thought I'd reply to this to get some conversation going (besides what I suggested already).
I guess the script that you refer to is now: I still think this script will be necessary so I think this issue is a valid issue still but it might be that this modification will not be so useful to worry about until after
But with that in mind I suppose the script could be modified so that first it finds EDIT 0: Ah. You must mean it would remove the |
On finding a |
That’s true. I was still waking up and trying to fit it into the make clobber idea. This means that we don’t even need to modify that rule I guess. |
I started working on this but it occurred to me that much more has to be done here as now the semantics of the checks also have to change as it's not two tools but one. This requires too many changes in my tired state (truthfully I'm exhausted and I was thinking all I'd have to do is parse a So for now I'm not going to do that and I don't think I'll end up doing anything else today either I'm afraid. Hopefully tomorrow I can do something or some things but we'll see. It's still possible I do something but I don't know if I will and I rather doubt it as I need to just rest and I have a zoom meeting in the afternoon. I do know one thing I could do but I'm realising that I'm too tired for that even even though it's very simple. Hope you're having a nice sleep my friend! |
Something occurred to me on this issue. If we want this as part of the test procedure - which we will want with If the idea is to get rid of NUL files from the repo it forces the user to have these tools. But what if they don't have them? Then we cannot test the NUL bytes. If they do it's not a problem. Now we could maybe have two sets of tests: one is the regular files and one is the binary tests which instead of aborting if the tools are not found it simply skips the tests. What do you think? |
... strange problem ... $ /usr/bin/uudecode -o /dev/stdout ./test_JSON/bad/nul0.json.uu |./jparse -v 0 -J 0 -- -
ERROR[33]: parse_json_stream: stream is not open
ERROR[1]: ./jparse: invalid JSON Except for that this is done. EDIT 0Using $ cat test_JSON/bad/nul0.json.uu
begin 644 nul0.json
$>P!]"@``
`
end and it's possible I have done something wrong as well of course. UPDATE 0It must be because of: /*
* determine stream position
*
* The ftell() function will fail if stream is not open.
*/
pos = ftell(stream);
if (pos < 0) {
return false;
} Should we not use this if the file is stdin ? UPDATE 1:It's because of this. Modifying that function a bit I get: $ /usr/bin/uudecode -o /dev/stdout ./test_JSON/bad/nul0.json.uu |./jparse -v 0 -J 0 -- -
Warning: is_open_stream: ftell() returned < 0: errno[29]: Illegal seek EDIT 1Can you seek on binary data ? I'm not sure. It seems like one should be able to since the script works fine on the file with NUL itself but not when it's on stdin. EDIT 2Another test: redirecting the uudecode of the file to some other file and then running jparse on that file and it has no problem. UPDATE 1I fixed this which you'll see below. |
.. and with commit 550ab6a I believe this issue is resolved. You can let me know what you think. The log details the change to the function that was causing a problem. EDIT 0Oh wait. I forgot. This might not be strictly true that all binary data is removed. There are a few places I just remembered. The info.json/bad and author.json/bad subdirectories also have binary data. But the question is: what actually makes use of those files ? Do we still need them ? If we do what tests it ? I'm not sure but at least the one part is fixed. EDIT 1Okay it's actually the old check script. Can we safely get rid of the test_JSON/{info,author}.json subdirectories ? We would keep |
yes |
By NUL files you mean files with NUL bytes in them? We don't think we need to that. It is not a problem for people using the |
Yes which I tested. I was just trying to think of 'what could it be'. I never did get quite the right answer except that maybe it was a fifo. Not sure now .. that was too many hours ago now. |
Of course.
Yeah. Well I just made it skip the test if they don't have the right tool. I presume that's okay. |
We are considering closing this issue with a Close as not planned as this is neither required nor a priority. |
Sure though it doesn't hurt to have the |
Well on 2nd thought, perhaps the use of |
Well as I said the issue is resolved unless we need to do something with the old scripts that use |
Should we delete those two subdirectories then ? Or should we hold on to them in case they're necessary ? |
The idea, of course, was that the Under
We do like the idea that the generic good and bad sub-directories (those that are independent of the We suspect that tests for |
Of course.
That's indeed why I added it. More specifically it was for when you do a mass test of the parser that you referred to not too long ago.
I'd think that too. So are you saying the files should stay there? If that's the case will there need to be a new script that tests What do you think ? |
As for the |
That would be one way of dealing with I suppose. It would remove the need for uudecode. The only possible thing to consider is what if someone wants to screw with the contest by submitting binary data in the json file? Okay the entry would be rejected but should chkentry check it? Or would the fact the json parser would first declare it as invalid be enough? But then consider if someone comes up with a clever way to circumvent that: if we had files that are invalid json we could then test it? Just a few random thoughts on that. |
Yes, the In particular, If you prefer, you can rename them:
As that makes the purpose of those files more clear.
Yes, we working on such script as part of our
Yes, please. If you want to both add |
Right.
Yes. That's what I had in mind.
Or maybe
Makes sense.
Well I can do the renaming but until the chkentry script is made I of course cannot add So as far as I can tell right now the only thing I can do is rename the directories. Is |
Thanks for closing this issue, @xexyl. We think it is for the best. Please undo the need for |
How do you mean? Undo the changes to |
We realize that we are changing our minds on the
Perhaps we should NOT fear binary blobs after all. :-) Let us remove the need for
If the JSON parser rejects the file as invalid JSON, then No need to special case binary stuff. Let such files pass or fail by the JSON parser. |
Funny! :-)
Sure. So rename the files back and change the script to what it was before. Also change the man page.
So I thought.
Sure. |
Remove the need for the |
Yes doing that now. Shouldn't take long. |
We like the Why don't you rename the directories and update the test tools accordingly? In particular, The The The UPDATE 0Minor edits to the above. |
Ah. Well this will slow me down slightly. I was just writing a commit message. I'll save it, make changes and then do a git commit amend. But as for the only good files in the I'll be making a pull request soon. |
Thanks .. we will wait for it. |
Well although you already saw I wanted to say you're welcome. Also with commit 66622c8 the invalid json files were removed from I don't know if this file will fail for some other reason but if not and it's not checked in our functions this might need to be added? I'm not sure: what do you think ? |
There will be a bunch of additions to test_JSON soon. |
Sounds good. I'll be leaving soon so I hope what I did today will work for you. If not I'll have to fix it tomorrow. |
To avoid the annoyance of carrying around binary blobs in the repo, binary blobs under
test_JSON
should be replaced with uuencoded ASCII files. Thejson_test.sh
should be modified to uudecode such files during the test.Consider using a
.uu
file extension for such unencoded binary blobs undertest_JSON
. Consider how to clean up such uudecoded tests: within thejson_test.sh
itself and/or themake clean
(ormake clobber
) rule.The text was updated successfully, but these errors were encountered: