Re: iplink_can support on Busybox

2011-03-01 Thread Hector Palacios

On 02/25/2011 05:13 PM, Palacios, Hector wrote:

I need the 'ip' applet to support Socket-CAN devices. In iproute2 suite this is 
handled by iplink_can.c.
Has anybody already tried to add this support to busybox?


Could anybody tell if there is any plan to add CAN support to the 'ip' applet?
Thanks,
--
Héctor Palacios
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: Ping

2011-03-01 Thread Bernd Petrovitsch
On Mon, 2011-02-28 at 13:09 +0100, Harald Becker wrote: 
 Is the mailing list down? ... please ignore, it's just a self test.

Ever read https://www.kernel.org/pub/linux/docs/lkml/#s3-15?

The same as for majordomo holds for mailman.
Bernd
-- 
Bernd Petrovitsch  Email : be...@petrovitsch.priv.at
 LUGA : http://www.luga.at

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


Re: Ping

2011-03-01 Thread Harald Becker
 Hallo Bernd!

 Is the mailing list down? ... please ignore, it's just a self test.
 Ever read https://www.kernel.org/pub/linux/docs/lkml/#s3-15?

Did you read this: please ignore, it's just a self test ?

--
Harald

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


Re: Ping

2011-03-01 Thread Stuart Longland
On 03/01/11 21:08, Harald Becker wrote:
  Hallo Bernd!
 
 Is the mailing list down? ... please ignore, it's just a self test.
 Ever read https://www.kernel.org/pub/linux/docs/lkml/#s3-15?
 
 Did you read this: please ignore, it's just a self test ?

A self test to a mailing list that everyone sees is not a self test.

autoans...@vger.kernel.org for the win.
-- 
Stuart Longland (aka Redhatter, VK4MSL)  .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: Ping

2011-03-01 Thread Bernd Petrovitsch

Hi!
On Die, 2011-03-01 at 12:08 +0100, Harald Becker wrote:
[...] 
  Is the mailing list down? ... please ignore, it's just a self test.
  Ever read https://www.kernel.org/pub/linux/docs/lkml/#s3-15?
 
 Did you read this: please ignore, it's just a self test ?

Yes, and? Do you think it's cool if now and then everyone sends test
mails to MLs (for whatever reason)?
What actually makes you believe that your email address has been removed
or mail delivery has been disabled?

Apart from that: The self-test really doesn't work: Consider the case
where you did not get an answer (yet!). Then you cannot really tell if
- you actually are not subscribed (and the mail never was sent) or
- just the mail delivery has been disabled (and the mail never was sent)
- someone in simply between dropped the mail (which is not
  RFC-compliant but ) or
- just didn't wait long enough (and email is not and never was a real
  time service).

So your self-test is - additional to not appropriate as it spams lots of
other mailboxes - also not working.
And mailman can send you an email per month and tell you on which MLs
the email address actually is.

Bernd
-- 
Bernd Petrovitsch  Email : be...@petrovitsch.priv.at
 LUGA : http://www.luga.at

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


[PATCH 0/3] busybox fixes

2011-03-01 Thread Alexey Fomenko
Hello. Here are some patches fixing small resource leaks.
Hope they will be useful.

Alexey Fomenko (3):
  removed dead code. pargv was set NULL before cycle manually
  free allocated iface, liface and ifname before return
  Add missing fclose()

 libbb/getopt32.c   |4 
 networking/ifupdown.c  |7 +--
 networking/nameif.c|6 ++
 networking/route.c |2 ++
 util-linux/more.c  |1 +

 5 files changed, 10 insertions(+), 10 deletions(-)


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


[PATCH 1/3] removed dead code. pargv was set NULL before cycle manually

2011-03-01 Thread Alexey Fomenko
Manually setting pargv = NULL gives dead code. Looks like it's unused
anyway. 

Signed-off-by: Alexey Fomenko ext-alexey.fome...@nokia.com
---
 libbb/getopt32.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/libbb/getopt32.c b/libbb/getopt32.c
index 25bae31..576d52f 100644
--- a/libbb/getopt32.c
+++ b/libbb/getopt32.c
@@ -542,8 +542,6 @@ getopt32(char **argv, const char *applet_opts, ...)
 #endif
/* optarg = NULL; opterr = 0; optopt = 0; - do we need this?? */
 
-   pargv = NULL;
-
/* Note: just getopt() = 0 will not work well for
 * fake short options, like this one:
 * wget $'-\203' Test: test http://kernel.org/
@@ -585,8 +583,6 @@ getopt32(char **argv, const char *applet_opts, ...)
if (optarg)
*(char **)(on_off-optarg) = optarg;
}
-   if (pargv != NULL)
-   break;
}
 
/* check depending requires for given options */
-- 
1.7.3.4




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


[PATCH 2/3] free allocated iface and liface before return

2011-03-01 Thread Alexey Fomenko
xstrdup allocates buffer to iface, liface. Needs to be freed.

