Thread overview
goinsu - Switch user, group and execute a program - a tiny betterC program
Sep 16, 2017
Anton Fediushin
Sep 27, 2017
jamonahn
Sep 27, 2017
Anton Fediushin
Sep 28, 2017
jamonahn
September 16, 2017
Hey-hey-hey, I am so excited to announce a brand-new program I just wrote: goinsu!

goinsu works like a classic `su` or `sudo`, but meant to be used inside the Docker containers, when you just need to run a program as a specified user.

goinsu is a workaround for TTY and signal issues of `su` and `sudo`. It has been written as an example of betterC usage.

Check out project on the DUB registry: http://code.dlang.org/packages/goinsu
Ask questions in this topic or create an issue on GitHub: https://github.com/ohdatboi/goinsu
Make sure to check out reggae, an awesome build tool which is used to build goinsu in betterC mode: https://github.com/atilaneves/reggae

September 27, 2017
On Saturday, 16 September 2017 at 19:56:14 UTC, Anton Fediushin wrote:
> Hey-hey-hey, I am so excited to announce a brand-new program I just wrote: goinsu!

Just built on my Raspberry Pi 3.  Kudos - very fast, not even a warning!  Now to get some Docker images and go crazy.

BTW, I got a 14,116 byte executable image with LDC but 1,958,892 with GDC.  The GDC image (stripped) is 324,492.  I installed reggae on my laptop (debian) and did a "reggae --export".  Then using make (with ldc2) I got image of 13,088.  Using "dub -b release --compiler=ldc2" (same build as on Raspbian) I get image of 381,928.

How do I do a static linkage using LDC?  I need a static because I want to try and run this with an Alpine (arm) Docker image and Alpine is using muslib-c.  I once built an Alpine Docker image by hand that built ldc, but it couldn't survive D version/Alpine Os updates.

Thank you so much for this tool!

September 27, 2017
On Wednesday, 27 September 2017 at 12:49:16 UTC, jamonahn wrote:
> On Saturday, 16 September 2017 at 19:56:14 UTC, Anton Fediushin wrote:
>> Hey-hey-hey, I am so excited to announce a brand-new program I just wrote: goinsu!
>
> Just built on my Raspberry Pi 3.  Kudos - very fast, not even a warning!  Now to get some Docker images and go crazy.

Hooray!

>
> BTW, I got a 14,116 byte executable image with LDC but 1,958,892 with GDC.  The GDC image (stripped) is 324,492.  I installed reggae on my laptop (debian) and did a "reggae --export".  Then using make (with ldc2) I got image of 13,088.  Using "dub -b release --compiler=ldc2" (same build as on Raspbian) I get image of 381,928.

Reggae builds goinsu in betterC mode, which removes dependency on the druntime and phobos.

Dub can also build betterC programs, but I decided not to add such flag to dub.json, because betterC is a new thing which can cause problems.

LDC and GDC could have very limited betterC support, so results may vary.

> How do I do a static linkage using LDC?  I need a static because I want to try and run this with an Alpine (arm) Docker image and Alpine is using muslib-c.  I once built an Alpine Docker image by hand that built ldc, but it couldn't survive D version/Alpine Os updates.

You don't have to compile LDC for this. It is possible to compile a static musl and link it together with the goinsu. Take a look at `.travis.yml`, since this is exactly what I am doing to build releases.

Also, do not forget the `errnofix.c`, which is important for static linking.

Reggae does this automatically, you just have to specify static libc you want to link to. Maybe it won't work for RPi though.

I've ordered Raspberry Pi recently, so as soon as I get it I can start hacking on it as well)

>
> Thank you so much for this tool!

You're welcome!


September 28, 2017
On Wednesday, 27 September 2017 at 20:30:16 UTC, Anton Fediushin wrote:
> Take a look at `.travis.yml`, since this is exactly what I am doing to build releases.

Thank you!  Exactly the know-how I was missing.