Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid version specification ‘0.3_5’ #71

Closed
brianmsm opened this issue Jun 19, 2023 · 4 comments
Closed

invalid version specification ‘0.3_5’ #71

brianmsm opened this issue Jun 19, 2023 · 4 comments

Comments

@brianmsm
Copy link

I am getting this error when I use install.packages once bspm::enable() is active:

install.packages("DT")
#> Available system packages...
#> 
#> Error in install.packages : invalid version specification ‘0.3_5’

Apparently in the bioarchlinux repository there is a package called speedglm with a version 0.3_5 that is generating a conflict when internally running available_sys(). In this function, when obtaining the list of packages and versions, these numbers are validated with the package_version() function which generates an error as specified.

https://github.com/Enchufa2/bspm/blob/e637d5dc0fd66c1cfcb821e18bfa2d05de46a016/R/manager.R#LL96C21-L96C21

package_version("0.3_5")
#> Error: invalid version specification '0.3_5'

Created on 2023-06-18 with reprex v2.0.2

Session info
sessionInfo()
#> R version 4.3.1 (2023-06-16)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Garuda Linux
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/libblas.so.3.11.0 
#> LAPACK: /usr/lib/liblapack.so.3.11.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: America/Lima
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] styler_1.10.1     digest_0.6.31     fastmap_1.1.1     xfun_0.37        
#>  [5] magrittr_2.0.3    glue_1.6.2        R.utils_2.12.2    knitr_1.42       
#>  [9] htmltools_0.5.4   rmarkdown_2.20    lifecycle_1.0.3   cli_3.6.0        
#> [13] R.methodsS3_1.8.2 vctrs_0.5.2       reprex_2.0.2      withr_2.5.0      
#> [17] compiler_4.3.1    R.oo_1.25.0       R.cache_0.16.0    purrr_1.0.1      
#> [21] rstudioapi_0.14   tools_4.3.1       evaluate_0.20     yaml_2.3.7       
#> [25] rlang_1.0.6       fs_1.6.1

I am not sure if a solution would be to replace the "_" with "." prior to validation.

@Enchufa2
Copy link
Member

Thanks for the report. Unfortunately, using an underscore in the version component goes against the Arch package guidelines ("Letters, numbers, and periods only"). Therefore, this issue should be reported upstream so that bioarchlinux maintainers can fix the affected packages.

@brianmsm
Copy link
Author

I understand. It makes sense the problem associated with versioning with that specific package, and I understand that ideally this should be fixed from the bioarchlinux repository (I already made the issue). However, I am left with the concern that this is out of the end user's control and makes it impossible to install packages unless bspm is disabled. I'm not sure if running error by versioning a single package is the best option.

I would suggest evaluating using package_version with the strict argument set to FALSE. This way, an improper versioning of a specific package will return NA only for that package and not stop the installation of the rest of the packages.

package_version("0.3_5", strict = FALSE)
#> [1] <NA>

Created on 2023-06-19 with reprex v2.0.2

Here is a more extensive example:

pkgs <- do.call(rbind, strsplit(bspm:::backend_call("available"), ";"))
colnames(pkgs) <- c("Package", "Version", "Repository")
package_version(pkgs[, "Version"]) 
#> Error: invalid version specification '0.3_5'
package_version(pkgs[, "Version"], strict = FALSE) |> head(n = 20)
#>  [1] '1.4.5'    '2.7'      '1.76.0'   '1.60.0'   '0.3.9'    '1.4.10'  
#>  [7] '1.1'      '0.2.1'    '1.4.1'    '1.6.4'    '0.1.3'    '1.10.0'  
#> [13] '1.81.0.1' '4.6.1'    '0.1.6'    '0.1.1'    '0.2.2'    '2.4.4'   
#> [19] '2.58.0'   '2.6.1'

Created on 2023-06-19 with reprex v2.0.2

Session info
sessionInfo()
#> R version 4.3.1 (2023-06-16)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Garuda Linux
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/libblas.so.3.11.0 
#> LAPACK: /usr/lib/liblapack.so.3.11.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: America/Lima
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] styler_1.10.1     digest_0.6.31     fastmap_1.1.1     xfun_0.37        
#>  [5] magrittr_2.0.3    bspm_0.5.2        glue_1.6.2        R.utils_2.12.2   
#>  [9] knitr_1.42        htmltools_0.5.4   rmarkdown_2.20    lifecycle_1.0.3  
#> [13] cli_3.6.0         R.methodsS3_1.8.2 vctrs_0.5.2       reprex_2.0.2     
#> [17] withr_2.5.0       compiler_4.3.1    R.oo_1.25.0       R.cache_0.16.0   
#> [21] purrr_1.0.1       rstudioapi_0.14   tools_4.3.1       evaluate_0.20    
#> [25] yaml_2.3.7        rlang_1.0.6       fs_1.6.1

@sukanka
Copy link

sukanka commented Jun 19, 2023

Thanks for the report. Unfortunately, using an underscore in the version component goes against the Arch package guidelines ("Letters, numbers, and periods only"). Therefore, this issue should be reported upstream so that bioarchlinux maintainers can fix the affected packages.

Using an underscore is actually recommended in Arch package guidelines.
It can contain letters, numbers, periods and underscores, but not a hyphen (-). If the author of the software uses one, replace it with an underscore (_).

The upstream pkgver 0.3-5 should be converted to 0.3_5 instead of 0.3.5

@Enchufa2
Copy link
Member

Enchufa2 commented Jun 19, 2023

@sukanka That's weird, because then there's a mismatch between the two documents. Anyway, allowing underscores seems odd to me, because this is not allowed in any other major distribution, and it's not part of the semantic versioning specification.

I've added a workaround just for Arch in the commit above. But this won't scale if Arch keeps adding random characters to the version specification. ;-)

@brianmsm Meanwhile, you can install the development version of bspm, or set options(bspm.version.check=FALSE) to avoid this version check altogether.

On the other hand, setting strict=FALSE is not an option, because this is how we detected this issue in the first place. Otherwise, the silent NA would have broken something else in subsequent functions that expect no missing values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants