From I@J@Kocken @end|ng |rom uu@n|  Thu Nov  5 11:15:50 2020
From: I@J@Kocken @end|ng |rom uu@n| (Kocken, I.J. (Ilja))
Date: Thu, 5 Nov 2020 10:15:50 +0000
Subject: [Rd] Some packages have non-POSIX-compliant shell scripts.
 Implement a CRAN check for bashisms?
Message-ID: <AM6PR05MB4360AE234461D3DF8B659F16D2EE0@AM6PR05MB4360.eurprd05.prod.outlook.com>

Dear R-devel,

Recently I ran into trouble installing two separate packages, nloptr and ncdf4, both due to the same issue: they have scripts that have the shebang `#! /bin/sh', but have bashisms in them, i.e. non-POSIX-compliant bash scripts.

I use dash [1] as my shell environment, since it's about 4x as fast as bash. It looks like it's recently also become the default shell for Debian (and thus Ubuntu).

It took quite a while to figure out what the issue was in great collaboration with the author of ncdf4 (CC).

Perhaps it would be good to implement the utility checkbashisms [2] into the CRAN make pipeline to help discover these kinds of issues? Running `checkbashisms -f pkg/configure` on files that have the `#! /bin/sh` shebang gives useful information about which lines of code are secretly bash code, with some hints on how to make them POSIX-compliant. The alternative would of course be to change the shebang into `#! /bin/bash`.

Kind regards,

Ilja Kocken



[1]: http://gondor.apana.org.au/~herbert/dash/
[2]: https://packages.qa.debian.org/d/devscripts.html


[Rd] Some packages have non-POSIX-compliant shell scripts. Implement a CRAN check for bashisms?
Kocken, I.J. (Ilja