On 2014-01-22 14:38, David Holmes wrote: > On 22/01/2014 7:57 PM, Dmitry Samersoff wrote: >> On 2014-01-22 10:39, David Holmes wrote: >>> On 22/01/2014 12:00 AM, Dmitry Samersoff wrote: >>>> Missed CR in subject. Sorry! >>>> >>>> http://cr.openjdk.java.net/~dsamersoff/JDK-8002116/webrev.01/ >>> >>> You already create the file with mkFiles so no need to echo something >>> into it, a simple cat will suffice to see if it is unreadable. >> >> Exit code of cat is not specified. So cat is enough to just warn user, >> but we have to use grep to branch. >> >> Grep should return 2 in case of permission denied, but it's not stable >> across implementations - grep can return 0 if patter is found and 1 in >> all other cases. >> >> So I just choose the most reliable solution. > > So grep is commonly better than cat but still not guaranteed - okay. But > can't you simply grep the empty file to get the same result?
If I would grep the empty file I expect the exit code: 1 - pattern not found 2 - file not readable It usually works, but some of grep implementations return either 0 (pattern found) or 1 (in all other cases) -Dmitry > > No big deal. > > David > >>> Not sure why this was being run as root though - can't be normal else >>> we'd have seen this before. There are other tests that fail when run as >>> root due to still being able to read/write unreadable/unwriteable files. >> >> I plan to file infrastructure bug to clarify it. Tests shouldn't run as >> root in any case. >> >> -Dmitry >> >>> >>> BTW the indention in that test case is messed up (in the original). >>> >>> David >>> >>>> >>>> On 2014-01-21 17:49, Dmitry Samersoff wrote: >>>>> Hi Everyone, >>>>> >>>>> Please review. >>>>> >>>>> http://cr.openjdk.java.net/~dsamersoff/JDK-8002116/webrev.01/ >>>>> >>>>> I can't reproduce the issue locally, but suspect, the test failed >>>>> because after chmod a-r the file is sill readable. So check it >>>>> explicitly before run the test itself. >>>>> >>>> >>>> >> >> -- Dmitry Samersoff Oracle Java development team, Saint Petersburg, Russia * I would love to change the world, but they won't give me the sources.