RFR: 6536943: Bogus -Xcheck:jni warning for SIG_INT action for SIGINT in JVM started from non-interactive shell
Yumin Qi
yumin.qi at oracle.com
Fri Mar 14 16:12:56 UTC 2014
David,
Do you mean if isatty actually tells whether a java running in a
non-interactive shell?
I don't understand your question, for a simple test:
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv) {
printf("Test isatty:\n");
if (!isatty(fileno(stdin))) printf("Running in non-interactive shell\n");
else printf("Running in regular shell\n");
return 0;
}
It prints out:
-bash-3.00$ ./testisatty
Test isatty:
Running in regular shell
-bash-3.00$ ./testisatty &
[1] 8033
-bash-3.00$ Test isatty:
Running in regular shell
[1]+ Done ./testisatty
-bash-3.00$ sh -c "./testisatty"
Test isatty:
Running in regular shell
-bash-3.00$
-bash-3.00$ sh -c "./testisatty &"
-bash-3.00$ Test isatty:
Running in non-interactive shell
Thanks
Yumin
On 3/13/2014 10:02 PM, David Holmes wrote:
> On 14/03/2014 2:18 PM, Yumin Qi wrote:
>> Have changed, new URL at:
>> http://cr.openjdk.java.net/~minqi/6536943/webrev02
>
> Thanks I agree with the new logic.
>
> However I can't comment on whether isatty actually tests for the
> desired condition.
>
> David
>
>> Thanks
>> Yumin
>>
>> On 3/13/2014 4:10 PM, Yumin Qi wrote:
>>> Thanks for review. I will change the order.
>>>
>>> Yumin
>>>
>>> On 3/13/2014 3:28 PM, Dean Long wrote:
>>>> (isatty(fileno(stdin)) || sig != SIGINT)
>>>>
>>>> You might want to reverse that:
>>>>
>>>> (sig != SIGINT || isatty(fileno(stdin)))
>>>>
>>>> because isatty() could be expensive.
>>>>
>>>> dl
>>>>
>>>>
>>>> On 3/13/2014 2:27 PM, Yumin Qi wrote:
>>>>> David and all,
>>>>>
>>>>> I have changed to skip SIGINT only if run in a non-interactive
>>>>> shell. Please check webrev:
>>>>>
>>>>> http://cr.openjdk.java.net/~minqi/6536943/webrev01/
>>>>>
>>>>> Thanks
>>>>> Yumin
>>>>>
>>>>> On 3/13/2014 8:19 AM, Yumin Qi wrote:
>>>>>> On 3/12/2014 10:08 PM, David Holmes wrote:
>>>>>>> Hi Yumin,
>>>>>>>
>>>>>>> Not sure that disabling all signal checks because there is a
>>>>>>> problem with one signal is the right solution for this.
>>>>>>>
>>>>>> Or we check if the signal is SIGINT --- skip it only.
>>>>>>
>>>>>> Thanks
>>>>>> Yumin
>>>>>>> That said I don't know what utility the signal checks provide in
>>>>>>> the first place. Can anyone comment on that?
>>>>>>>
>>>>>>> David
>>>>>>>
>>>>>>> On 13/03/2014 9:55 AM, Yumin Qi wrote:
>>>>>>>> Forget to mention tests:
>>>>>>>> JPRT test;
>>>>>>>> manually testing on Java2Demo, for both shell and non-interactive
>>>>>>>> shell.
>>>>>>>>
>>>>>>>> This is only disabling checking signal handlers under
>>>>>>>> non-interactive
>>>>>>>> shell, so no need to test more.
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> Yumin
>>>>>>>>
>>>>>>>> On 3/12/2014 2:52 PM, Yumin Qi wrote:
>>>>>>>>> Hi, Can I have your codereview for this simple change:
>>>>>>>>>
>>>>>>>>> http://cr.openjdk.java.net/~minqi/6536943/webrev00/
>>>>>>>>>
>>>>>>>>> Summary: Under non-interactive shell, -Xcheck:jni output
>>>>>>>>> warning for
>>>>>>>>> SIGINT, since non-interactive shells set SIGINT to SIG_IGN as
>>>>>>>>> part of
>>>>>>>>> the job control features. The fix is that don't check signal
>>>>>>>>> handlers
>>>>>>>>> if java run in a non-interactive shell. This applies to all
>>>>>>>>> platforms
>>>>>>>>> except for Windows.
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>> Yumin
>>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
More information about the hotspot-runtime-dev
mailing list