Signed-off-by: Alexey Fomenko ext-alexey.fome...@nokia.com
---
 networking/ifupdown.c |7 +--
 networking/nameif.c   |6 ++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 59df4e8..52fe8d8 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1220,13 +1220,13 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
/* ifup */
if (iface_state) {
bb_error_msg(interface %s already 
configured, iface);
-   continue;
+   goto next;
}
} else {
/* ifdown */
if (!iface_state) {
bb_error_msg(interface %s not 
configured, iface);
-   continue;
+   goto next;
}
}
llist_free(state_list, free);
@@ -1316,6 +1316,9 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
fclose(state_fp);
llist_free(state_list, free);
}
+   next:
+   free(iface);
+   free(liface);
}
 
return any_failures;
diff --git a/networking/nameif.c b/networking/nameif.c
index d02c2c1..ba73450 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -155,10 +155,8 @@ int nameif_main(int argc, char **argv)
bb_show_usage();
 
if (argc) {
-   while (*argv) {
-   char *ifname = xstrdup(*argv++);
-   prepend_new_eth_table(clist, ifname, *argv++);
-   }
+   while (*argv)
+   prepend_new_eth_table(clist, *argv++, *argv++);
} else {
parser = config_open(fname);
while (config_read(parser, token, 2, 2, # \t, PARSE_NORMAL))
-- 
1.7.3.4




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


[PATCH 3/3] Add missing fclose()

2011-03-01 Thread Alexey Fomenko
After opening fp and cin need to be closed.

Signed-off-by: Alexey Fomenko ext-alexey.fome...@nokia.com
---
 networking/route.c |2 ++
 util-linux/more.c  |1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/networking/route.c b/networking/route.c
index b7d08dd..18cb902 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -537,6 +537,7 @@ void FAST_FUNC bb_displayroutes(int noresolve, int 
netstatfmt)
printf(%-6d %-2d %7d %s\n, metric, ref, use, devname);
}
}
+   fclose(fp);
 }
 
 #if ENABLE_FEATURE_IPV6
@@ -625,6 +626,7 @@ static void INET6_displayroutes(void)
}
} while (1);
}
+fclose(fp);
 }
 
 #endif
diff --git a/util-linux/more.c b/util-linux/more.c
index c424a0e..7f22c1d 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -198,5 +198,6 @@ int more_main(int argc UNUSED_PARAM, char **argv)
} while (*argv  *++argv);
  end:
setTermSettings(cin_fileno, initial_settings);
+   fclose(cin);
return 0;
 }
-- 
1.7.3.4




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


Re: [PATCH] tar: remove leading / and ../ on reading and writing

2011-03-01 Thread Alexander Shishkin
On Mon, Feb 28, 2011 at 11:48:44PM +0100, Ralf Friedl wrote:
 Alexander Shishkin wrote:
 Currently, tar will add members with names starting with
 the prefixes to an archive unmodified, and will then refuse
 to extract from such archive. However, GNU tar will strip
 these prefixes upon creating the archive and reading from
 it.
 Is there a use case for this?

There's a bug in current implementation that I'm trying to fix,
that's it. Creating a broken archive (that GNU tar is still able
to unpack, though) and then failing to unpack it seems a good
enough reason for me.

 Instead of tar c ../path you can use tar cC .. path to crate
 that archive.

Yes, that bit works, of course.

 The patch looses functionality. The old code would detect
 ./../../etc, the new code would not.

Detect and bail, yes.

 The behavior of GNU tar is actually different: It will strip
 everything up to the last ../:
 $ tar c ./coreutils/../../../../../../etc/passwd  /dev/null
 tar: Removing leading `./coreutils/../../../../../../' from member names

That's true, thanks for pointing this out, I didn't know that.

 In addition, with the option t GNU tar claims to remove the leading
 path, but displays the full path:
 $ tar cP coreutils/../../../../../../../etc/passwd | tar t
 tar: Removing leading `coreutils/../../../../../../../' from member names
 coreutils/../../../../../../../etc/passwd

Ok, I'm not sure if this is actually a useful feature, but thanks
for pointing it out.

P.S. There's something wrong with your email client, I wasn't even
in CC in your reply.

Regards,
--
Alex
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: 2 issues with tar

2011-03-01 Thread Denys Vlasenko
On Monday 28 February 2011 09:23, Alexey Soloviev wrote:
 Hello,
 Met 2 problems with tar and wander if they are new or known.
 
 Issue 1: tar doesn't restore files or directories added with relative 
 name starting with ../
 Scenario:
 busybox tar -c -f archive.tar ../tobearchived
 busybox tar -xf archive.tar
 tar: name with '..' encountered: '../tobearchived'
 
 Gnu tar removes ../ from paths of archived files and directories, while 
 busybox's tar doesn't.
 Should it be fixed?
 Note that archive created by busybox tar on the 1st step can be restored 
 by gnu tar but not by busybox's.
 
 Issue 2: user name and group name in header of tar files are truncated 
 to 11 characters.

