[LTP] [v2 2/2] lib/tst_pid.c: Increase PIDS_RESERVED to avoid fork failure.
Leo Liang
ycliang@andestech.com
Thu Feb 16 15:52:14 CET 2023
Hi Cyril,
On Thu, Feb 16, 2023 at 09:46:59AM +0100, Cyril Hrubis wrote:
> Hi!
> > Just out of curiosity, is there any reason that we should do this in plain C ?
> > (Otherwise, we could drop this patchset and stay with the current implementation)
>
> There are a few, calling random scripts from C is a bad practice
> overall.
>
> Portabilitity may be one of the problems, there are several
> iimplementations of the basic UNIX utilities for Linux eg. coreutils,
> busybox, toybox, etc. These implemtations are subtly incompatible, not
> all commandline options are supported and so on. And for the busybox and
> toybox some options can be disabled at a compile time. We leaned that
> sometimes you have to double check if the functionality available and
> most of the time the end result is that it's just easier to rewrite the
> code in C.
>
> We also have rule to make tests as self contained as possible, which
> simplifies debugging. One of the problems is that we do not have the
> environment the shell code runs in under control, we had a few test
> failing for non-standard settings of the LANG variables.
>
> In this case the code is reasonably simple, so it will be less likely to
> be problematic, however I would stil lean towards replacing it with C
> code.
>
> tl;dr Calling shell code from C programs makes things less predictable
> and possibly unstable.
>
Understood! Thank you for the detailed explanation!!
Will send a v3 patch ASAP in accordance with your advice!
Best regards,
Leo
> --
> Cyril Hrubis
> chrubis@suse.cz
More information about the ltp
mailing list