Re: [PATCH] Fix non-Linux builds

2022-10-16 Thread tito
On Sun, 16 Oct 2022 15:44:23 +0200
Samuel Thibault  wrote:

> tito, le dim. 16 oct. 2022 09:26:27 +0200, a ecrit:
> > On Sun, 16 Oct 2022 02:04:59 +0200
> > Samuel Thibault  wrote:
> > 
> > > Various tools are Linuxish and should thus only attempted to build on
> > > Linux only. Some features are also Linux-only.
> > 
> > Hi,
> > just out of curiosity why can this not be fixed by simply
> > creating a config file that disables the applets that are not relevant 
> > for your platform?
> 
> Because it'd mean making *each and every* downstream (the various BSD
> distributions, the couple Hurd distributions, BeOS, etc. etc.) have to
> determine that list, while it could just be shared upstream, as all
> software usually just do.

Hi,
they still need to got through the config file creation
at least once to enable what is needed for their specific use
so it seems not to make that big difference.

> > I think this would reduce the size of the patch to the
> > #ifdef O_DIRECT part which could be moved for example
> > to include/platform.h.
> 
> Why moving it to platform.h? #ifdef O_DIRECT already means what it
> means.

Couldn't it be achieved by disabling ENABLE_FEATURE_DD_IBS_OBS in config
avoiding an ifdef hell?

Ciao,
Tito

> Ron Yorston, le dim. 16 oct. 2022 08:36:21 +0100, a ecrit:
> > PLATFORM_LINUX was removed a couple of years ago by commit 5c69ad0ec
> > (build system: drop PLATFORM_LINUX).
> > 
> > It had very little effect back then, now it has none.
> 
> Ah, so how would it have to be done nowadays?
> 
> Samuel
> ___
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] Fix non-Linux builds

2022-10-16 Thread Ron Yorston
Maling list thread prior to commit e3b1a1fd2:

   http://lists.busybox.net/pipermail/busybox/2011-February/074954.html

Ron
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] Fix non-Linux builds

2022-10-16 Thread Ron Yorston
Samuel Thibault wrote:
>Ron Yorston, le dim. 16 oct. 2022 08:36:21 +0100, a ecrit:
>> PLATFORM_LINUX was removed a couple of years ago by commit 5c69ad0ec
>> (build system: drop PLATFORM_LINUX).
>> 
>> It had very little effect back then, now it has none.
>
>Ah, so how would it have to be done nowadays?

I suppose it would mean going back to the situation prior to these
commits:

  4d06b3145  build system: no longer prompt for PLATFORM_LINUX option
  e3b1a1fd2  Replace "depends on PLATFORM_LINUX" with "select PLATFORM_LINUX"

where PLATFORM_LINUX was a user-selectable option and applets that were
deemed Linux specific depended on it.

Ron
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] Fix non-Linux builds

2022-10-16 Thread Samuel Thibault
tito, le dim. 16 oct. 2022 09:26:27 +0200, a ecrit:
> On Sun, 16 Oct 2022 02:04:59 +0200
> Samuel Thibault  wrote:
> 
> > Various tools are Linuxish and should thus only attempted to build on
> > Linux only. Some features are also Linux-only.
> 
> Hi,
> just out of curiosity why can this not be fixed by simply
> creating a config file that disables the applets that are not relevant 
> for your platform?

Because it'd mean making *each and every* downstream (the various BSD
distributions, the couple Hurd distributions, BeOS, etc. etc.) have to
determine that list, while it could just be shared upstream, as all
software usually just do.

> I think this would reduce the size of the patch to the
> #ifdef O_DIRECT part which could be moved for example
> to include/platform.h.

Why moving it to platform.h? #ifdef O_DIRECT already means what it
means.

Ron Yorston, le dim. 16 oct. 2022 08:36:21 +0100, a ecrit:
> PLATFORM_LINUX was removed a couple of years ago by commit 5c69ad0ec
> (build system: drop PLATFORM_LINUX).
> 
> It had very little effect back then, now it has none.

Ah, so how would it have to be done nowadays?

Samuel
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


nl applet missing documentation

2022-10-16 Thread laalsaas
Hey,

busybox provides the `nl` applet, for numbering lines. However, the
existance of this applet isn't documented at
https://www.busybox.net/downloads/BusyBox.html
, neither in the manpage.

regards,
laalsaas
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] Fix non-Linux builds

2022-10-16 Thread Ron Yorston
PLATFORM_LINUX was removed a couple of years ago by commit 5c69ad0ec
(build system: drop PLATFORM_LINUX).

It had very little effect back then, now it has none.

Ron
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] Fix non-Linux builds

2022-10-16 Thread tito
On Sun, 16 Oct 2022 02:04:59 +0200
Samuel Thibault  wrote:

> Various tools are Linuxish and should thus only attempted to build on
> Linux only. Some features are also Linux-only.

Hi,
just out of curiosity why can this not be fixed by simply
creating a config file that disables the applets that are not relevant 
for your platform?
I think this would reduce the size of the patch to the
#ifdef O_DIRECT part which could be moved for example
to include/platform.h.
Busybox " is also extremely modular so you can easily include or exclude
commands (or features) at compile time. "

Ciao,
Tito