Hmm, you are right.
I am increasing USERNAME_MAX_SIZE in libbb.h to 32-sizeof(uid_t).

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


Re: 2 issues with tar

2011-03-01 Thread Denys Vlasenko
On Monday 28 February 2011 09:23, Alexey Soloviev wrote:
 Hello,
 Met 2 problems with tar and wander if they are new or known.
 
 Issue 1: tar doesn't restore files or directories added with relative 
 name starting with ../
 Scenario:
 busybox tar -c -f archive.tar ../tobearchived
 busybox tar -xf archive.tar
 tar: name with '..' encountered: '../tobearchived'
 
 Gnu tar removes ../ from paths of archived files and directories, while 
 busybox's tar doesn't.
 Should it be fixed?
 Note that archive created by busybox tar on the 1st step can be restored 
 by gnu tar but not by busybox's.

Proposed patch.

function old new   delta
get_header_tar  14931545 +52

-- 
vda

diff -ad -urpN busybox.7/archival/libarchive/get_header_tar.c 
busybox.8/archival/libarchive/get_header_tar.c
--- busybox.7/archival/libarchive/get_header_tar.c  2011-02-06 
19:52:35.0 +0100
+++ busybox.8/archival/libarchive/get_header_tar.c  2011-03-01 
17:16:49.0 +0100
@@ -422,11 +422,26 @@ char FAST_FUNC get_header_tar(archive_ha
p_linkname = NULL;
}
 #endif
