← all packages

askpass

native: 2 functions analysed · 2 typed · 0 untypeable · 0 timed out · 0 entry points (0 typed) · R: 17 definitions, 3 typed strict, 14 gradual, prelude debt 4 · fuzzing: 3 definitions, 0 unsound, 1 accept calls outside their domain · tyr dc7f1a7 · Rsem 5c142d7 · NativeSem 770a1eb · rstt 2b2696f unpinned

Native functions

C functions (no entry point, so all of them)
2 / 2 (100.0%)
typed
2 / 2 (100.0%)

Native → R

No .Call/.C/.Fortran/.External site in the R code, so no entry point.

R definitions

named top-level definitions
17 / 17 (100.0%)
not blocked by an unbound native symbol
17 / 17 (100.0%)
typed, gradual
14 / 17 (82.4%)
typed, strict
3 / 17 (17.6%)
4 of the strict failures are a name missing from the prelude.
side
mode
19 / 19

Native functions 2

pw_entry_dialog typed

[CHR] -> ^CHR1 | null
timing: 0.088 s
source
SEXP pw_entry_dialog(SEXP prompt){
#ifndef _WIN32
  const char *text = CHAR(STRING_ELT(prompt, 0));
  const char *pass = getpass(text);
  if(pass != NULL)
    return Rf_mkString(pass);
#endif
  return R_NilValue;
}
/__w/r-typing/r-typing/work/sources/askpass/src/askpass.c:8

R_init_askpass typed

[*any] -> ()
timing: 0.008 s
source
void R_init_askpass(DllInfo *dll){
  R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
  R_useDynamicSymbols(dll, FALSE);
  R_forceSymbols(dll, TRUE);
}
/__w/r-typing/r-typing/work/sources/askpass/src/askpass.c:23

R definitions 17

R/interactive.R

is_interactive untypeable

untypeable application of base::tolower (line 8)
error detail
argument: @("false"<> | null)
failing call: base::tolower(NULL)
timing: 0.034 s
source
is_interactive <- function() {
  opt <- getOption("rlib_interactive")
  if (isTRUE(opt)) {
    TRUE
  } else if (identical(opt, FALSE)) {
    FALSE
  } else if (tolower(getOption("knitr.in.progress", "false")) == "true") {
    FALSE
  } else if (identical(Sys.getenv("TESTTHAT"), "true")) {
    FALSE
  } else {
    interactive()
  }
}
R/interactive.R:2
R/askpass.R

is_macos untypeabletyped

unbound variable (line 89)
unbound: Sys.info — a name the prelude does not declare
error detail
name: Sys.info
gradual mode: typed
(() -> LGL1<>)<>
timing: 0.004 s
source
is_macos <- function(){
  identical(tolower(Sys.info()[['sysname']]), "darwin")
}
R/askpass.R:88

is_windows typed fuzz ok

(() -> ff<> | tt<>)<>
timing: 0.016 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
is_windows <- function(){
  .Platform$OS.type == 'windows'
}
R/askpass.R:80

askpass_path untypeable

untypeable application of base::$ (line 41)
error detail
argument: @({ integer.max: INT1, double.eps: DBL1, double.xmax: DBL1, any }<>, "sizeof.pointer"<>)
failing call: base::$(list(integer.max = NA_integer_,
double.eps = NA_real_,
double.xmax = NA_real_),
"sizeof.pointer")
timing: 0.065 s
source
askpass_path <- function(simple = TRUE){
  if(is_windows()){
    arch <- ifelse(identical(.Machine$sizeof.pointer, 4L), "32", "")
    system.file(sprintf('win-askpass%s.exe', arch),
                               package = 'askpass', mustWork = TRUE)
  } else if(is_macos()){
    prog <- ifelse(isTRUE(simple), 'mac-simplepass', 'mac-askpass')
    system.file(prog, package = 'askpass', mustWork = TRUE)
  }
}
R/askpass.R:39

out_without_eol untypeabletyped

unbound variable (line 93)
unbound: rawToChar — a name the prelude does not declare
error detail
name: rawToChar
gradual mode: typed
((x: any) -> any)<>
timing: 0.004 s
source
out_without_eol <- function(x){
  sub("\r?\n$", "", rawToChar(x))
}
R/askpass.R:92

askpass_mac untypeabletyped

unbound variable (line 61)
unbound: askpass_path — one of the package’s own names, itself untyped
error detail
name: askpass_path
gradual mode: typed
((prompt: any) -> any)<>
timing: 0.004 s
source
askpass_mac <- function(prompt){
  tryCatch({
    res <- sys::exec_internal(askpass_path(), prompt, timeout = 120)
    out_without_eol(res$stdout)
  }, error = function(e){
    message(e$message)
  })
}
R/askpass.R:59

askpass_windows untypeabletyped

unbound variable (line 52)
unbound: askpass_path — one of the package’s own names, itself untyped
error detail
name: askpass_path
gradual mode: typed
((prompt: vec | null, user: (vec | null)?) -> any)<>
timing: 0.016 s
source
askpass_windows <- function(prompt, user = names(prompt)){
  tryCatch({
    res <- sys::exec_internal(askpass_path(), c(prompt, user), timeout = 120)
    out_without_eol(res$stdout)
  }, error = function(e){
    message(e$message)
  })
}
R/askpass.R:50

is_unix typed fuzz ok

