Re: How to change the Timezone

2007-07-12 Thread walter harms


Mike Frysinger wrote:
 On Wednesday 11 July 2007, walter harms wrote:
 perhaps this Question  Answer should go the the FAQ ?
 
 it isnt a busybox thing
 -mike

this is true, ntl the problem will show up every time when someone is using 
'date' in BB,
so he will ask the bb ML. And it becomes a problem when you consider the 
difference between
glibc and ulibc. So it would be helpful at least.

re,
 wh


___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


[Copfilter] Copy of quarantined email - *** SPAM *** [6.5/6.0] [PATCH 5/7] bb_ioctl implementation

2007-07-12 Thread [EMAIL PROTECTED]
This is the bb_ioctl patch for miscutils/hdparm.

Ciao,
Tito

___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

[PATCH] vi read-only mode bugfix and enhancement

2007-07-12 Thread Natanael Copa
Hi,

Attatched is a patch that will fix a bug in vi, enhance functionality a
bit, reduce size and make the code a bit more readable. Testcase
follows.

  echo this file is readonly  file1
  chmod 400 file1
  sudo chown root file

Before patch:

  ./busybox_old vi file1

File is empty (user has no read permissions) and statusline says:

  - file1 1/1 100%

Note that there is no indication of error or [Read-only]

After patch:

  ./busybox vi file1

File is still empty (user has no read permissions) but status line says:

  - file1 [Read-only] 1/1 100%

Original vim shows permission denied but Read-only is better than
nothing.

Try edit file and save as root. Old behaviour let user do this even if
file is write protected.

After patch file will be marked as [Read-only]. root will need to save
file with :wq!

Make bloatcheck:

function old new   delta
update_ro_status   -  86 +86
edit_file921 919  -2
colon   37983778 -20
file_insert  336 260 -76
--
(add/remove: 1/0 grow/shrink: 0/3 up/down: 86/-98)Total: -12
bytes
   textdata bss dec hex filename
 7064474728   14528  725703   b12c7 busybox_old
 7064394728   14528  725695   b12bf busybox_unstripped


Natanael Copa
Index: editors/vi.c
===
--- editors/vi.c	(revision 19069)
+++ editors/vi.c	(working copy)
@@ -229,7 +229,8 @@
 static char readit(void);	// read (maybe cursor) key from stdin
 static char get_one_char(void);	// read 1 char from stdin
 static int file_size(const char *);   // what is the byte size of fn
-static int file_insert(char *, char *, int);
+static int file_insert(char *, char *);
+USE_FEATURE_VI_READONLY(static void update_ro_status(const char *));
 static int file_write(char *, char *, char *);
 static void place_cursor(int, int, int);
 static void screen_erase(void);
@@ -419,8 +420,9 @@
 	new_text(size);		// get a text[] buffer
 	screenbegin = dot = end = text;
 	if (fn != 0) {
-		ch = file_insert(fn, text, cnt);
-	}
+		ch = file_insert(fn, text);
+		USE_FEATURE_VI_READONLY(update_ro_status(fn));
+	} 
 	if (ch  1) {
 		char_insert(text, '\n');	// start empty buf with dummy line
 	}
@@ -654,7 +656,6 @@
 	char *fn, cmd[MAX_LINELEN], args[MAX_LINELEN];
 	int i, l, li, ch, b, e;
 	int useforce = FALSE, forced = FALSE;
-	struct stat st_buf;
 
 	// :3154	// if (-e line 3154) goto it  else stay put
 	// :4,33w! foo	// write a portion of buffer to file foo
