clear permissions cache when scanning a file

for #4899 

cc @DeepDiver1975 @karlitschek