(() -> ff<> | tt<>)<>
timing: 0.012 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
is_unix <- function(){
  .Platform$OS.type == "unix"
}
R/askpass.R:84

readline_silent untypeabletyped

unbound variable (line 69)
unbound: stdin — a name the prelude does not declare
error detail
name: stdin
gradual mode: typed
((prompt: any, icon: any?) -> any)<>
timing: 0.018 s
source
readline_silent <- function(prompt, icon = "\U0001f511 "){
  if(is_unix() && isatty(stdin())){
    if(system('stty -echo') == 0){
      on.exit(system('stty echo'))
    }
  }
  cat(prompt, "\n")
  out <- base::readline(icon)
  cat(" OK\n")
  out
}
R/askpass.R:68

ask_password_default untypeabletyped

unbound variable (line 28)
unbound: is_interactive — one of the package’s own names, itself untyped
error detail
name: is_interactive
gradual mode: typed
((prompt: vec | null) -> any)<>
timing: 0.065 s
source
ask_password_default <- function(prompt){
  if(!is_interactive())
    return(NULL)
  if(is_windows()){
    askpass_windows(prompt)
  } else if(is_macos() && !isatty(stdin())){
    askpass_mac(prompt)
  } else {
    readline_silent(prompt)
  }
}
R/askpass.R:27

askpass untypeabletyped

unbound variable (line 23)
unbound: ask_password_default — one of the package’s own names, itself untyped
error detail
name: ask_password_default
gradual mode: typed
((prompt: any?) -> any)<>
timing: 0.003 s
source
askpass <- function(prompt = "Please enter your password: "){
  FUN <- getOption("askpass", ask_password_default)
  FUN(prompt)
}
R/askpass.R:22
R/ssh.R

ssh_askpass untypeabletyped

unbound variable (line 13)
unbound: askpass_path — one of the package’s own names, itself untyped
error detail
name: askpass_path
gradual mode: typed
(() -> any)<>
timing: 0.001 s
source
ssh_askpass <- function(){
  askpass_path(simple = FALSE)
}
R/ssh.R:12
R/onload.R

cmd_exists untypeabletyped

unbound variable (line 42)
unbound: Sys.which — a name the prelude does not declare
error detail
name: Sys.which
gradual mode: typed
((cmd: any) -> any)<>
timing: 0.005 s
source
cmd_exists <- function(cmd){
  nchar(Sys.which(cmd)) > 0
}
R/onload.R:41

fix_rstudio_path untypeable

unbound variable (line 27)
unbound: cmd_exists — one of the package’s own names, itself untyped
error detail
name: cmd_exists
timing: 0.087 s
source
fix_rstudio_path <- function(){
  rs_path <- Sys.getenv('RS_RPOSTBACK_PATH')
  git_askpass <- Sys.getenv('GIT_ASKPASS')
  if(nchar(rs_path) && !cmd_exists(git_askpass)){
    PATH <- Sys.getenv("PATH")
    if(!grepl(normalizePath(rs_path, mustWork = FALSE), PATH, fixed = TRUE)){
      rs_path <- unique(c(rs_path, sub("rpostback", 'postback', rs_path)))
      Sys.setenv(PATH = paste(c(PATH, normalizePath(rs_path, mustWork = FALSE)),
                              collapse = .Platform$path.sep))
    }
  }
}
R/onload.R:24

var_exists typed accepts outside

(((var: vec) -> LGL<>)&((var: vec1) -> LGL1<>))<>
timing: 0.057 s
fuzzing: 7 inside (7 ok) · 8 outside (5 rejected, 3 accepted)

Accepted outside the domain var: 3

parameterchangecallreturned
varkind:listvar_exists("var" = list())(LGL & ~vec1)<> with { }
varkind:nullvar_exists(NULL)(LGL & ~vec1)<> with { names: (CHR & ~vec1)<> with { } }
varwrapvar_exists(list(c(2147483647L, 1L, 1L, 1L, -1L)))ff<> with { }
source
var_exists <- function(var){
  nchar(Sys.getenv(var)) > 0
}
R/onload.R:37

setup_askpass_vars untypeabletyped

unbound variable (line 7)
unbound: fix_rstudio_path — one of the package’s own names, itself untyped
error detail
name: fix_rstudio_path
gradual mode: typed
(() -> any)<>
timing: 0.074 s
source
setup_askpass_vars <- function(){
  if(var_exists('RSTUDIO')){
    fix_rstudio_path()
  } else {
    # This is mostly for RGui and R.app (tty could mean MacOS server)
    if(is_windows() || (is_macos() && !isatty(stdin()))){
      askpass_bin = ssh_askpass()
      if(!var_exists('GIT_ASKPASS')){
        Sys.setenv("GIT_ASKPASS" = askpass_bin)
      }
      if(!var_exists('SSH_ASKPASS')){
        Sys.setenv("SSH_ASKPASS" = askpass_bin)
      }
    }
  }
}
R/onload.R:5

.onLoad untypeabletyped

unbound variable (line 2)
unbound: setup_askpass_vars — one of the package’s own names, itself untyped
error detail
name: setup_askpass_vars
gradual mode: typed
((libname: any, pkgname: any) -> any)<>
timing: 0.003 s
source
.onLoad <- function(libname, pkgname){
  setup_askpass_vars()
}
R/onload.R:1