> Also, libresolv is used on all GNU platforms, notably GNU/Hurd and
> GNU/kfreeBSD.
> 
> diff --git a/Makefile.flags b/Makefile.flags
> index 84cb00a75..50137a78e 100644
> --- a/Makefile.flags
> +++ b/Makefile.flags
> @@ -184,7 +184,7 @@ LDLIBS += $(if 
> $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%
>  endif
>  
>  ifeq ($(CONFIG_FEATURE_NSLOOKUP_BIG),y)
> -ifneq (,$(findstring linux,$(shell $(CC) $(CFLAGS) -dumpmachine)))
> +ifneq (,$(findstring gnu,$(shell $(CC) $(CFLAGS) -dumpmachine)))
>  LDLIBS += resolv
>  endif
>  endif
> diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
> index 81a0e6aa8..3f36cabe0 100644
> --- a/console-tools/loadfont.c
> +++ b/console-tools/loadfont.c
> @@ -12,6 +12,7 @@
>  //config:config LOADFONT
>  //config:bool "loadfont (5.2 kb)"
>  //config:default y
> +//config:select PLATFORM_LINUX
>  //config:help
>  //config:This program loads a console font from standard input.
>  //config:
> diff --git a/console-tools/openvt.c b/console-tools/openvt.c
> index db2f073b2..9e6cffecc 100644
> --- a/console-tools/openvt.c
> +++ b/console-tools/openvt.c
> @@ -10,6 +10,7 @@
>  //config:config OPENVT
>  //config:bool "openvt (7.2 kb)"
>  //config:default y
> +//config:select PLATFORM_LINUX
>  //config:help
>  //config:This program is used to start a command on an unused
>  //config:virtual terminal.
> diff --git a/coreutils/dd.c b/coreutils/dd.c
> index 06c1b7b9c..3e034eb1e 100644
> --- a/coreutils/dd.c
> +++ b/coreutils/dd.c
> @@ -200,6 +200,7 @@ static void dd_output_status(int UNUSED_PARAM cur_signal)
>  }
>  
>  #if ENABLE_FEATURE_DD_IBS_OBS
> +# ifdef O_DIRECT
>  static int clear_O_DIRECT(int fd)
>  {
>   if (errno == EINVAL) {
> @@ -211,6 +212,7 @@ static int clear_O_DIRECT(int fd)
>   }
>   return 0;
>  }
> +# endif
>  #endif
>  
>  static ssize_t dd_read(void *ibuf, size_t ibs)
> @@ -225,8 +227,10 @@ static ssize_t dd_read(void *ibuf, size_t ibs)
>  #endif
>   n = safe_read(ifd, ibuf, ibs);
>  #if ENABLE_FEATURE_DD_IBS_OBS
> +# ifdef O_DIRECT
>   if (n < 0 && (G.flags & FLAG_IDIRECT) && clear_O_DIRECT(ifd))
>   goto read_again;
> +# endif
>  #endif
>   return n;
>  }
> @@ -239,8 +243,10 @@ static bool write_and_stats(const void *buf, size_t len, 
> size_t obs,
>   IF_FEATURE_DD_IBS_OBS(write_again:)
>   n = full_write(ofd, buf, len);
>  #if ENABLE_FEATURE_DD_IBS_OBS
> +# ifdef O_DIRECT
>   if (n < 0 && (G.flags & FLAG_ODIRECT) && clear_O_DIRECT(ofd))
>   goto write_again;
> +# endif
>  #endif
>  
>  #if ENABLE_FEATURE_DD_THIRD_STATUS_LINE
> @@ -501,8 +507,13 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
>   if (infile) {
>   int iflag = O_RDONLY;
>  #if ENABLE_FEATURE_DD_IBS_OBS
> - if (G.flags & FLAG_IDIRECT)
> + if (G.flags & FLAG_IDIRECT) {
> +# ifdef O_DIRECT
>   iflag |= O_DIRECT;
> +# else
> + bb_error_msg_and_die("O_DIRECT not supported on this 
> platform");
> +# endif
> + }
>  #endif
>   xmove_fd(xopen(infile, iflag), ifd);
>   } else {
> @@ -516,8 +527,13 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
>   if (G.flags & FLAG_APPEND)
>   oflag |= O_APPEND;
>  #if ENABLE_FEATURE_DD_IBS_OBS
> - if (G.flags & FLAG_ODIRECT)
> + if (G.flags & FLAG_ODIRECT) {
> +# ifdef O_DIRECT
>   oflag |= O_DIRECT;
> +# else
> + bb_error_msg_and_die("O_DIRECT not supported on this 
> platform");
> +# endif
> + }
>  #endif
>   xmove_fd(xopen(outfile, oflag), ofd);
>  
> diff --git a/klibc-utils/run-init.c b/klibc-utils/run-init.c
> index 73c677bab..77fc0e60c 100644
> --- a/klibc-utils/run-init.c
> +++ b/klibc-utils/run-init.c
> @@ -8,6 +8,7 @@
>  //config:config RUN_INIT
>  //config:bool "run-init (7.7 kb)"
>  //config:default y
> +//config:select PLATFORM_LINUX
>  //config:help
>  //config:The run-init utility is used from initramfs to select a new
>  //config:root device. Under initramfs, you have to use this instead of
> diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
> index 209d1d560..c289245c0 100644
> --- a/miscutils/adjtimex.c
> +++ b/miscutils/adjtimex.c
> @@ -13,6 +13,7 @@
>  //config:config