gnatpp ceases working after a while - ada

I'm on a mac, and I format my files with "gnatpp -rnb *.ads *adb" and it refuses to format some files. When I create a new file it works, and after a while, when the file grow/age (I couldn't find a pattern), it stops working. It spits the same file as the input, event when I try with -pipe.
What's happening? is there a limit that I would be reaching somewhere? I can't find anything relevant in the help and I have no error relevant error message. The files are all less than 200 lines long.
there is no error message:
maquette:src nraynaud$ gnatpp -w -v -rnb -M150 *.ads
gnatpp 4.9.0
Copyright 2003-2014, AdaCore.
TMPDIR = "/private/var/folders/rb/4gj9qf4j4_765mm9dlfmd0k00000gn/T"
[13] button.ads
[12] driver.ads
[11] last_chance_handler.ads
[10] leds.ads
[9] motor.ads
[8] registers.ads
[7] stm32f4-busses.ads
[6] stm32f4-genericperipheral.ads
[5] stm32f4-gpio.ads
[4] stm32f4-reset_clock_control.ads
[3] stm32f4-sysconfig_control.ads
[2] stm32f4-tim.ads
[1] stm32f4.ads

gnatpp complains that your file does not compile, which is required for gnatpp to work.
From the GNAT User's Guide:
To produce a reformatted file, gnatpp generates and uses the ASIS tree for the input source and thus requires the input to be syntactically and semantically legal. If this condition is not met, gnatpp will terminate with an error message; no output file will be generated.

Related

How to increase the limit on the size of the Julia sysimage?

