I got confused about dir('/proc') results. In Ubuntu20.04/R4.1, got character(0), but in Ubuntu20.04/R3.6.3, to correct file list. Both the two VM use the same user name with equal groups permission in Ubuntu, and use sudo apt install r-base to install R. Why got such difference of permission when use dir('/proc') (and this may be the cause of ps::ps_handle() got Error ).
I have tried to use sudo R in Ubuntu20.04/R4.1, but still get character(0) when dir('/proc') and the same permission denied when using system('dir').
Is there any configuration I miss or set-up I can try about this weird permission difference when using R? Thanks.
> dir('/proc')
character(0)
############ if I use R when cd /proc, system('dir') got permission denied but in R3.6.3 this is allowed
> system("dir")
dir: cannot open directory '.': Permission denied
#####################
> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=zh_TW.UTF-8 LC_NUMERIC=C
[3] LC_TIME=zh_TW.UTF-8 LC_COLLATE=zh_TW.UTF-8
[5] LC_MONETARY=zh_TW.UTF-8 LC_MESSAGES=zh_TW.UTF-8
[7] LC_PAPER=zh_TW.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=zh_TW.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.2
####################### but actually there are proc files under /proc
$ ls /proc
1 1277 171 203 251 34 4037 534 648 82560 89 kpagecgroup
10 1279 172 204 252 340 41 539 649 82561 893 kpagecount
.......
In R 3.6.3, dir('/proc') got correct list. (these two VM use the same user name with equal groups permission in Ubuntu)
> dir('/proc')
> dir('/proc')
[1] "1" "10" "100"
[4] "1015" "1018" "102"
[7] "1021" "1023" "1024"
[10] "103" "104" "1047"
[13] "105" "1056" "106"
[16] "1063" "1068" "1070" ...
######### and also system('dir') can be run
> system('dir')
1 119 1772487 212 271 2911954 2912461 3214465 3445538 3531 41 61 94 .......
#####################
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=zh_TW.UTF-8 LC_NUMERIC=C
[3] LC_TIME=zh_TW.UTF-8 LC_COLLATE=zh_TW.UTF-8
[5] LC_MONETARY=zh_TW.UTF-8 LC_MESSAGES=zh_TW.UTF-8
[7] LC_PAPER=zh_TW.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=zh_TW.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.3