-   if (strncmp(file_header-name, /../+1, 3) == 0
-|| strstr(file_header-name, /../)
-   ) {
-   bb_error_msg_and_die(name with '..' encountered: '%s',
-   file_header-name);
+   cp = file_header-name;
+   while (1) {
+   char *cp2;
+   if (strncmp(cp, /../+1, 3) == 0) {
+   cp += 3;
+   continue;
+   }
+   cp2 = strstr(cp, /../);
+   if (cp2) {
+   cp = cp2 + 4;
+   continue;
+   }
+   break;
+   }
+   if (cp != file_header-name) {
+   if (!(archive_handle-ah_flags  ARCHIVE_TAR__TRUNC_WARNED)) {
+   archive_handle-ah_flags |= ARCHIVE_TAR__TRUNC_WARNED;
+   bb_error_msg(removing leading '%.*s', (int)(cp - 
file_header-name), file_header-name);
+   }
+   overlapping_strcpy(file_header-name, cp);
}
 
/* Strip trailing '/' in directories */
diff -ad -urpN busybox.7/include/archive.h busybox.8/include/archive.h
--- busybox.7/include/archive.h 2011-02-06 20:01:03.0 +0100
+++ busybox.8/include/archive.h 2011-03-01 17:13:40.0 +0100
@@ -118,6 +118,8 @@ typedef struct archive_handle_t {
 #define ARCHIVE_DONT_RESTORE_PERM   (1  6)
 #define ARCHIVE_NUMERIC_OWNER   (1  7)
 #define ARCHIVE_O_TRUNC (1  8)
+/* Archiver specific. */
+#define ARCHIVE_TAR__TRUNC_WARNED   (1  9)
 
 
 /* POSIX tar Header Block, from POSIX 1003.1-1990  */
diff -ad -urpN busybox.7/testsuite/tar.tests busybox.8/testsuite/tar.tests
--- busybox.7/testsuite/tar.tests   2011-02-06 20:02:10.0 +0100
+++ busybox.8/testsuite/tar.tests   2011-03-01 17:16:07.0 +0100
@@ -168,6 +168,23 @@ Ok
  \
  
 
+# On extract, everything up to and including last .. component is stripped
+testing tar strips /../ on extract \
+rm -rf input_* test.tar 2/dev/null
+mkdir input_dir
+echo Ok input_dir/file
+tar cf test.tar ./../tar.tempdir/input_dir/../input_dir 21
+rm -rf input_* 2/dev/null
+tar -vxf test.tar 21
+cat input_dir/file 21
+ \
+tar: removing leading './../tar.tempdir/input_dir/../'
+input_dir/
+input_dir/file
+Ok
+ \
+ 
+
 
 cd ..  rm -rf tar.tempdir || exit 1
 
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: Ping

2011-03-01 Thread Denys Vlasenko
On Tuesday 01 March 2011 12:41, Bernd Petrovitsch wrote:
 
 Hi!
 On Die, 2011-03-01 at 12:08 +0100, Harald Becker wrote:
 [...] 
   Is the mailing list down? ... please ignore, it's just a self test.
   Ever read https://www.kernel.org/pub/linux/docs/lkml/#s3-15?
  
  Did you read this: please ignore, it's just a self test ?
 
 Yes, and? Do you think it's cool if now and then everyone sends test
 mails to MLs (for whatever reason)?

Replies to said mails are harming S/N too... hint...

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


Re: [PATCH 1/3] removed dead code. pargv was set NULL before cycle manually

2011-03-01 Thread Denys Vlasenko
On Tuesday 01 March 2011 12:38, Alexey Fomenko wrote:
 Manually setting pargv = NULL gives dead code. Looks like it's unused
 anyway. 
 
 Signed-off-by: Alexey Fomenko ext-alexey.fome...@nokia.com
 ---
  libbb/getopt32.c |4 
  1 files changed, 0 insertions(+), 4 deletions(-)
 
 diff --git a/libbb/getopt32.c b/libbb/getopt32.c
 index 25bae31..576d52f 100644
 --- a/libbb/getopt32.c
 +++ b/libbb/getopt32.c
 @@ -542,8 +542,6 @@ getopt32(char **argv, const char *applet_opts, ...)
  #endif
   /* optarg = NULL; opterr = 0; optopt = 0; - do we need this?? */
  
 - pargv = NULL;
 -
   /* Note: just getopt() = 0 will not work well for
* fake short options, like this one:
* wget $'-\203' Test: test http://kernel.org/
 @@ -585,8 +583,6 @@ getopt32(char **argv, const char *applet_opts, ...)
   if (optarg)
   *(char **)(on_off-optarg) = optarg;
   }
 - if (pargv != NULL)
 - break;
   }
  
   /* check depending requires for given options */

Applied, thanks!
-- 
vda
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: 2 issues with tar

2011-03-01 Thread Alexander Shishkin
On 1 March 2011 18:18, Denys Vlasenko vda.li...@googlemail.com wrote:
 On Monday 28 February 2011 09:23, Alexey Soloviev wrote:
 Hello,
 Met 2 problems with tar and wander if they are new or known.

 Issue 1: tar doesn't restore files or directories added with relative
 name starting with ../
 Scenario:
 busybox tar -c -f archive.tar ../tobearchived
 busybox tar -xf archive.tar
 tar: name with '..' encountered: '../tobearchived'

 Gnu tar removes ../ from paths of archived files and directories, while
 busybox's tar doesn't.
 Should it be fixed?
 Note that archive created by busybox tar on the 1st step can be restored
 by gnu tar but not by busybox's.

 Proposed patch.

This doesn't address the archive creation case, in which GNU tar would strip
the /../ just as well. Otherwise it's pretty much the same as what I've come up
with earlier today. :)


 function                                             old     new   delta
 get_header_tar                                      1493    1545     +52

 --
 vda

 diff -ad -urpN busybox.7/archival/libarchive/get_header_tar.c 
 busybox.8/archival/libarchive/get_header_tar.c
 --- busybox.7/archival/libarchive/get_header_tar.c      2011-02-06 
 19:52:35.0 +0100
 +++ busybox.8/archival/libarchive/get_header_tar.c      2011-03-01 
 17:16:49.0 +0100
 @@ -422,11 +422,26 @@ char FAST_FUNC get_header_tar(archive_ha
                p_linkname = NULL;
        }
  #endif
 -       if (strncmp(file_header-name, /../+1, 3) == 0
 -        || strstr(file_header-name, /../)
 -       ) {
 -               bb_error_msg_and_die(name with '..' encountered: '%s',
 -                               file_header-name);
 +       cp = file_header-name;
 +       while (1) {
 +               char *cp2;
 +               if (strncmp(cp, /../+1, 3) == 0) {

gcc can actually figure out that ../ is a substring of /../, from
what I see here.

 +                       cp += 3;
 +                       continue;
 +               }
 +               cp2 = strstr(cp, /../);
 +               if (cp2) {
 +                       cp = cp2 + 4;
 +                       continue;
 +               }
 +               break;
 +       }
 +       if (cp != file_header-name) {
 +               if (!(archive_handle-ah_flags  ARCHIVE_TAR__TRUNC_WARNED)) {
 +                       archive_handle-ah_flags |= ARCHIVE_TAR__TRUNC_WARNED;
 +                       bb_error_msg(removing leading '%.*s', (int)(cp - 
 file_header-name), file_header-name);
 +               }
 +               overlapping_strcpy(file_header-name, cp);
        }

        /* Strip trailing '/' in directories */
 diff -ad -urpN busybox.7/include/archive.h busybox.8/include/archive.h
 --- busybox.7/include/archive.h 2011-02-06 20:01:03.0 +0100
 +++ busybox.8/include/archive.h 2011-03-01 17:13:40.0 +0100
 @@ -118,6 +118,8 @@ typedef struct archive_handle_t {
  #define ARCHIVE_DONT_RESTORE_PERM   (1  6)
  #define ARCHIVE_NUMERIC_OWNER       (1  7)
  #define ARCHIVE_O_TRUNC             (1  8)
 +/* Archiver specific. */
 +#define ARCHIVE_TAR__TRUNC_WARNED   (1  9)


  /* POSIX tar Header Block, from POSIX 1003.1-1990  */
 diff -ad -urpN busybox.7/testsuite/tar.tests busybox.8/testsuite/tar.tests
 --- busybox.7/testsuite/tar.tests       2011-02-06 20:02:10.0 +0100
 +++ busybox.8/testsuite/tar.tests       2011-03-01 17:16:07.0 +0100
 @@ -168,6 +168,23 @@ Ok
   \
   

 +# On extract, everything up to and including last .. component is stripped
 +testing tar strips /../ on extract \
 +rm -rf input_* test.tar 2/dev/null
 +mkdir input_dir
 +echo Ok input_dir/file
 +tar cf test.tar ./../tar.tempdir/input_dir/../input_dir 21
 +rm -rf input_* 2/dev/null
 +tar -vxf test.tar 21
 +cat input_dir/file 21
 + \
 +tar: removing leading './../tar.tempdir/input_dir/../'
 +input_dir/
 +input_dir/file
 +Ok
 + \
 + 
 +

  cd ..  rm -rf tar.tempdir || exit 1
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Busybox-1.18.3 mconf.c

2011-03-01 Thread Tobias Poschwatta
Denys,

I think busybox 1.18.3 needs

commit 5a746dcec5c1e09c3cff0326c3b205d2427861f0
Author: Denys Vlasenko vda.li...@googlemail.com
Date:   Mon Feb 7 02:19:02 2011 +0100

scripts/kconfig/mconf.c: stop-gap fix for buffer overflow

Signed-off-by: Denys Vlasenko vda.li...@googlemail.com


Without this change, menuconfig stops working in the coreutils submenu.  On a
32-bit Slackware-Current, I am unable to select or unselect items, going back
to the main menu also fails. On a different system, I cannot even enter the
coreutils section.

With the patch, all seems fine.

Tobias


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


[PATCH] busybox binary name

2011-03-01 Thread Tobias Poschwatta
The attached patch allows to change the name of the main busybox binary
to something other than busybox. This makes it easy to have two or
more busybox binaries (different versions, different feature sets, etc.)
installed in the same filesystem.

The patch adds a new config option (CONFIG_BINARY_NAME), and changes
Makefile.custom to pass its value to applets/install.sh.

Tobias

diff -ur busybox-1.18.3.orig/Config.in busybox-1.18.3/Config.in
--- busybox-1.18.3.orig/Config.in   2011-02-08 18:24:57.0 +0100
+++ busybox-1.18.3/Config.in2011-03-01 21:42:50.875516023 +0100
@@ -732,6 +732,13 @@
help
  Define your directory to install BusyBox files/subdirs in.
 
+config BINARY_NAME
+   string BusyBox binary name
+   default busybox
+   help
+ Choose a name for the main busybox program file. Traditionally,
+ this is just busybox.
+
 endmenu
 
 source libbb/Config.in
diff -ur busybox-1.18.3.orig/Makefile.custom busybox-1.18.3/Makefile.custom
--- busybox-1.18.3.orig/Makefile.custom 2011-02-04 14:12:01.0 +0100
+++ busybox-1.18.3/Makefile.custom  2011-03-01 21:47:56.960380091 +0100
@@ -25,7 +25,7 @@
 endif
 install: $(srctree)/applets/install.sh busybox busybox.links
$(Q)DO_INSTALL_LIBS=$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS)) \
-   $(SHELL) $ $(CONFIG_PREFIX) $(INSTALL_OPTS)
+   bb_bin=$(CONFIG_BINARY_NAME) $(SHELL) $ $(CONFIG_PREFIX) 
$(INSTALL_OPTS)
 ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
@echo
@echo
diff -ur busybox-1.18.3.orig/applets/install.sh 
busybox-1.18.3/applets/install.sh
--- busybox-1.18.3.orig/applets/install.sh  2011-02-04 14:12:01.0 
+0100
+++ busybox-1.18.3/applets/install.sh   2011-03-01 21:48:18.094541750 +0100
@@ -24,6 +24,10 @@
*)   echo Unknown install option: $2; exit 1;;
 esac
 
