Bug 435493 - Cannot create 'R_TempDir' under valgrind-3.17.0.GIT-lbmacos
Summary: Cannot create 'R_TempDir' under valgrind-3.17.0.GIT-lbmacos
Status: RESOLVED DOWNSTREAM
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: unspecified
Platform: Homebrew (macOS) macOS
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-08 05:04 UTC by Wan Zhang
Modified: 2023-02-05 20:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Detailed check results (4.82 KB, application/octet-stream)
2021-04-08 05:04 UTC, Wan Zhang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wan Zhang 2021-04-08 05:04:20 UTC
Created attachment 137422 [details]
Detailed check results

SUMMARY

I am trying to check my R package with valgrind and get a Fatal error: cannot create 'R_TempDir'. I have checked that the /tmp is not full and I have changed TMP to a folder where Everyone has full control in .Renviron. I tried several packages available on CRAN without errors but the problem always exists.



* using log directory ‘XXX’
* using R version 4.0.2 (2020-06-22)
* using platform: x86_64-apple-darwin17.0 (64-bit)
* using session charset: UTF-8
* using options ‘--use-valgrind --as-cran’
* checking for file ‘BET/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘BET’ version ‘0.3.4’
* package encoding: UTF-8
* checking CRAN incoming feasibility ... WARNING
Maintainer: ‘Wan Zhang <wanz63@live.unc.edu>’

Insufficient package version (submitted: 0.3.4, existing: 0.3.5)

Days since last update: 5
Number of updates in past 6 months: 8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘BET’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking for future file timestamps ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking use of S3 registration ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd line widths ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... OK
* checking for GNU extensions in Makefiles ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking use of PKG_*FLAGS in Makefiles ... OK
* checking use of SHLIB_OPENMP_*FLAGS in Makefiles ... OK
* checking pragmas in C/C++ headers and code ... OK
* checking compilation flags used ... OK
* checking compiled code ... OK
* checking examples ... ERROR
Running examples in ‘BET-Ex.R’ failed
The error occurred in:

==69341== Memcheck, a memory error detector
==69341== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==69341== Using Valgrind-3.17.0.GIT-lbmacos and LibVEX; rerun with -h for copyright info
==69341== Command: /Library/Frameworks/R.framework/Resources/bin/exec/R --vanilla --encoding=UTF-8
==69341== 
==69341== Warning: set address range perms: large range [0x7fff200d3000, 0x80001fed3000) (defined)
==69341== Warning: set address range perms: large range [0x7fff200d3000, 0x7fff7fd8b000) (defined)
==69341== Warning: set address range perms: large range [0x7fff8e03f000, 0x7fffc00d3000) (noaccess)
==69341== Warning: set address range perms: large range [0x7fffc00d3000, 0x7fffe2363000) (defined)
==69341== Warning: set address range perms: large range [0x7fffe2363000, 0x7fffffe00000) (noaccess)
--69341-- WARNING: unhandled amd64-darwin syscall: unix:475
--69341-- You may be able to write your own handler.
--69341-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--69341-- Nevertheless we consider this a bug.  Please report
--69341-- it at http://valgrind.org/support/bug_reports.html.
Fatal error: cannot create 'R_TempDir'
==69341== 
==69341== HEAP SUMMARY:
==69341==     in use at exit: 0 bytes in 0 blocks
==69341==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==69341== 
==69341== All heap blocks were freed -- no leaks are possible
==69341== 
==69341== For lists of detected and suppressed errors, rerun with: -s
==69341== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
* checking PDF version of manual ... OK
* checking for non-standard things in the check directory ... OK
* checking for detritus in the temp directory ... OK
* DONE
Status: 1 ERROR, 1 WARNING



STEPS TO REPRODUCE
1. R CMD check --as-cran --use-valgrind BET_0.3.4.tar.gz
2. 
3. 

OBSERVED RESULT
--69341-- WARNING: unhandled amd64-darwin syscall: unix:475
--69341-- You may be able to write your own handler.
--69341-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--69341-- Nevertheless we consider this a bug.  Please report
--69341-- it at http://valgrind.org/support/bug_reports.html.
Fatal error: cannot create 'R_TempDir'


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: Big Sur Version 11.2.3
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Philippe Waroquiers 2021-04-11 13:26:09 UTC
Syscall 475 on darwin is the mkdirat syscall. I guess that when this syscall fails, R then reports the fatal error that it cannot create R_Tempdir.


I do not have access to a macos system so cannot fix this but
you might maybe try : it might be an easy change in the valgrind file m_syswrap/priv_syswrap-darwin.h, to make something similar to e.g. the line readlinkat a few lines above, and then do a PRE(sys_mkdirat) in syswrap-darwin.c
somewhat similar to the PRE(sys_mkdirat) in syswrap-linux.c
(I guess only the syscall convention will have to be updated)
Comment 2 Paul Floyd 2021-04-11 17:53:22 UTC
Which version of OS X is this with?

I can probably add something like mkdirat.
Comment 3 Paul Floyd 2021-04-11 19:18:49 UTC
(In reply to Paul Floyd from comment #2)
> Which version of OS X is this with?
> 
> I can probably add something like mkdirat.

Ah I see, Big Sur. So this isn't built from the 'official' Valgrind source. You need to contact the maintainer of the homebrew fork. As Tom said, adding support for the missing syscall shouldn't be too hard.
Comment 4 Paul Floyd 2022-05-20 10:53:23 UTC
I recently setup a 10.13 VM so I might be able to look at this.

And it looks like I previously befuddled Darwin and macOS versions. R is saying x86_64-apple-darwin17.0 (64-bit) which would be macOS. That's macOS 10.13 High Sierra.

It doesn't seem to have been implemented here

https://github.com/LouisBrunner/valgrind-macos/blob/master/coregrind/m_syswrap/syswrap-darwin.c
Comment 5 Paul Floyd 2023-02-05 20:24:31 UTC
Louis Brunner fixed this a while ago

Author: Louis Brunner <louis.brunner.fr@gmail.com>  2020-03-06 01:39:27
Committer: Louis Brunner <louis.brunner.fr@gmail.com>  2020-04-26 00:44:50
Parent: 8b137f976cbb1fedde7cc8a361e8efbb4e895d7c (macOS: handle mach_msg trailer (MACH_SEND_TRAILER))
Child:  c6a93256aef608561908a9bf24d4fc8222c8470e (Temporarily disable extra MACH_SEND_TRAILER checks)
Branches: main, remotes/origin/feature/fix_drd_thread, remotes/origin/feature/ios, remotes/origin/feature/macos_11pp2, remotes/origin/feature/new_mach_msg_bootstrap, remotes/origin/feature/thread_signals, remotes/origin/feature/trailer2, remotes/origin/feature/vg_symbols, remotes/origin/feature/wqops, remotes/origin/feature/wqthread, remotes/origin/feature/wqthread_fix, remotes/origin/main, remotes/origin/master
Follows: VALGRIND_3_15_0
Precedes: v/3.16.0-rc0001

    macOS 10.15: add mkdirat (syscall:475)