All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] procps-ng: remove the remaining busybox symlinks
@ 2016-01-12 14:23 Vicente Olivert Riera
  2016-01-12 20:12 ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Vicente Olivert Riera @ 2016-01-12 14:23 UTC (permalink / raw)
  To: buildroot

procps-ng is installed after busybox to ensure that its tools overwrite
the ones installed by busybox. However, some busybox symlinks for tools
which are now provided by procps-ng remain in /bin and /sbin pointing to
the busybox binary.

This shouldn't be a problem since the /usr/bin directory is listed
before /bin in the $PATH variable. However there could be some scripts
out there hardcoding the path of those tools calling them by "/bin/ps"
for instance.

So in order to avoid potential problems we just remove all busybox
symlinks for the tools which are now provided by procps-ng.

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 package/procps-ng/procps-ng.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/package/procps-ng/procps-ng.mk b/package/procps-ng/procps-ng.mk
index 07e98b9..784977d 100644
--- a/package/procps-ng/procps-ng.mk
+++ b/package/procps-ng/procps-ng.mk
@@ -17,8 +17,23 @@ PROCPS_NG_GETTEXTIZE = YES
 
 # If both procps-ng and busybox are selected, make certain procps-ng
 # wins the fight over who gets to have their utils actually installed.
+# Also remove the remaining busybox symlinks for tools which are now
+# provided by procps-ng.
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 PROCPS_NG_DEPENDENCIES += busybox
+
+define PROCPS_NG_REMOVE_BUSYBOX_COUNTERPARTS
+	for i in free kill pgrep pidof pkill pmap ps pwdx slabtop tload top uptime vmstat w watch; do \
+		if [ "$$(readlink $(TARGET_DIR)/bin/$$i)" == "busybox" ]; then \
+			rm $(TARGET_DIR)/bin/$$i; \
+		fi; \
+	done
+
+	if [ "$$(readlink $(TARGET_DIR)/sbin/sysctl)" == "../bin/busybox" ]; then \
+		rm $(TARGET_DIR)/sbin/sysctl; \
+	fi
+endef
+PROCPS_NG_POST_INSTALL_TARGET_HOOKS += PROCPS_NG_REMOVE_BUSYBOX_COUNTERPARTS
 endif
 
 ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE),y)
-- 
2.4.10

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] procps-ng: remove the remaining busybox symlinks
  2016-01-12 14:23 [Buildroot] [PATCH] procps-ng: remove the remaining busybox symlinks Vicente Olivert Riera
@ 2016-01-12 20:12 ` Thomas Petazzoni
  2016-01-12 20:20   ` Yann E. MORIN
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2016-01-12 20:12 UTC (permalink / raw)
  To: buildroot

Vicente,

On Tue, 12 Jan 2016 14:23:01 +0000, Vicente Olivert Riera wrote:
> procps-ng is installed after busybox to ensure that its tools overwrite
> the ones installed by busybox. However, some busybox symlinks for tools
> which are now provided by procps-ng remain in /bin and /sbin pointing to
> the busybox binary.
> 
> This shouldn't be a problem since the /usr/bin directory is listed
> before /bin in the $PATH variable. However there could be some scripts
> out there hardcoding the path of those tools calling them by "/bin/ps"
> for instance.
> 
> So in order to avoid potential problems we just remove all busybox
> symlinks for the tools which are now provided by procps-ng.
> 
> Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> ---
>  package/procps-ng/procps-ng.mk | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/package/procps-ng/procps-ng.mk b/package/procps-ng/procps-ng.mk
> index 07e98b9..784977d 100644
> --- a/package/procps-ng/procps-ng.mk
> +++ b/package/procps-ng/procps-ng.mk
> @@ -17,8 +17,23 @@ PROCPS_NG_GETTEXTIZE = YES
>  
>  # If both procps-ng and busybox are selected, make certain procps-ng
>  # wins the fight over who gets to have their utils actually installed.
> +# Also remove the remaining busybox symlinks for tools which are now
> +# provided by procps-ng.
>  ifeq ($(BR2_PACKAGE_BUSYBOX),y)
>  PROCPS_NG_DEPENDENCIES += busybox
> +
> +define PROCPS_NG_REMOVE_BUSYBOX_COUNTERPARTS
> +	for i in free kill pgrep pidof pkill pmap ps pwdx slabtop tload top uptime vmstat w watch; do \
> +		if [ "$$(readlink $(TARGET_DIR)/bin/$$i)" == "busybox" ]; then \
> +			rm $(TARGET_DIR)/bin/$$i; \
> +		fi; \
> +	done
> +
> +	if [ "$$(readlink $(TARGET_DIR)/sbin/sysctl)" == "../bin/busybox" ]; then \
> +		rm $(TARGET_DIR)/sbin/sysctl; \
> +	fi
> +endef
> +PROCPS_NG_POST_INSTALL_TARGET_HOOKS += PROCPS_NG_REMOVE_BUSYBOX_COUNTERPARTS
>  endif

