Skip to contentSkip to conversation

Make coreutils 6.x+ install utility to honor STRIP env variable

PATCH In review Khem Raj 3 participants 3 messages Mar 4, 2009 – Mar 5, 2009

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 Make coreutils 6.x+ install utility to honor STRIP env variable

Hi

As reported in bug 5052 and also on irc, install calls strip directly. We should make it use STRIP env variable which is set to <cross-strip> in OE env.

This is a patch which does that

OK for .dev ?

Thx
-Khem

src/install.c +9 -2
Index: coreutils-6.0/src/install.c
===================================================================
@@ -526,7 +526,14 @@
 strip (char const *name)
 {
   int status;
-  pid_t pid = fork ();
+  pid_t pid;
+  char *strip_name;
+
+  strip_name = getenv ("STRIP");
+  if (strip_name == NULL)
+    strip_name = "strip";
+
+  pid = fork ();
 
   switch (pid)
     {
@@ -534,7 +541,7 @@
       error (EXIT_FAILURE, errno, _("fork system call failed"));
       break;
     case 0:			/* Child. */
-      execlp ("strip", "strip", name, NULL);
+      execlp (strip_name, "strip", name, NULL);
       error (EXIT_FAILURE, errno, _("cannot run strip"));
       break;
     default:			/* Parent. */
#1 lore raw

Very welcome, thanks.

Can you do the same for 7.1 while you're there?

(So that when we upgrade we already have this working)

Signature · 1 line
:M:
#2 lore raw
In reply to Khem Raj
Quoted 35 lines · Khem Raj

Hi

As reported in bug 5052 and also on irc, install calls strip directly. We should make it use STRIP env variable which is set to <cross-strip> in OE env.

This is a patch which does that

OK for .dev ?

Thx
-Khem

Index: coreutils-6.0/src/install.c
===================================================================

src/install.c +8 -1
@@ -526,7 +526,14 @@
 strip (char const *name)
 {
  int status;
-  pid_t pid = fork ();
+  pid_t pid;
+  char *strip_name;
+
+  strip_name = getenv ("STRIP");
+  if (strip_name == NULL)
+    strip_name = "strip";
+
+  pid = fork ();
 
  switch (pid)
    {

src/install.c line 544

Quoted 5 lines
src/install.c +1 -1
@@ -534,7 +541,7 @@
      error (EXIT_FAILURE, errno, _("fork system call failed"));
      break;
    case 0:			/* Child. */
-      execlp ("strip", "strip", name, NULL);
+      execlp (strip_name, "strip", name, NULL);

perhaps it would be nicer to use the basename of strip_name instead of hardcoding "strip" ?

src/install.c line 545

Quoted 1 line
src/install.c +0 -0
      error (EXIT_FAILURE, errno, _("cannot run strip"));

indicating the actual binary that failed may be nice, too.

My install(1) uses STRIPCMD and STRIPARGS, I suggest you add a way to pass additional arguments to that strip, too.
Just a thought..

Quoted 2 lines
src/install.c +0 -0
      break;
    default:			/* Parent. */