PecanProject / pecan

The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.
www.pecanproject.org
Other
202 stars 230 forks source link

Failing windows build of `PEcAn.ED2`: bug in `fqdn()`? #3044

Closed Aariq closed 1 year ago

Aariq commented 1 year ago

Bug Description

The windows build of PEcAn.ED2 on r-universe is currently failing because of a failing test in test.met2model.R. The only thing that makes sense to me that would cause this is if fqdn() returns NULL or a length 0 vector on Windows. I don't have a Windows machine to do local testing on. Tests for fqdn() would help debug this.

infotroph commented 1 year ago

Does Windows have a hostname command? If not the null result might happen when fqdn tries to call it here.

Aariq commented 1 year ago

That might be the case. I see the following in the Windows build logs:

sethostname: Use the Network Control Panel Applet to set hostname.
hostname -s is not supported.
Warning in system2("hostname", "-f", stdout = TRUE) :
  running command '"hostname" -f' had status 1
Error in if (is.localhost(host)) { : 
  missing value where TRUE/FALSE needed
Calls: test_remote -> remote.execute.cmd
robkooper commented 1 year ago

Would this work? https://rdrr.io/cran/R.utils/man/getHostname.System.html

dlebauer commented 1 year ago

I can't get the getHostname() function to work, but the following works (returns the same as the current fqdn) on Windows 10, WSL, Ubuntu 20.4 and the PEcAn docker container with Ubuntu 20.4:

as.character(Sys.info()["nodename"])
robkooper commented 1 year ago

That is close to what is done in getHostname, see https://github.com/HenrikBengtsson/R.utils/blob/develop/R/System.R#L51