I don't think we're doing it this way for any other package. In
general, we either:

 * Arrange for the package to install its tools at the same location as
   Busybox installs them.

 * Or add a post-install hook to move the binaries installed by the
   package to where Busybox installs them.

Peter, Yann ?

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] procps-ng: remove the remaining busybox symlinks
  2016-01-12 20:12 ` Thomas Petazzoni
@ 2016-01-12 20:20   ` Yann E. MORIN
  2016-01-12 20:42     ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2016-01-12 20:20 UTC (permalink / raw)
  To: buildroot

Thomas, Vicente, All,

On 2016-01-12 21:12 +0100, Thomas Petazzoni spake thusly:
> On Tue, 12 Jan 2016 14:23:01 +0000, Vicente Olivert Riera wrote:
> > procps-ng is installed after busybox to ensure that its tools overwrite
> > the ones installed by busybox. However, some busybox symlinks for tools
> > which are now provided by procps-ng remain in /bin and /sbin pointing to
> > the busybox binary.
> > 
> > This shouldn't be a problem since the /usr/bin directory is listed
> > before /bin in the $PATH variable. However there could be some scripts
> > out there hardcoding the path of those tools calling them by "/bin/ps"
> > for instance.
> > 
> > So in order to avoid potential problems we just remove all busybox
> > symlinks for the tools which are now provided by procps-ng.
> > 
> > Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
[--SNIP--]
> I don't think we're doing it this way for any other package. In
> general, we either:
> 
>  * Arrange for the package to install its tools at the same location as
>    Busybox installs them.
> 
>  * Or add a post-install hook to move the binaries installed by the
>    package to where Busybox installs them.
> 
> Peter, Yann ?

Yes, I agree with Thomas. First solution is preferred if possible, of
course, so that we don't have to maintain the list of executables to
move in the post-install hook.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] procps-ng: remove the remaining busybox symlinks
  2016-01-12 20:20   ` Yann E. MORIN
@ 2016-01-12 20:42     ` Peter Korsgaard
  2016-01-13 15:26       ` Vicente Olivert Riera
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2016-01-12 20:42 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

Hi,

 >> I don't think we're doing it this way for any other package. In
 >> general, we either:
 >> 
 >> * Arrange for the package to install its tools at the same location as
 >> Busybox installs them.
 >> 
 >> * Or add a post-install hook to move the binaries installed by the
 >> package to where Busybox installs them.
 >> 
 >> Peter, Yann ?

 > Yes, I agree with Thomas. First solution is preferred if possible, of
 > course, so that we don't have to maintain the list of executables to
 > move in the post-install hook.

Agreed. If you need to go for the second option make sure it is only
done if !BR2_ROOTFS_MERGED_USR.

-- 
Venlig hilsen,
Peter Korsgaard 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] procps-ng: remove the remaining busybox symlinks
  2016-01-12 20:42     ` Peter Korsgaard
