Right, the snippet feature -- I'd forgotten about that. Ok, I have everything I need now to write the guidance. Larry -----Original Message----- From: Michael Fanning <
Michael.Fanning@microsoft.com> Sent: Friday, April 13, 2018 1:10 PM To: Larry Golding (Comcast) <
larrygolding@comcast.net>; 'James A. Kupsch' <
kupsch@cs.wisc.edu>;
sarif@lists.oasis-open.org Subject: RE: [sarif] Re: Please comment on #125 The answer to your question is yes, a user could kick off a single build as part of a single tool run, each project of which could generate a new version of a file. If the tool intercepted all compiler calls to do some work, for example, you might get into this condition. file hash SHOULD be generated for generated files that may be overwritten. If the content is too copious to be embedded in the log file, we have the snippet feature to help mitigate against the possibility the original file hasn't been overwritten. Michael -----Original Message----- From: Larry Golding (Comcast) <
larrygolding@comcast.net> Sent: Friday, April 13, 2018 11:18 AM To: Michael Fanning <
Michael.Fanning@microsoft.com>; 'James A. Kupsch' <
kupsch@cs.wisc.edu>;
sarif@lists.oasis-open.org Subject: RE: [sarif] Re: Please comment on #125 You know, part of our proposed solution might not be needed at all for the "generated files" scenario. Consider this sequence: 1. The build system executes a build and creates generated file. 2. The analysis tool analyzes the output, including the generated file, detects a result in the generated file, and produces a SARIF log file. 3. The build system builds a different configuration, and overwrites the generated file. 4. The analysis tool analyzes the output, including the generated file, detects a result in the generated file, and produces a _different_ SARIF log file ... or, it inserts a new `run` into the existing log file. Either way, there's no need to generate unique uriBaseIds. The two incarnations of the generated file are mentioned in different `run.files` dictionaries, so there's no conflict. We still have the issue of how to enable the user to diagnose the issue, so we _should_ still provide guidance about when it makes sense to embed file contents, and when it makes more sense just mention the file hash. All this assumes that there is only one version of the generated file present for any given run of the analysis tool. The question is: Is it ever the case that multiple versions of the same file are created _during a single run of an analysis tool_? Jim, please comment. Thanks, Larry -----Original Message----- From:
sarif@lists.oasis-open.org <
sarif@lists.oasis-open.org> On Behalf Of Larry Golding (Comcast) Sent: Friday, April 13, 2018 9:55 AM To: 'Michael Fanning' <
Michael.Fanning@microsoft.com>; 'James A. Kupsch' <
kupsch@cs.wisc.edu>;
sarif@lists.oasis-open.org Subject: RE: [sarif] Re: Please comment on #125 Your suggestion to include the file hash is a good one. Two comments, though: 1. Important comment: Providing the hash does indeed avoid the experience I described, where a viewer unwittingly opens the current version of a file even though the result was found in a previous version. But it does not address my main concern, which is that unless you embed the contents, there is _no way at all_ for a viewer or any other tool to allow a user to see the result in its context, which will make it more difficult to correct. For example, if the repeatedly-overwritten file is the output of a code generator, and the code generator has a bug, not having the actual generated code will make the problem harder to fix. Not impossible; the error message itself might suffice ("Missing semicolon!"). But harder. I can certainly add text explaining the trade-off. 2. Unimportant comment: Although strictly speaking, there's no such thing as "strongly recommend", I can fake it the way I did when writing about hash functions. Recall that I wrote "To maximize interoperability, the array MAY contain algorithms from IANA-HASH ... The array MAY contain algorithms that do not appear in IANA-HASH, but at the expense of interoperability." So I used "MAY" for both, but I editorialized a little. Likewise here, I can say something like "The files object SHOULD contain an entry for the file that includes the hash property ... The files object MAY omit the entry, but that will make it impossible for a consumer to verify that it has the desired version of the file." Larry -----Original Message----- From: Michael Fanning <
Michael.Fanning@microsoft.com> Sent: Friday, April 13, 2018 9:06 AM To: Larry Golding (Comcast) <
larrygolding@comcast.net>; 'James A. Kupsch' <
kupsch@cs.wisc.edu>;
sarif@lists.oasis-open.org Subject: RE: [sarif] Re: Please comment on #125 I don't think there's anything to do here. There's a well-established convention in viewers for situations where file contents can't be matched by hash, they throw up a file/open dialog and/or emit a message 'the file at the current location does not match the original content, would you like to open it anyway?' You see both of these when debugging. So, we don't need a smart convention. Maybe we DO need to strongly recommend that, minimally, the file hash information is emitted in cases where it is prohibitively expense to embed the contents. This gives the viewer enough information to know if it found the right content or not. Michael -----Original Message----- From: Larry Golding (Comcast) <
larrygolding@comcast.net> Sent: Wednesday, April 11, 2018 10:09 AM To: Michael Fanning <
Michael.Fanning@microsoft.com>; 'James A. Kupsch' <
kupsch@cs.wisc.edu>;
sarif@lists.oasis-open.org Subject: RE: [sarif] Re: Please comment on #125 I go back to a question I asked you on another thread: If you don't persist the overwritten contents to the log file, and you don't move a copy of the file to another location before overwriting it, then what's a viewer to do when a user tries to navigate to the site of the error? Consider this experience: 1. A tool detects a result in version 1 of the generated file foo.g.cs and logs it. 2. The build system overwrites the generated file with version 2. Later... 3. The user opens the log in a viewer and double clicks on a result from the overwritten file. 4. The viewer finds the file at the specified location, but it's not the right version, so the target location has nothing to do with the reported result. One way to avoid this is to introduce a convention and have a smart viewer: Convention: the uriBaseId has the form "someString-n", for example "generated-1", "generated-2"... [Note: I think Michael might have suggested this convention at one point.] Smart viewer: when the user attempts to navigate to a file whose uriBaseId is "generated-1", the viewer notices that run.originalUriBaseIds has an entry for a later version "generated-2", so it tells the user that the file was overwritten. I don't like this because it requires the analysis tool (or the build system's post-processor) to add an entry for "generated-2" to run.originalUriBaseIds, even if no results are found in version 2 of the overwritten file. This just feels really fragile to me. Larry -----Original Message----- From: Michael Fanning <
Michael.Fanning@microsoft.com> Sent: Tuesday, April 10, 2018 1:34 PM To: James A. Kupsch <
kupsch@cs.wisc.edu>; Larry Golding (Comcast) <
larrygolding@comcast.net>;
sarif@lists.oasis-open.org Subject: RE: [sarif] Re: Please comment on #125 Hold on. I didn't say you SHALL persist file contents in this case, I said that in many cases you should consider it (because that content isn't under source control). Please note, that if you don't emit the file contents, the uriBaseId and file table key name construction still makes it clear that separate results referred to a different version of a generated file that was persisted to a common location. Without introducing a new property. And so I prefer my solution.