Compiling BATSH

I’ve made some changes to Batsh (fork is here) so it currently builds on my system (4.08.1) (via dune build @all), along with pinning of the updated Dlist (fork is here).

Added a rough opam file to Dlist so it pins successfully via opam.

Noticeable changes to Batsh are:

  • Migration to dune
  • Switched to use of ppx for sexp related functions
  • Switching from presumably ocamlyacc to menhir for parser_yacc.mly (modified file a bit to fit menhir’s syntax)

I have not run either of Dlist or Batsh through any of their test suites, however, so not sure if the modifications were made correctly.

2 Likes

@darrenldl
Thank you so much for putting effort in this project as well. I will be watching your fork. Best of luck and skills to you.

1 Like

Amazing, please send pull requests to the original project. You did good job. Please update the README and opam files - feel free to take them from my fork/branch.

2 Likes

@Akito Haha all good! I was looking at Batsh some time ago actually, but never got too many incentives to migrate it to more recent OCaml versions. So your request/asking for help gave me an excuse.

@XVilka Haha thanks! I’ll send a PR shortly adding your opam files.

But I can’t tell how receptive the author would be toward the PR, seeing there are two PRs sitting around, so I’ll also add static builds (have some Travis CI files already made for Alpine docker static builds for another project) on top of PR.

I’ll reply here when that’s done.

1 Like

@Akito Static builds are available via GitHub releases, you can download the static binary at releases page.

Note that the version text is literally “dummy text” as the project previously relied on ocp-build (I think?) to generate version related code/info, and I haven’t figured out a proper replacement yet. Let me know if this breaks your workflow etc.

@XVilka PR has been filed as PR #75 at the master repo. But I don’t anticipate any response, so I’m not going to polish the PR any further unless the author chimes in.

EDIT: I’m doing some more housekeeping right now, and will update this comment when that’s done, so above info may not be the most up to date.

EDIT2: I’ve overhauled the project structure so tests code files can be built in dune. I am having a failing test case, however, which I don’t know what the resolution should be. Essentially !! in batch (the delayed expansion operators) don’t seem to work when it’s used in the command position.

Relevant code section of test_scripts/batch/command.bat

echo Println Called
set cmd=echo
!cmd! Echo Called
for /f "delims=" %%i in ('echo Value 100%%') do set retval=%%i
echo !retval!

So !cmd! Echo Called results in
Can't recognize 'echo Echo Called' as an internal or external command, or batch script.
when run in wine via wine cmd /c test_scripts/batch/command.bat

Would you send a direct email to the authors of the software? This can often be more effective than a pull request on a repository they are not actively maintaining.

1 Like

Good recommendation. Have sent an email to the author’s email address (or at least the one I could find anyway).

I’ve received a reply from Carbo, author of Batsh, stating due to myriad reasons he has been unable to actively maintain Batsh. (I’m leaving out the details here based on my personal judgement.)

He also stated he’s happy to let someone/some group to take over the maintenance of Batsh as well.

I’m not personally interested in doing so due to time requirements, but I’m happy to assist with the initial transition should anyone/any group want to take the mantle so to speak.

@darrenldl
Thank you so much! I’m excited! I will try out your new build(s)! :dancing_women:

@darrenldl

Out of curousity I tried to compile your version of Batsh with your version of Dlist inside Docker and I ended up with the following:

File "lib/winbat_format.ml", line 44, characters 16-36:
44 |     if bare || ((String.get ident 0) = '%') then
                     ^^^^^^^^^^^^^^^^^^^^
Error: This expression has type char but an expression was expected of type
         Core_kernel.Int.t = int

However your released binary works as expected. Great job.

Which version of OCaml are you on? The Docker image used by Travis CI is running 4.09, the version on my computer is 4.08.1, so it should build on either of the two versions. But I’m not sure about older versions otherwise.

I was using 4.08.1 because I have read somewhere that that is the version you are using.

No clue then, but doesn’t matter too much since you’ve got a static binary copy anyway. Also just heads up, there’s a v0.0.7 release with version string patched in, but otherwise not much is changed.

For now I created the following, but I will probably make some editions. We will see how using Batsh will go from now on.

I am happy, because it removes one more item (once released on opam) from this list: The end of Camlp4 - List of packages that still use it.

Sadly, the author still didn’t merge PRs. Not to say anything about publishing the new version in opam…

He sadly does not seem interested. Maybe in the worst case, we need to push a new opam package, even if this would be kind of bad.

Maybe it would make sense to move the repo somewhere (GitHub creates redirects for that) or give some people access to maintain it. That way it is somewhat more “legitimate” than just any fork.

1 Like

On the other hand, if the fork is “approved” and just plain better, plain improved, it will quickly be a valid and legitimate replacement. Happened to a LOT of open source projects, before.

1 Like

Sure, but by not moving it, you will need to add a note anyway that development is moved somewhere else, and instead of things redirecting transparently you need to have manual intervention of determining that URLs need to be adjusted and figuring out which URL that is. As with Tim Berners-Lee: Cool URIs don’t change.

OTOH If such a note is not added, how would you prove that the original author approves the new repository.

1 Like