@ 2016-01-13 15:26       ` Vicente Olivert Riera
  2016-01-13 15:33         ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Vicente Olivert Riera @ 2016-01-13 15:26 UTC (permalink / raw)
  To: buildroot

Hello Peter, Thomas, Yann,

On 12/01/16 20:42, Peter Korsgaard wrote:
>>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> 
> Hi,
> 
>  >> I don't think we're doing it this way for any other package. In
>  >> general, we either:
>  >> 
>  >> * Arrange for the package to install its tools at the same location as
>  >> Busybox installs them.
>  >> 
>  >> * Or add a post-install hook to move the binaries installed by the
>  >> package to where Busybox installs them.
>  >> 
>  >> Peter, Yann ?
> 
>  > Yes, I agree with Thomas. First solution is preferred if possible, of
>  > course, so that we don't have to maintain the list of executables to
>  > move in the post-install hook.
> 
> Agreed. If you need to go for the second option make sure it is only
> done if !BR2_ROOTFS_MERGED_USR.
> 

configuring procps-ng for installing its binaries in /bin and /sbin
(first option suggested by Thomas) mostly works, except for two tools
(pidof and watch) which are installed in /usr/bin and their busybox
counterparts still exist in /bin.

configuring procps-ng for installing its binaries in /bin and /sbin
doesn't mean that all its binaries will end up in /bin and /sbin. Some
of them are still installed in /usr/bin and /usr/sbin.

So, I see three options here:

1 - follow the second suggestion from Thomas (post-install hook to move
the ALL binaries installed by the package to where Busybox installs them)

2 - same thing but only move pidof and watch binaries

3 - remove /bin/pidof and /bin/watch symlinks installed by Busybox

I happy with any of them, so, which one do you prefer?

Regards,

Vincent.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] procps-ng: remove the remaining busybox symlinks
  2016-01-13 15:26       ` Vicente Olivert Riera
@ 2016-01-13 15:33         ` Thomas Petazzoni
  2016-01-13 15:42           ` Peter Korsgaard
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2016-01-13 15:33 UTC (permalink / raw)
  To: buildroot

Vicente,

On Wed, 13 Jan 2016 15:26:42 +0000, Vicente Olivert Riera wrote:

> So, I see three options here:
> 
> 1 - follow the second suggestion from Thomas (post-install hook to move
> the ALL binaries installed by the package to where Busybox installs them)
> 
> 2 - same thing but only move pidof and watch binaries
> 
> 3 - remove /bin/pidof and /bin/watch symlinks installed by Busybox
> 
> I happy with any of them, so, which one do you prefer?

I think my personal preference would be to install as many procps-ng
tools as possible in the "right" place, and then only move the few ones
for which you can't configure the installation location.

On a side note, it would be interesting to write a tool that looks if
there are two binaries in bin/, sbin/, usr/bin/ and usr/sbin/ with the
same name, in order to automatically detect at the end of the build if
we have two commands (one full implementation and one from Busybox)
that are installed in different locations.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] procps-ng: remove the remaining busybox symlinks
  2016-01-13 15:33         ` Thomas Petazzoni
@ 2016-01-13 15:42           ` Peter Korsgaard
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2016-01-13 15:42 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 > Vicente,
 > On Wed, 13 Jan 2016 15:26:42 +0000, Vicente Olivert Riera wrote:

 >> So, I see three options here:
 >> 
 >> 1 - follow the second suggestion from Thomas (post-install hook to move
 >> the ALL binaries installed by the package to where Busybox installs them)
 >> 
 >> 2 - same thing but only move pidof and watch binaries
 >> 
 >> 3 - remove /bin/pidof and /bin/watch symlinks installed by Busybox
 >> 
 >> I happy with any of them, so, which one do you prefer?

 > I think my personal preference would be to install as many procps-ng
 > tools as possible in the "right" place, and then only move the few ones
 > for which you can't configure the installation location.

Indeed, me too. I don't think we want more than 1 of the "same" binary
on a system, and E.G. have scripts behave differently if they call the
tools without specifying any path or hardcoding /bin/<tool>.

 > On a side note, it would be interesting to write a tool that looks if
 > there are two binaries in bin/, sbin/, usr/bin/ and usr/sbin/ with the
 > same name, in order to automatically detect at the end of the build if
 > we have two commands (one full implementation and one from Busybox)
 > that are installed in different locations.

Yes, that could be a nice check.

-- 
Venlig hilsen,
Peter Korsgaard 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-01-13 15:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-12 14:23 [Buildroot] [PATCH] procps-ng: remove the remaining busybox symlinks Vicente Olivert Riera
2016-01-12 20:12 ` Thomas Petazzoni
2016-01-12 20:20   ` Yann E. MORIN
2016-01-12 20:42     ` Peter Korsgaard
2016-01-13 15:26       ` Vicente Olivert Riera
2016-01-13 15:33         ` Thomas Petazzoni
2016-01-13 15:42           ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.