I'm compiling a Julia system image using the PackageCompiler.jl package. And it always worked out for me. But with a large number of libraries in the image, I get an error:
ERROR: system image too large: sysimg.size is 546855112 but the limit is 20000000
How to increase the image size limit? I didn't find such a setting anywhere.
Full backtrace:
[ Info: Building Julia system image.
[ Info: PackageCompiler: Executing /tmp/precomp_execution_file.jl => /tmp/jl_packagecompiler_4K55be/jl_MTxHHo
[ Info: PackageCompiler: Done
- PackageCompiler: compiling incremental system image
ERROR: system image too large: sysimg.size is 546855112 but the limit is 20000000
ERROR: LoadError:
failed process: Process(
`/usr/local/julia/bin/julia --color=auto --startup-file=no '--cpu-target=generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)' --strip-metadata --sysimage=/usr/local/julia/lib/julia/sys.so --project=/root/.julia/environments/v1.8 --output-o=/tmp/jl_redo10RS1Y.o /tmp/jl_D2nGTKJwrG`, ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error
#
./process.jl:565 [inlined]
[2] run(::Cmd; wait::Bool)
# Base ./process.jl:480
[3] run(::Cmd)
# Base ./process.jl:477
[4] (::PackageCompiler.var"#20#22")()
# PackageCompiler ~/.julia/packages/PackageCompiler/i90pX/ext/TerminalSpinners.jl:157
[5] spin(f::PackageCompiler.var"#20#22", s::PackageCompiler.TerminalSpinners.Spinner{Base.PipeEndpoint})
# PackageCompiler.TerminalSpinners ~/.julia/packages/PackageCompiler/i90pX/ext/TerminalSpinners.jl:164
[6] macro expansion
# ~/.julia/packages/PackageCompiler/i90pX/ext/TerminalSpinners.jl:157 [inlined]
[7] create_sysimg_object_file(object_file::String, packages::Vector{String}, packages_sysimg::Set{Base.PkgId}; project::String, base_sysimage::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, extra_precompiles::String, incremental::Bool)
# PackageCompiler ~/.julia/packages/PackageCompiler/i90pX/src/PackageCompiler.jl:128
The latest releases of Julia no longer have this limitation. Simply upgrade your Julia version and you should be good.

Reading 3 most recent files in directory by month in R

In directory I have same structure files that are updated 2 times in a month. I need to read 3 latest files by month. So for example for October I have to read three latest files - if there is one made in October, then I also need to read September's and August's files. If October file is not there yet - then I need Septembers, August's and July's.
Also, if there are 2 editions in one month, I need to read the latest.
I have listed files in my directory using list.files and it gives me this output:
list.files(path="./input/focus_economics/", full.names = TRUE)
[1] "./input/focus_economics/focuseconomics 2022-05-04.csv"
[2] "./input/focus_economics/focuseconomics 2022-06-15.csv"
[3] "./input/focus_economics/focuseconomics 2022-08-08.csv"
[4] "./input/focus_economics/focuseconomics 2022-09-08.csv"
[5] "./input/focus_economics/focuseconomics 2022-09-16.csv"
So, as it is October now, from these files I would need to read "focuseconomics 2022-09-16.csv" and "focuseconomics 2022-08-08.csv".
Is there any way I could make it simple?

in R, invoke external program in path with spaces with command line parameters

A combination of frustrating problems here.
Essentially I want R to open an external program with command line parameters. I am currently trying to achieve it on a Windows machine, ideally it would work cross-platform.
The program (chimera.exe) is in a directory containing spaces: C:\Program Files\Chimera1.15\bin\
The command line options could be for instance a --nogui flag and a script name, so from the shell I would write (space-specifics aside):
C:\Program Files\Chimera1.15\bin\chimera.exe --nogui scriptfile
This works if I go in windows cmd.exe to the directory itself and just type chimera.exe --nogui scriptfile
Now in R:
I've been playing with shell(), shell.exec(), and system(), but essentially I fail because of the spaces and/or the path separators.
most of the times system() just prints "127" for whatever reason:
> system("C:/Program Files/Chimera1.15/bin/chimera.exe")
[1] 127`
back/forward slashes complicate the matter further but don't make it work:
> system("C:\Program Files\Chimera1.15\bin\chimera.exe")
Error: '\P' is an unrecognized escape in character string starting "C\P"
> system("C:\\Program Files\\Chimera1.15\\bin\\chimera.exe")
[1] 127
> system("C:\\Program\ Files\\Chimera1.15\\bin\\chimera.exe")
[1] 127
> system("C:\\Program\\ Files\\Chimera1.15\\bin\\chimera.exe")
[1] 127
When I install the program in a directory without spaces, it works. How can I escape or pass on the space in system() or related commands or how do I invoke the program otherwise?
Try system2 as it does not use the cmd line processor and use r"{...}" to avoid having to double backslashes. This assumes R 4.0 or later. See ?Quotes for the full definition of the quotes syntax.
chimera <- r"{C:\Program Files\Chimera1.15\bin\chimera.exe}"
system2(chimera, c("--nogui", "myscript"))
For example, this works for me (you might need to change the path):
R <- r"{C:\Program Files\R\R-4.1\bin\x64\Rgui.exe}" # modify as needed
system2(R, c("abc", "def"))
and when Rgui is launched we can verify that the arguments were passed by running this in the new instance of R:
commandArgs()
## [1] "C:\\PROGRA~1\\R\\R-4.1\\bin\\x64\\Rgui.exe"
## [2] "abc"
## [3] "def"
system
Alternately use system but put quotes around the path so that cmd interprets it correctly -- if it were typed into the Windows cmd line the quotes would be needed too.
system(r"{"C:\Program Files\Chimera1.15\bin\chimera.exe" --nogui myscript}")

BiocCheck() for Bioconductor package submission, doesn't show the LINES with Error/Warn./Notes

I am running BiocCheck("myPackage"), the results makes comments on how many places the problem exists, but doesn't comment on where the problem is. Is there any way to fix that?
BiocCheck("myPackage")
$error
character(0)
$warning
[1] "The following files are over 5MB in size: '.git/objects/pack/pack-3eae63a6b24d5861178a09b58eb0ec4d893242b0.pack'"
$note
[1] " Avoid sapply(); use vapply()"
[2] "Recommended function length <= 50 lines."
[3] "Consider shorter lines; 103 lines (3%) are > 80 characters long."
[4] "Consider multiples of 4 spaces for line indents, 1258 lines(32%) are not."
[5] "Cannot determine whether maintainer is subscribed to the bioc-devel\nmailing list (requires admin credentials). Subscribe here:\nhttps://stat.ethz.ch/mailman/listinfo/bioc-devel"
Found the answer :
BiocCheck:::checkFormatting("myPackage", nlines=Inf)
Works perfectly and shows all the lines with problems.

git2r::summary() produces different results when called from console and by RStudio

I am trying to write an R package that analyzes Apache Pig GitHub repository with the help of git2r package. I also use testthat package for unit testing.
I have a function, let's call it compute(), which contains code along the lines of:
repo <- repository("C:\normalized\path\to\apache\pig");
allCommits <- commits(repo);
commitSummary <- capture.output(summary(allCommits[[1]]));
print(commitSummary);
The commitSummary is an important part, because I run several regexes on it to recover data like insertions and deletions.
The problem is, when I call compute() from console, it prints out Output 1.
But when compute() is called from my unit test file when I run devtools::test(), it prints out Output 2. (And over the course of me writing this question, after producing Output 2 several times, it produced Output 3.)
When I run the first codeblock in this question from the console, it prints out Output 1, again.
However, when I copy-paste that codeblock into the test file, it prints out Output 3.
I am confused. How is that even possible?
And how can I make sure git2r::summary() uses the format I want?
Output 1
[1] "Commit: d2de56aad939c7c77324066a6f29cc211e29a077"
[2] "Author: Koji Noguchi <knoguchi#apache.org>"
[3] "When: 2016-12-12 23:07:37"
[4] ""
[5] " PIG-5073: Skip e2e Limit_5 test for Tez (knoguchi)"
[6] " "
[7] " "
[8] " git-svn-id: https://svn.apache.org/repos/asf/pig/trunk#1773899 13f79535-47bb-0310-9956-ffa450edef68"
[9] " "
[10] "2 files changed, 18 insertions, 1 deletions"
[11] "CHANGES.txt | -0 + 2 in 1 hunk"
[12] "test/e2e/pig/tests/nightly.conf | -1 +16 in 2 hunks"
[13] ""
Output 2
[d2de56a] 2016-12-12: PIG-5073: Skip e2e Limit_5 test for Tez (knoguchi)
Output 3
[1] " Length Class Mode " " 1 git_commit S4 "
Additional notes that might take away from question's clarity
When I load and call the function calling compute() from the unit test file, it prints out Output 1. Same for calling compute() from working directory set to test folder and exactly same arguments.
To make matters more confusing, up until very recently devtools::test() produced Output 1, then it switched to Output 3 before settling on Output 2.
CRAN's documentation for git2r::summary(object, ...) lists following arguments:
object The commit object.
... Additional arguments affecting the summary produced.
Accepted values of ... are nowhere to be found.
Turns out, there is probably some sort of a namespace-related race condition going on, since there is already a summary() function in base R (and probably some other packages), which explains why there were 3 different outputs.
I just changed every
summary(commitObject)
into
git2r::summary(commitObject)
and everything seems to work again.

Resources