+if [ -z $bb_bin ]; then
+   bb_bin=busybox
+fi
+
 if [ -n $DO_INSTALL_LIBS ]  [ $DO_INSTALL_LIBS != n ]; then
# get the target dir for the libs
# assume it starts with lib
@@ -43,8 +47,8 @@
done
 fi
 
-if [ $cleanup = 1 ]  [ -e $prefix/bin/busybox ]; then
-   inode=`ls -i $prefix/bin/busybox | awk '{print $1}'`
+if [ $cleanup = 1 ]  [ -e $prefix/bin/$bb_bin ]; then
+   inode=`ls -i $prefix/bin/$bb_bin | awk '{print $1}'`
sub_shell_it=`
cd $prefix
for d in usr/sbin usr/bin sbin bin; do
@@ -59,38 +63,38 @@
exit 0
 fi
 
-rm -f $prefix/bin/busybox || exit 1
+rm -f $prefix/bin/$bb_bin || exit 1
 mkdir -p $prefix/bin || exit 1
-install -m 755 busybox $prefix/bin/busybox || exit 1
+install -m 755 busybox $prefix/bin/$bb_bin || exit 1
 
 for i in $h; do
appdir=`dirname $i`
mkdir -p $prefix/$appdir || exit 1
if [ $scriptwrapper = y ]; then
if [ $swrapall != y ]  [ $i = /bin/sh ]; then
-   ln $linkopts busybox $prefix$i || exit 1
+   ln $linkopts $bb_bin $prefix$i || exit 1
else
rm -f $prefix$i
-   echo #!/bin/busybox  $prefix$i
+   echo #!/bin/$bb_bin  $prefix$i
chmod +x $prefix/$i
fi
echo   $prefix$i
else
if [ $2 = --hardlinks ]; then
-   bb_path=$prefix/bin/busybox
+   bb_path=$prefix/bin/$bb_bin
else
case $appdir in
/)
-   bb_path=bin/busybox
+   bb_path=bin/$bb_bin
;;
/bin)
-   bb_path=busybox
+   bb_path=$bb_bin
;;
/sbin)
-   bb_path=../bin/busybox
+   bb_path=../bin/$bb_bin
;;
/usr/bin|/usr/sbin)
-   bb_path=../../bin/busybox
+   bb_path=../../bin/$bb_bin
;;
*)
echo Unknown installation directory: $appdir
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Proposed More patch

2011-03-01 Thread Cathey, Jim
Please forgive the un-real patch-oid format, but we're not
set up to do it better right now.  We've got a script that
pipes GNU ls -C into BB more, and it really messes up the
tabs.  I made a quick patch to more.c which seems to help.
Any reason this shouldn't be permanent?  The crude conversion
is hardly less crude than the original, but works a lot better.

/* Crudely convert tabs into spaces, which are
* a bajillion times easier to deal with. */
if (c == '\t') {
--- spaces = CONVERTED_TAB_SIZE - 1;
+++ spaces = CONVERTED_TAB_SIZE - (len % CONVERTED_TAB_SIZE)
- 1;
c = ' ';
}

-- Jim

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


Re: 2 issues with tar

2011-03-01 Thread Denys Vlasenko
On Tuesday 01 March 2011 21:14, Alexander Shishkin wrote:
 On 1 March 2011 18:18, Denys Vlasenko vda.li...@googlemail.com wrote:
  On Monday 28 February 2011 09:23, Alexey Soloviev wrote:
  Hello,
  Met 2 problems with tar and wander if they are new or known.
 
  Issue 1: tar doesn't restore files or directories added with relative
  name starting with ../
  Scenario:
  busybox tar -c -f archive.tar ../tobearchived
  busybox tar -xf archive.tar
  tar: name with '..' encountered: '../tobearchived'
 
  Gnu tar removes ../ from paths of archived files and directories, while
  busybox's tar doesn't.
  Should it be fixed?
  Note that archive created by busybox tar on the 1st step can be restored
  by gnu tar but not by busybox's.
 
  Proposed patch.
 
 This doesn't address the archive creation case, in which GNU tar would strip
 the /../ just as well.

Doesn't look like it's worth fixing, since unpacking code mush be prepared
to see malicious tarballs anyway.

 Otherwise it's pretty much the same as what I've come up 
 with earlier today. :)

With your patch we have 20+ bytes growth in data:

function old new   delta
   textdata bss dec hex filename
 871090 4937584  879167   d6a3f busybox_old
 871087 5177584  879188   d6a54 busybox_unstripped

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


Re: 2 issues with tar

2011-03-01 Thread Denys Vlasenko
On Wednesday 02 March 2011 00:58, Denys Vlasenko wrote:
 On Tuesday 01 March 2011 21:14, Alexander Shishkin wrote:
  On 1 March 2011 18:18, Denys Vlasenko vda.li...@googlemail.com wrote:
   On Monday 28 February 2011 09:23, Alexey Soloviev wrote:
   Hello,
   Met 2 problems with tar and wander if they are new or known.
  
   Issue 1: tar doesn't restore files or directories added with relative
   name starting with ../
   Scenario:
   busybox tar -c -f archive.tar ../tobearchived
   busybox tar -xf archive.tar
   tar: name with '..' encountered: '../tobearchived'
  
   Gnu tar removes ../ from paths of archived files and directories, while
   busybox's tar doesn't.
   Should it be fixed?
   Note that archive created by busybox tar on the 1st step can be restored
   by gnu tar but not by busybox's.
  
   Proposed patch.
  
  This doesn't address the archive creation case, in which GNU tar would strip
  the /../ just as well.
 
 Doesn't look like it's worth fixing, since unpacking code must be prepared
 to see malicious tarballs anyway.

Hmm... it turned out that fixing it actually decreased code size.
I committed the fix to git:

http://git.busybox.net/busybox/commit/?id=b80acf58f16339078da5cbee88a322f2450aa2ad

Thanks!

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


Re: [PATCH] busybox binary name

2011-03-01 Thread Denys Vlasenko
On Tuesday 01 March 2011 22:08, Tobias Poschwatta wrote:
 The attached patch allows to change the name of the main busybox binary
 to something other than busybox. This makes it easy to have two or
 more busybox binaries (different versions, different feature sets, etc.)
 installed in the same filesystem.

It is already possible by using a suffix:

# cp busybox busybox2
# ./busybox2
BusyBox v1.19.0.git (2011-03-01 16:23:40 CET) multi-call binary.
Copyright (C) 1998-2009 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

Usage: busybox [function] [arguments]...
   or: busybox --list[-full]
   or: function [arguments]...

BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable.  Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as.

Currently defined functions:
[, [[, acpid, add-shell, addgroup, adduser ...

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


Re: Busybox-1.18.3 mconf.c

2011-03-01 Thread Denys Vlasenko
On Tuesday 01 March 2011 21:13, Tobias Poschwatta wrote:
 I think busybox 1.18.3 needs
 
 commit 5a746dcec5c1e09c3cff0326c3b205d2427861f0
 Author: Denys Vlasenko vda.li...@googlemail.com
 Date:   Mon Feb 7 02:19:02 2011 +0100
 
 scripts/kconfig/mconf.c: stop-gap fix for buffer overflow
 
 Signed-off-by: Denys Vlasenko vda.li...@googlemail.com
 
 
 Without this change, menuconfig stops working in the coreutils submenu.  On a
 32-bit Slackware-Current, I am unable to select or unselect items, going back
 to the main menu also fails. On a different system, I cannot even enter the
 coreutils section.
 
 With the patch, all seems fine.

Done:

http://busybox.net/downloads/fixes-1.18.3/busybox-1.18.3-menuconfig.patch

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


Re: 2 issues with tar

2011-03-01 Thread Alexander Shishkin
On Wed, Mar 02, 2011 at 12:58:58AM +0100, Denys Vlasenko wrote:
 On Tuesday 01 March 2011 21:14, Alexander Shishkin wrote:
  On 1 March 2011 18:18, Denys Vlasenko vda.li...@googlemail.com wrote:
   On Monday 28 February 2011 09:23, Alexey Soloviev wrote:
   Hello,
   Met 2 problems with tar and wander if they are new or known.
  
   Issue 1: tar doesn't restore files or directories added with relative
   name starting with ../
   Scenario:
   busybox tar -c -f archive.tar ../tobearchived
   busybox tar -xf archive.tar
   tar: name with '..' encountered: '../tobearchived'
  
   Gnu tar removes ../ from paths of archived files and directories, while
   busybox's tar doesn't.
   Should it be fixed?
   Note that archive created by busybox tar on the 1st step can be restored
   by gnu tar but not by busybox's.
  
   Proposed patch.
  
  This doesn't address the archive creation case, in which GNU tar would strip
  the /../ just as well.
 
 Doesn't look like it's worth fixing, since unpacking code mush be prepared
 to see malicious tarballs anyway.

Well, you can fix it at no additional cost by making the loop into a separate
function, which you call from writeFileToTarball() instead of stripping the
leading '/'. Bonus is that busybox tar and GNU tar will create similar looking
archives from similar input.

  Otherwise it's pretty much the same as what I've come up 
  with earlier today. :)
 
 With your patch we have 20+ bytes growth in data:

No, the new one I have made before an urgent retreat to a pub earlier
today. And I only have it on my machine at work.

 function old new   delta
textdata bss dec hex filename
  871090 4937584  879167   d6a3f busybox_old
  871087 5177584  879188   d6a54 busybox_unstripped

Regards,
--
Alex
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH 3/3] Add missing fclose()

2011-03-01 Thread Denys Vlasenko
On Tuesday 01 March 2011 12:39, Alexey Fomenko wrote:
 After opening fp and cin need to be closed.
 
 Signed-off-by: Alexey Fomenko ext-alexey.fome...@nokia.com
 ---
  networking/route.c |2 ++
  util-linux/more.c  |1 +
  2 files changed, 3 insertions(+), 0 deletions(-)
 
 diff --git a/networking/route.c b/networking/route.c
 index b7d08dd..18cb902 100644
 --- a/networking/route.c
 +++ b/networking/route.c
 @@ -537,6 +537,7 @@ void FAST_FUNC bb_displayroutes(int noresolve, int 
 netstatfmt)
   printf(%-6d %-2d %7d %s\n, metric, ref, use, devname);
   }
   }
 + fclose(fp);
  }
  
  #if ENABLE_FEATURE_IPV6
 @@ -625,6 +626,7 @@ static void INET6_displayroutes(void)
   }
   } while (1);
   }
 +fclose(fp);
  }
  
  #endif

Applied, thanks!


 diff --git a/util-linux/more.c b/util-linux/more.c
 index c424a0e..7f22c1d 100644
 --- a/util-linux/more.c
 +++ b/util-linux/more.c
 @@ -198,5 +198,6 @@ int more_main(int argc UNUSED_PARAM, char **argv)
   } while (*argv  *++argv);
   end:
   setTermSettings(cin_fileno, initial_settings);
 + fclose(cin);
   return 0;
  }

This one isn't necessary, program exit closes all files.
-- 
vda
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH 2/3] free allocated iface and liface before return

2011-03-01 Thread Denys Vlasenko
On Tuesday 01 March 2011 12:38, Alexey Fomenko wrote:
 xstrdup allocates buffer to iface, liface. Needs to be freed.
 
 Signed-off-by: Alexey Fomenko ext-alexey.fome...@nokia.com
 ---
  networking/ifupdown.c |7 +--
  networking/nameif.c   |6 ++
  2 files changed, 7 insertions(+), 6 deletions(-)
 
 diff --git a/networking/ifupdown.c b/networking/ifupdown.c
 index 59df4e8..52fe8d8 100644
 --- a/networking/ifupdown.c
 +++ b/networking/ifupdown.c
 @@ -1220,13 +1220,13 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
   /* ifup */
   if (iface_state) {
   bb_error_msg(interface %s already 
 configured, iface);
 - continue;
 + goto next;
   }
   } else {
   /* ifdown */
   if (!iface_state) {
   bb_error_msg(interface %s not 
 configured, iface);
 - continue;
 + goto next;
   }
   }
   llist_free(state_list, free);
 @@ -1316,6 +1316,9 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
   fclose(state_fp);
   llist_free(state_list, free);
   }
 + next:
 + free(iface);
 + free(liface);
   }
  
   return any_failures;
 diff --git a/networking/nameif.c b/networking/nameif.c
 index d02c2c1..ba73450 100644
 --- a/networking/nameif.c
 +++ b/networking/nameif.c
 @@ -155,10 +155,8 @@ int nameif_main(int argc, char **argv)
   bb_show_usage();
  
   if (argc) {
 - while (*argv) {
 - char *ifname = xstrdup(*argv++);
 - prepend_new_eth_table(clist, ifname, *argv++);
 - }
 + while (*argv)
 + prepend_new_eth_table(clist, *argv++, *argv++);

The order of two ++ ops above is undefined.

   } else {
   parser = config_open(fname);
   while (config_read(parser, token, 2, 2, # \t, PARSE_NORMAL))


Applied with small changes. Thanks.
-- 
vda
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: Compiling busybox to .s assembly file

2011-03-01 Thread Eric Schulte
Denys Vlasenko vda.li...@googlemail.com writes:

 On Thursday 24 February 2011 18:17, Eric Schulte wrote:
 Hello,
 
 I'm hoping to generate a compiled text asm file (gcc -S) of the busybox
 executable.  I've looked at scripts/showasm, but it uses objdump the
 output of which could not (easily) then be edited and linked to generate
 an executable.
 
 I've spend a good deal of time mucking around in the Makefile, but
 having never fully felt comfortable with Makefiles even in relatively
 simple cases, the busybox Makefile is largely opaque to me.
 
 If anyone can offer a suggestion, or point me in the right direction I
 will be very appreciative.  Once I get this working if there is any
 interest I would be happy to wrap it up in a script which could be
 included in scripts/ -- although I'm not sure that such functionality
 would be generally useful.

 Please see scripts/Makefile.IMA

 It may be a bit bit-rotted (because I don't use it, and people
 who do use it send me updates far too infrequently), so you might
 be forced to fix it up before it'll work for you...

 It runs entire compilation as one gcc invocation.

 I imagine adding the -S switch might be an easy-ich way
 to generate one BIG .s file with the entire busybox
 code.

Hi Denys,

This would be a very nice option, and while I'm currently able to tinker
with the asm for a single applet it would be preferable to have the
entire busybox program compiled to a single .s file.  I've tried playing
with Makefile.IMA, and more generally with the --combine option to
GCC, however I keep running into the same error, namely

  include/libbb.h:1670: error: conflicting types for ‘ptr_to_globals’

It seems that this error has cropped up in the past.
http://lists.busybox.net/pipermail/busybox/2007-March/060781.html
http://www.mail-archive.com/busybox@busybox.net/msg04074.html
Unfortunately these messages haven't indicated a viable solution.

Thanks for the suggestion, when scripts/Makefile.IMA is once again in a
working state, sneaking a -S into the gcc invocation should work well.

Best -- Eric

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Re: [PATCH] busybox binary name

2011-03-01 Thread Tobias Poschwatta
On Wed, Mar 02, 2011 at 02:19:02AM +0100, Denys Vlasenko wrote:
 On Tuesday 01 March 2011 22:08, Tobias Poschwatta wrote:
  The attached patch allows to change the name of the main busybox binary
  to something other than busybox. This makes it easy to have two or
  more busybox binaries (different versions, different feature sets, etc.)
  installed in the same filesystem.
 
 It is already possible by using a suffix:
 
 # cp busybox busybox2

Magic!

Oh, wait. This doesn't make make install create symlinks to busybox2,
does it?

T.

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