RFR: 8157948: UL allows same log file with multiple file=

David Holmes david.holmes at oracle.com
Fri Aug 26 01:44:07 UTC 2016


Hi Marcus,

We really need a better way to specify and verify these mini-grammars 
for command-line options. :(

On 25/08/2016 7:31 PM, Marcus Larsson wrote:
> Hi,
>
> Please review the following patch to fix the issue where you could have
> the same file added twice as different log outputs in UL if it had the
> "file=" prefix or if it was quoted. Log output names are now normalized
> during log argument parsing to ensure they are always normalized when
> finding existing or adding new outputs.

So does this mean that whereas today

-Xlog:gc=debug:foo

assumes foo is the log file, with this fix you will get an error?

> Webrev:
> http://cr.openjdk.java.net/~mlarsson/8157948/webrev.00/

src/share/vm/logging/logFileOutput.cpp

Suggestion:

    const char* prefix = "file=";
    assert(strstr(name, prefix) == name, "invalid output name '%s': 
missing prefix: %s", name, prefix);
    _file_name = make_file_name(name + strlen(prefix), _pid_str, 
_vm_start_time_str);

---

src/share/vm/logging/logConfiguration.cpp

Suggestion:

static const char* prefix = "file=";

In normalize_output_name it is hard for me to work out what the possible 
"grammar" is, or how different cases will be handled. Currently 
-Xlog:gc=debug:"file"=foo is treated as -Xlog:gc=debug:file=foo. But 
with your changes I think the quoting will be handled differently.

Thanks,
David

> Issue:
> https://bugs.openjdk.java.net/browse/JDK-8157948
>
> Testing:
> New unit test through JPRT
>
> Thanks,
> Marcus


More information about the hotspot-runtime-dev mailing list