I have read this and this, and found that my problem is different and more specific.
I understand the following points.
- +x on the directory grants access to files inodes through this specific directory
- meta information of a file, which is used by
ls -l, is stored in its i-node, but file name does not belong to that
From the 2 points above, since ls without -l does not need to access the i-nodes of the files in the directory, it should successfully list the file names and return 0.
However, when I tried it on my machine, the file names are listed, but there were some warnings like permission denied, and the return code is 1.
b03705028@linux7 [~/test] chmod 500 permission/
b03705028@linux7 [~/test] ls --color=no permission/
f1*
b03705028@linux7 [~/test] chmod 400 permission/
b03705028@linux7 [~/test] ls --color=no permission/
ls: 無法存取 'permission/f1': 拒絕不符權限的操作
f1
b03705028@linux7 [~/test] echo $0
bash
The Chinese characters basically talk about permission denied
My unix distribution is Linux 4.17.11-arch1