rstudio / pins-r

Pin, discover, and share resources
https://pins.rstudio.com
Other
312 stars 63 forks source link

[Macports] Error in running tests: `Failure ('test-board_folder.R:1:1'): cached data is read-only: fs::file_access(path, "write") is not FALSE` #825

Open barracuda156 opened 5 months ago

barracuda156 commented 5 months ago

This is pretty likely it is our bug in Macports and not pins bug. Please feel free to close the issue in such a case, but an advice is still appreciated.

R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: powerpc-apple-darwin10.0.0d2 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> library(pins)
> 
> test_check("pins")
Guessing `type = 'rds'`
[ FAIL 1 | WARN 0 | SKIP 58 | PASS 163 ]

══ Skipped tests (58) ══════════════════════════════════════════════════════════
• On CRAN (43): 'test-board_connect_bundle.R:37:3',
  'test-board_connect_bundle.R:42:3', 'test-board_connect_server.R:22:3',
  'test-board_connect_server.R:31:3', 'test-board_connect_server.R:51:3',
  'test-board_connect_server.R:60:3', 'test-board_folder.R:1:1',
  'test-board_folder.R:9:3', 'test-board_folder.R:34:3',
  'test-board_folder.R:42:3', 'test-board_folder.R:88:3',
  'test-board_url.R:2:1', 'test-legacy_board.R:2:3',
  'test-legacy_datatxt.R:4:3', 'test-legacy_datatxt.R:16:3',
  'test-legacy_datatxt.R:25:3', 'test-legacy_datatxt.R:35:3',
  'test-legacy_local.R:43:3', 'test-legacy_packages.R:23:3',
  'test-legacy_registry.R:30:3', 'test-meta.R:13:3', 'test-meta.R:20:3',
  'test-meta.R:24:3', 'test-pin-delete.R:11:3', 'test-pin-meta.R:2:3',
  'test-pin-read-write.R:35:3', 'test-pin-read-write.R:41:3',
  'test-pin-read-write.R:62:3', 'test-pin-read-write.R:84:3',
  'test-pin-read-write.R:92:3', 'test-pin-upload-download.R:17:3',
  'test-pin-upload-download.R:46:3', 'test-pin-upload-download.R:61:3',
  'test-pin.R:3:1', 'test-pin_info.R:5:3', 'test-pin_info.R:23:3',
  'test-pin_info.R:33:3', 'test-pin_search.R:27:3', 'test-pin_versions.R:8:3',
  'test-pin_versions.R:18:3', 'test-pin_versions.R:32:3',
  'test-pin_versions.R:58:3', 'test-pin_versions.R:82:3'
• board_azure() tests require PINS_AZURE_KEY (3):
  'test-board_azure_adls2.R:1:1', 'test-board_azure_blob.R:1:1',
  'test-board_azure_file.R:1:1'
• board_connect() tests requires `creds.rds` (4): 'test-board_connect.R:2:1',
  'test-board_connect_url.R:4:3', 'test-board_connect_url.R:22:3',
  'test-board_connect_url.R:33:3'
• board_gcs() tests require PINS_GCS_PASSWORD (1): 'test-board_gcs.R:1:1'
• board_gdrive() tests require PINS_GDRIVE_USE_PERSONAL (1):
  'test-board_gdrive.R:1:1'
• board_ms365() tests require PINS_MS365_TEST_DRIVE (1):
  'test-board_ms365.R:1:1'
• board_s3() tests require PINS_AWS_ACCESS_KEY, PINS_AWS_SECRET_ACCESS_KEY (1):
  'test-board_s3.R:1:1'
• legacy_azure() tests require TEST_AZURE_CONTAINER, TEST_AZURE_ACCOUNT,
  TEST_AZURE_KEY (1): 'test-legacy_azure.R:16:1'
• legacy_gcloud() tests require TEST_GOOGLE_BUCKET (1):
  'test-legacy_gcloud.R:12:1'
• legacy_github() tests require TEST_GITHUB_REPO, TEST_GITHUB_BRANCH (1):
  'test-legacy_github.R:1:1'
• legacy_s3() tests require TEST_AWS_BUCKET, TEST_AWS_KEY, TEST_AWS_SECRET,
  TEST_AWS_REGION (1): 'test-legacy_s3.R:14:1'

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-board_folder.R:1:1'): cached data is read-only ───────────────
fs::file_access(path, "write") is not FALSE

`actual`:   TRUE 
`expected`: FALSE

[ FAIL 1 | WARN 0 | SKIP 58 | PASS 163 ]
Error: Test failures
Execution halted
juliasilge commented 5 months ago

I am not familiar with Macports, so it might be helpful to give me a bit of info on how this code may be running in your situation. The test that is failing is equivalent to this:

library(pins)
b <- board_temp()
b |> pin_write(1:10, "nice-numbers")
#> Guessing `type = 'rds'`
#> Creating new version '20240417T175854Z-709c5'
#> Writing to pin 'nice-numbers'
path <- pin_download(b, "nice-numbers")

## can I write to this path?
fs::file_access(path, "write")
#> /var/folders/hv/hzsmmyk9393_m7q3nscx1slc0000gn/T/RtmpuGG5Mi/pins-abf8acf40f6/nice-numbers/20240417T175854Z-709c5/nice-numbers.rds 
#>                                                                                                                             FALSE
fs::file_info(path)$permissions
#> [1] r--r--r--

Created on 2024-04-17 with reprex v2.1.0

Here, notice that I do not have permission to write to that path. This is because when the pin is written, we set the permissions:

https://github.com/rstudio/pins-r/blob/b8827ac2d61cda526d01a9a4db57af4d4108bceb/R/board_folder.R#L82

Seems like something unusual may be going on with how your setup deals with the filesystem?