Thanks for the suggestion. Your suggestion is a better way to check if
the user is root.
But if we only use that check, then we do not verify that the file is
really unreadable.
I do not know if there are any other conditions, besides running as
root, that can fail to make a file unreadable.
I think it feels safer to really try to read the unreadable file. Then
we will get the error message.
I could add a log that says the error message is expected.
And I can change the second "grep" to your suggestion.
Mattias
On 01/19/2015 04:13 PM, Dmitry Samersoff wrote:
Mattias,
After chmod a-r grep will display unpleasant
permission denied error for non root user
so it's better just do:
if id | grep -q 'uid=0('
then
Do root staff
else
Do non-root staff
fi
-Dmitry
On 2015-01-19 16:24, Mattias Tobiasson wrote:
Hi,
Could I please have a review of this test bug fix.
Test expects some files to be unreadable. That does not work when
running as root.
The fix is to ignore the parts for unreadable files when running as root.
bug: https://bugs.openjdk.java.net/browse/JDK-8044419
webrev: http://cr.openjdk.java.net/~miauno/8044419/webrev.01
Tested as non-root on all platforms except embedded.
Tested as root on linux.
Thanks,
Mattias