これは働きます:
TMPDIR="/tmp/___"
export TMPDIR
mkdir -p "$TMPDIR"
script="$TMPDIR"/myscript
cat <<'EOF' > "$script"
#!/usr/bin/Rscript --vanilla --slave
EOF
chmod 755 "$script"
ls -l "$script"
"$script"
ls -l "$script"
これにより、「重要な内容がある場合はこのプログラムを実行しないでください」が削除され、アーカイブされます$script
。/tmp
/tmp
TMPDIR="/tmp/ "
export TMPDIR
mkdir -p "$TMPDIR"
script="$TMPDIR"/myscript
cat <<'EOF' > "$script"
#!/usr/bin/Rscript --vanilla --slave
EOF
chmod 755 "$script"
ls -l "$script"
"$script"
ls -l "$script"
これらの間の唯一の違いは$TMPDIR
スペースを含むことです。
これらの行動の違いの理由は何ですか?
$ Rscript --version
R scripting front-end version 4.1.2 (2021-11-01)
$ cat /etc/issue.net
Ubuntu 22.04.1 LTS
ますますバグのように見えます。ソースからRをコンパイルしてTMPDIR = ""に設定する場合:
:
make[3]: Entering directory '/tmp/R-devel/src/library/profile'
building system startup profile
make[3]: Leaving directory '/tmp/R-devel/src/library/profile'
make[3]: Entering directory '/tmp/R-devel/src/library/translations'
building package 'translations'
make[4]: Entering directory '/tmp/R-devel/src/library/translations'
make[4]: Leaving directory '/tmp/R-devel/src/library/translations'
make[3]: Leaving directory '/tmp/R-devel/src/library/translations'
make[3]: Entering directory '/tmp/R-devel/src/library/base'
building package 'base'
make[4]: Entering directory '/tmp/R-devel/src/library/base'
/bin/bash: line 9: /R3273656: No such file or directory
/bin/bash: line 12: /R23273656: No such file or directory
cmp: /R23273656: No such file or directory
mv: cannot stat ' /R23273656': No such file or directory
make[4]: *** [../../../share/make/basepkg.mk:65: mkRbase] Error 1
make[4]: Leaving directory '/tmp/R-devel/src/library/base'
make[3]: *** [Makefile:31: all] Error 2
make[3]: Leaving directory '/tmp/R-devel/src/library/base'
make[2]: *** [Makefile:37: R] Error 1
make[2]: Leaving directory '/tmp/R-devel/src/library'
make[1]: *** [Makefile:28: R] Error 1
make[1]: Leaving directory '/tmp/R-devel/src'
make: *** [Makefile:62: R] Error 1
また、sysutils.c:1893 の TMPDIR を DUMMY に変更すると問題が解決します。