@@ -758,6 +759,7 @@
 		dot_skip_over_ws();
 	} else if (strncasecmp(cmd, edit, i) == 0) {	// Edit a file
 		int sr;
+		struct stat st_buf;
 		sr= 0;
 		// don't edit, if the current file has been modified
 		if (file_modified  ! useforce) {
@@ -809,7 +811,8 @@
 		screenbegin = dot = end = text;
 
 		// insert new file
-		ch = file_insert(fn, text, file_size(fn));
+		ch = file_insert(fn, text);
+		USE_FEATURE_VI_READONLY(update_ro_status(fn));
 
 		if (ch  1) {
 			// start empty buf with dummy line
@@ -937,25 +940,15 @@
 		// read after current line- unless user said :0r foo
 		if (b != 0)
 			q = next_line(q);
-#if ENABLE_FEATURE_VI_READONLY
-		l = readonly;			// remember current files' status
-#endif
-		ch = file_insert(fn, q, file_size(fn));
-#if ENABLE_FEATURE_VI_READONLY
-		readonly = l;
-#endif
+		ch = file_insert(fn, q);
 		if (ch  0)
 			goto vc1;	// nothing was inserted
 		// how many lines in text[]?
 		li = count_lines(q, q + ch - 1);
 		psb(\%s\
-#if ENABLE_FEATURE_VI_READONLY
-			%s
-#endif
+			USE_FEATURE_VI_READONLY(%s)
 			 %dL, %dC, fn,
-#if ENABLE_FEATURE_VI_READONLY
-			((vi_readonly || readonly) ?  [Read only] : ),
-#endif
+			USE_FEATURE_VI_READONLY(((vi_readonly || readonly) ?  [Read only] : ),)
 			li, ch);
 		if (ch  0) {
 			// if the insert is before dot then we need to update
@@ -2399,37 +2392,22 @@
 static int file_size(const char * fn) // what is the byte size of fn
 {
 	struct stat st_buf;
-	int cnt, sr;
+	int cnt;
 
-	if (!fn || !fn[0])
-		return -1;
 	cnt = -1;
-	sr = stat(fn, st_buf);	// see if file exists
-	if (sr = 0) {
+	if (fn  fn[0]  stat(fn, st_buf) == 0)	// see if file exists
 		cnt = (int) st_buf.st_size;
-	}
 	return cnt;
 }
 
-static int file_insert(char * fn, char * p, int size)
+static int file_insert(char * fn, char * p) 
 {
-	int fd, cnt;
-
-	cnt = -1;
-#if ENABLE_FEATURE_VI_READONLY
-	readonly = FALSE;
-#endif
-	if (!fn || !fn[0]) {
-		psbs(No filename given);
-		goto fi0;
-	}
-	if (size == 0) {
-		// OK- this is just a no-op
-		cnt = 0;
-		goto fi0;
-	}
+	int cnt = -1;
+	int fd, size;
+	
+	size = file_size(fn);
 	if (size  0) {
-		psbs(Trying to insert a negative number (%d) of characters, size);
+		psbs(File does not exist);
 		goto 

Help using 'dpkg' command to install debian packages

2007-07-12 Thread Dallas Clement
Hello All,

I need some help understanding how the busybox 'dpkg -i' command works.
Specifically, I would like to know how the mechanism for checking debian
package dependencies works. I'd like to know what essential files are
needed to do the checking.

I've built a few packages and tried to install them. Those with
dependencies are failing to install for some reason.

Here is my scenario:

I built a binary libc6-i386.deb package on my Debian host and installed
it on another host which has nothing but a bare Linux 2.6.21.1 kernel
and a static busybox 1.6.0 installed. I used the busybox 'dpkg' command
to install the package. Everything went fine and the output of the 'dpkg
-l' command is:

Name Version
+++-=-==
ii libc6-i386 2.3.6

After this, I built a busybox package to re-install the full busybox
implementation on to my target host. This package is dependent on
libc6-i386 as can be seen from the 'dpkg --info' command:

[EMAIL PROTECTED]:~/packages$ dpkg --info busybox_1.6.0-1_i386.deb
new debian package, version 2.0.
size 233752 bytes: control archive= 619 bytes.
444 bytes, 12 lines control
258 bytes, 4 lines md5sums
Package: busybox
Version: 1.6.0-1
Section: unknown
Priority: extra
Architecture: i386
Depends: libc6-i386 (= 2.3.5-1)
Installed-Size: 436
Maintainer: Dallas Clement [EMAIL PROTECTED]
Description: Busybox UNIX command utilities.
BusyBox combines tiny versions of many common UNIX utilities into \
a single small executable. It provides replacements for most of the \
utilities you usually find in GNU fileutils, shellutils, etc.

When I try to install this package, it fails during the installation.
This is the error I get:

dpkg: package busybox depends on libc6-i386, which is not installed or
flagged to be installed


I cannot understand why I am getting this error, when clearly the
libc6-i386 package is installed as you can see from the previous 'dpkg
-l' output.

In fact, the contents of the /var/lib/dpkg/status file are as follows:

cat /var/lib/dpkg/status

Package: libc6-i386
Version: 2.3.6
Section: libs
Priority: required
Architecture: i386
Maintainer: Dallas Clement [EMAIL PROTECTED]
Description: The GNU C library
The GNU C library is the standard C/C++ library \
needed to support most Linux applications.
Status: install ok installed



Clearly, the libc6-i386 package is installed.

Is there anything else that 'dpkg' checks other than this 'status' file
to do the dependency check? Is it just a simple package name check, or
is there more involved?

Any insight you could provide will be greatly appreciated!  I'm at my
wit's end trying to get this to work.

___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


Re: Help using 'dpkg' command to install debian packages

2007-07-12 Thread Hamish Moffatt
On Thu, Jul 12, 2007 at 08:49:26AM -0500, Dallas Clement wrote:
 Here is my scenario:
 
 I built a binary libc6-i386.deb package on my Debian host and installed
 it on another host which has nothing but a bare Linux 2.6.21.1 kernel
 and a static busybox 1.6.0 installed. I used the busybox 'dpkg' command
 to install the package. Everything went fine and the output of the 'dpkg
 -l' command is:

[...]

 When I try to install this package, it fails during the installation.
 This is the error I get:
 
 dpkg: package busybox depends on libc6-i386, which is not installed or
 flagged to be installed
 
 
 I cannot understand why I am getting this error, when clearly the
 libc6-i386 package is installed as you can see from the previous 'dpkg
 -l' output.
[...]

 Clearly, the libc6-i386 package is installed.
 
 Is there anything else that 'dpkg' checks other than this 'status' file
 to do the dependency check? Is it just a simple package name check, or
 is there more involved?
 
 Any insight you could provide will be greatly appreciated!  I'm at my
 wit's end trying to get this to work.

It looks like you are doing the right thing to me, ie if you were using
the real dpkg I believe it would work. Perhaps busybox's emulation is
buggy.

Hamish
-- 
Hamish Moffatt VK3SB [EMAIL PROTECTED] [EMAIL PROTECTED]
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


Re: Help using 'dpkg' command to install debian packages

2007-07-12 Thread Dallas Clement
On Fri, 2007-07-13 at 08:23 +1000, Hamish Moffatt wrote:
 On Thu, Jul 12, 2007 at 08:49:26AM -0500, Dallas Clement wrote:
  Here is my scenario:
  
  I built a binary libc6-i386.deb package on my Debian host and installed
  it on another host which has nothing but a bare Linux 2.6.21.1 kernel
  and a static busybox 1.6.0 installed. I used the busybox 'dpkg' command
  to install the package. Everything went fine and the output of the 'dpkg
  -l' command is:
 
 [...]
 
  When I try to install this package, it fails during the installation.
  This is the error I get:
  
  dpkg: package busybox depends on libc6-i386, which is not installed or
  flagged to be installed
  
  
  I cannot understand why I am getting this error, when clearly the
  libc6-i386 package is installed as you can see from the previous 'dpkg
  -l' output.
 [...]
 
  Clearly, the libc6-i386 package is installed.
  
  Is there anything else that 'dpkg' checks other than this 'status' file
  to do the dependency check? Is it just a simple package name check, or
  is there more involved?
  
  Any insight you could provide will be greatly appreciated!  I'm at my
  wit's end trying to get this to work.
 
 It looks like you are doing the right thing to me, ie if you were using
 the real dpkg I believe it would work. Perhaps busybox's emulation is
 buggy.
 
 Hamish

I think you're right - must be buggy.  Though, what I am doing seems so
simple!!  I'm looking at the file dpkg.c now and putting in some debug
messages to see why it is behaving this way.

Cheers,
Dallas

___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


Re: How to change the Timezone

2007-07-12 Thread Mike Frysinger
On Thursday 12 July 2007, walter harms wrote:
 Mike Frysinger wrote:
  On Wednesday 11 July 2007, walter harms wrote:
  perhaps this Question  Answer should go the the FAQ ?
 
  it isnt a busybox thing

 this is true, ntl the problem will show up every time when someone is using
 'date' in BB,

it will show up every time `date` is used whether it is from busybox or 
coreutils or ... the question really is, how much non-busybox but low level 
Linux things do we document considering many people dont understand where 
busybox ends and other things begin.  especially considering this information 
can differ based on distribution or the user's custom build.
-mike


signature.asc
Description: This is a digitally signed message part.
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox