Re: CONFIG

2008-07-21 Thread Bernhard Fischer
On Sat, Jul 19, 2008 at 11:31:45AM +0200, Denys Vlasenko wrote:
On Saturday 19 July 2008 08:58, [EMAIL PROTECTED] wrote:
 Added verbose comments on config_read().
 Added testsuite (runtest parse).
 Let us collect interesting cases and thoroughly test them.
 Fixed inittab parsing. Bernhard, please test.

-  while (config_read(parser, token, -4, 0, :, '#') = 0) {
+  while (config_read(parser, token, 4, 4, #:, 
PARSE_DONT_TRIM|PARSE_DONT_REDUCE|PARSE_LAST_IS_GREEDY)  0) {

I'm sceptical about this new interface. How can i state that i
-) accept _no_ comment chars but e.g. ;, as delimiter?
-) accept ^[[:space:]]*[#;] comments and ;[[:space:]] as delim?

The latter is probably not used -- or at least not widely used -- in bb.
Thanks,
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


Re: CONFIG

2008-07-21 Thread Vladimir Dronnikov
Hi!

I'm sceptical about this new interface. How can i state that i
 -) accept _no_ comment chars but e.g. ;, as delimiter?


pass \0;, as delims

We can go farther and pass comment-chars-if-any\0delimiter-chars as
delims; this will require a trivial change in config_read()



 -) accept ^[[:space:]]*[#;] comments and ;[[:space:]] as delim?

 The latter is probably not used -- or at least not widely used -- in bb.


You answered your question by yourself, Bernhard. It is not required by any
existing bb applet by the moment.
However, regexps would be nice FEATURE. Just let us work on it...

Thanks for discussion,
--
Vladimir
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

new applets lpr,lpq (update)

2008-07-21 Thread Klaus . Hachmeister
Hello Walter,
hello Denys,

i just tried your busybox/printutils/lpr on my Blackfin/uClinux board.
I want to print via network on an external lpd.

Printing small files ( a few bytes) works.
Printing longer files ( some kBytes) doesnt.

/var/log/syslog on the serverside says:

Jul 21 09:41:00 PC535li cups-lpd[7691]: Connection from blackfin (IPv4
192.168.70.120)
Jul 21 09:41:00 PC535li cups-lpd[7691]: Receive print job for psprint
Jul 21 09:41:00 PC535li cups-lpd[7691]: Error while reading file -
Connection reset by peer
Jul 21 09:41:00 PC535li cups-lpd[7691]: Closing connection

I am using BusyBox 1.11.1 (stable)

I can provide exported snapshots from wireshark, if you like.

Can you help me?

PS: Printing from an XScale board using LPRng works.


-  
Mit freundlichen Gruessen / Best regards

Klaus Hachmeister
Research  Development

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


Re: new applets lpr,lpq (update)

2008-07-21 Thread walter harms
hello klaus,
thanks for you bug report,

i am very busy this week; Short: no chance for a quick fix
but you may check at what size lpr stops working (my guess 4096 bytes)
that may give us a hint where the problem is.
perhaps vladimir ([EMAIL PROTECTED]) has some ideas.

re,
 wh



[EMAIL PROTECTED] wrote:
 Hello Walter,
 hello Denys,
 
 i just tried your busybox/printutils/lpr on my Blackfin/uClinux board.
 I want to print via network on an external lpd.
 
 Printing small files ( a few bytes) works.
 Printing longer files ( some kBytes) doesnt.
 
 /var/log/syslog on the serverside says:
 
 Jul 21 09:41:00 PC535li cups-lpd[7691]: Connection from blackfin (IPv4
 192.168.70.120)
 Jul 21 09:41:00 PC535li cups-lpd[7691]: Receive print job for psprint
 Jul 21 09:41:00 PC535li cups-lpd[7691]: Error while reading file -
 Connection reset by peer
 Jul 21 09:41:00 PC535li cups-lpd[7691]: Closing connection
 
 I am using BusyBox 1.11.1 (stable)
 
 I can provide exported snapshots from wireshark, if you like.
 
 Can you help me?
 
 PS: Printing from an XScale board using LPRng works.
 
 
 -  
 Mit freundlichen Gruessen / Best regards
 
 Klaus Hachmeister
 Research  Development
 
 ___
 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


Re: new applets lpr,lpq (update)

2008-07-21 Thread Vladimir Dronnikov
Klaus, can you send log of
strace -f -v -s 1024 lpr your-parameters-here
?

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

Re: new applets lpr,lpq (update)

2008-07-21 Thread Klaus . Hachmeister
Another example. (another postscriptfile)

--

/etc/syslog

Jul 21 13:44:29 PC535li cups-lpd[11476]: Connection from blackfin (IPv4 
192.168.70.120)
Jul 21 13:44:29 PC535li cups-lpd[11476]: Receive print job for psprint
Jul 21 13:44:29 PC535li cups-lpd[11476]: Error while reading file - Connection 
reset by peer
Jul 21 13:44:29 PC535li cups-lpd[11476]: Closing connection
Jul 21 13:44:57 PC535li cups-lpd[11479]: Connection from blackfin (IPv4 
192.168.70.120)
Jul 21 13:44:57 PC535li cups-lpd[11479]: Receive print job for psprint
Jul 21 13:44:58 PC535li cups-lpd[11479]: Error while reading trailing nul - 
Connection reset by peer
Jul 21 13:44:58 PC535li cups-lpd[11479]: Closing connection

--
/ # lpr [EMAIL PROTECTED] /mnt/nfs/testprint.ps 
  
/ # strace -f -v -s 1024  lpr [EMAIL PROTECTED] /mnt/nfs/testprint.ps   
  
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0x500, c_oflags=0x5, 
c_cflags=0x1cb1, c_lflags=0x8a3b, c_line=0, 
c_cc=\x03\x1c\x08\x15\x04\x00\x01\x00\x0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0x500, c_oflags=0x5, 
c_cflags=0x1cb1, c_lflags=0x8a3b, c_line=0, 
c_cc=\x03\x1c\x08\x15\x04\x00\x01\x00\x0
getuid32()  = 0 

getuid32()  = 0 

open(/etc/passwd, O_RDONLY)   = 3 

ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x462c94) = -1 ENOTTY (Inappropriate 
ioctl for device)  
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x400, 0, 
0) = 0xe7
read(3, root:C7O0oWtNuGHNE:0:0:root:/root:/bin/sh\nnobody:x:99:99:Nobody::\n, 
256) = 66   
close(3)= 0 

open(/etc/resolv.conf, O_RDONLY)  = -1 ENOENT (No such file or directory) 

open(/etc/config/resolv.conf, O_RDONLY) = -1 ENOENT (No such file or 
directory)  
 
open(/etc/hosts, O_RDONLY)= 3 

ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x4625dc) = -1 ENOTTY (Inappropriate 
ioctl for device)  
read(3, # Do not remove the following line, or various programs\n# that 
require network functionality will 
fail.\n127.0.0.1\tlocalhost.localdomain\tlocalh9
close(3)= 0 

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3

setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 

connect(3, {sa_family=AF_INET, sin_port=htons(515), 
sin_addr=inet_addr(192.168.70.12)}, 16) = 0   

getpid()= 336   

uname({sysname=Linux, nodename=blackfin, 
release=2.6.22.18-ADI-2008R1-svn, version=#60 Fri Jul 18 13:39:32 CEST 
2008, machine=blackfin}) = 0  
write(3, \2psprint\n, 9)  = 9 

read(3, \0, 1)= 1 

open(/mnt/nfs/testprint.ps, O_RDONLY) = 4 

write(3, \00255 cfA336blackfin\n, 19) = 19

write(3, Hblackfin\nProot\nJ/mnt/nfs/testprint.ps\nldfA336blackfin\n, 55) = 
55 

Re: new applets lpr,lpq (update)

2008-07-21 Thread Klaus . Hachmeister
successful printing

-
/var/log/syslog

Jul 21 13:57:20 PC535li cups-lpd[11552]: Receive print job for psprint
Jul 21 13:57:20 PC535li cups-lpd[11552]: Print file - job ID = 94
Jul 21 13:57:20 PC535li cups-lpd[11552]: Closing connection
Jul 21 13:57:20 PC535li kernel: [19437.375611] audit(1216641440.551:38):
type=1503 operation=inode_permission requested_mask=::r
denied_mask=::r name=/var/run/samba/gencache.tdb pid=11558
profile=/usr/sbin/cupsd namespace=default
Jul 21 13:57:20 PC535li kernel: [19437.375642] audit(1216641440.551:39):
type=1503 operation=inode_permission requested_mask=::r
denied_mask=::r name=/var/run/samba/gencache.tdb pid=11558
profile=/usr/sbin/cupsd namespace=default
Jul 21 13:57:20 PC535li kernel: [19437.385953] audit(1216641440.563:40):
type=1503 operation=inode_permission requested_mask=::r
denied_mask=::r name=/var/run/samba/gencache.tdb pid=11558
profile=/usr/sbin/cupsd namespace=default
Jul 21 13:57:50 PC535li cups-lpd[11561]: Connection from blackfin (IPv4
192.168.70.120)
Jul 21 13:57:50 PC535li cups-lpd[11561]: Receive print job for psprint
Jul 21 13:57:50 PC535li cups-lpd[11561]: Print file - job ID = 95
Jul 21 13:57:50 PC535li cups-lpd[11561]: Closing connection
Jul 21 13:57:50 PC535li kernel: [19467.618088] audit(1216641470.839:41):
type=1503 operation=inode_permission requested_mask=::r
denied_mask=::r name=/var/run/samba/gencache.tdb pid=11567
profile=/usr/sbin/cupsd namespace=default
Jul 21 13:57:50 PC535li kernel: [19467.618823] audit(1216641470.843:42):
type=1503 operation=inode_permission requested_mask=::r
denied_mask=::r name=/var/run/samba/gencache.tdb pid=11567
profile=/usr/sbin/cupsd namespace=default
Jul 21 13:57:50 PC535li kernel: [19467.626842] audit(1216641470.851:43):
type=1503 operation=inode_permission requested_mask=::r
denied_mask=::r name=/var/run/samba/gencache.tdb pid=11567
profile=/usr/sbin/cupsd namespace=default
-

/ # lpr
[EMAIL PROTECTED] /etc/hosts
  
/ #  strace -f -v -s 1024  lpr
[EMAIL PROTECTED] /etc/hosts
   
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0x500, c_oflags=0x5,
c_cflags=0x1cb1, c_lflags=0x8a3b, c_line=0, c_cc=\x03\x1c\x08\x15\x04
\x00\x01\x00\x0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0x500, c_oflags=0x5,
c_cflags=0x1cb1, c_lflags=0x8a3b, c_line=0, c_cc=\x03\x1c\x08\x15\x04
\x00\x01\x00\x0
getuid32()  =
0   
  
getuid32()  =
0   
  
open(/etc/passwd, O_RDONLY)   =
3   
  
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x462c9c) = -1 ENOTTY
(Inappropriate ioctl for
device)  
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|
0x400, 0, 0) =
0xfa6000
read(3, root:C7O0oWtNuGHNE:0:0:root:/root:/bin/sh
\nnobody:x:99:99:Nobody::\n, 256) =
66   
close(3)=
0   
  
open(/etc/resolv.conf, O_RDONLY)  = -1 ENOENT (No such file or
directory)  
   
open(/etc/config/resolv.conf, O_RDONLY) = -1 ENOENT (No such file or
directory)  
 
open(/etc/hosts, O_RDONLY)=
3   
  
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x4625e4) = -1 ENOTTY
(Inappropriate ioctl for
device)  
read(3, # Do not remove the following line, or various programs\n# that
require network functionality will fail.\n127.0.0.1
\tlocalhost.localdomain\tlocalh9
close(3)=
0   
  
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) =
3   
 
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) =
0 

Re: CONFIG

2008-07-21 Thread Bernhard Fischer
On Mon, Jul 21, 2008 at 02:09:59PM +0400, Vladimir Dronnikov wrote:

Among the few remaining applets there are inetd, httpd, something in ip
(rt_table_*?) and vanilla modprobe.*/modules.dep.
Can you enumerate more?


 Let's build a list (perhaps in TODO) so we can check if all potential
 users are cought.
 
 + ifupdown
 - init
 + dumpleases ? Does that make sense?
 + inetd
 + bb__pgsreader()
+ httpd
+ rtnl_tab_initialize() /* number[[:space:]]entry\n#comment */
+ modules.dep, modules.alias
+ mount
+ expand/unexpand (?, probably no)
+ procps_scan() for ENABLE_FEATURE_TOPMEM
+ parse_config_file() /* our main /etc/busybox.conf */
+ check_securetty()
+ lsmod (/proc/modules parsing)
+ do_sethostname() /* if benefical */
+ interface.c
etc..

I didn't update the list, so please mark the ones that are already
converted or missing. TIA
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


Re: CONFIG

2008-07-21 Thread Vladimir Dronnikov

 + check_securetty()
 + do_sethostname() /* if benefical */


These I attacked yesterday. Pending...

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

Re: 'test' behavior.

2008-07-21 Thread Chris Larson
Denys Vlasenko wrote:
 On Friday 18 July 2008 22:30, Chris Larson wrote:
   
 It occurs with current busybox svn.

 Original test case: -f = a -o b
 Minimal test case: -f = a w/ explicit 3 argument handling disabled in 
 the code
 
 Try attached patch.
   
That fixed it, thanks a lot :)

-- 
Chris Larson
Dedicated Engineer
Montavista, Inc.
Email: clarson AT mvista DOT com
Email: clarson AT kergoth DOT com


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


Fun w/ test :)

2008-07-21 Thread Chris Larson
[EMAIL PROTECTED] busybox% ./busybox test -f =
[EMAIL PROTECTED] busybox% ./busybox test \( -f = \)
test: closing paren expected

Hehe.  I highly doubt anyone would actually name a file =, but what the heck, 
figured you'd
want to know about any cases that confuse the parser.  It's interesting to note 
that -f =
works, but ( -f = ) does not.  No customer issue on this of course, just made 
myself try
lots of combinations during the testing.

I found a case where the unknown operand error is seen.  If it sees an 
operand after an
expression, which is not -o or -a, it gives that error:
[EMAIL PROTECTED] busybox% ./busybox test -f = -a
[EMAIL PROTECTED] busybox% ./busybox test -f = -a -e foo
test: -e: unknown operand

Due to the precedence, that's seen as two expressions without a -a or -o to 
join them.
The error message could be confusing in this case. -e is, of course, a valid
operator, and -e foo is a valid expression, but -e is not valid -there-, only
-a or -o are.
-- 
Chris Larson
Dedicated Engineer
Montavista, Inc.
Email: clarson AT mvista DOT com
Email: clarson AT kergoth DOT com

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


Re: new applets lpr,lpq (update)

2008-07-21 Thread Denys Vlasenko
On Monday 21 July 2008 12:57, [EMAIL PROTECTED] wrote:
 Shure,
 
 now the output of /etc/syslog (serverside) is differrent. (but still no
 printing)
 
 --
 
 /etc/syslog
 
 Jul 21 12:44:36 PC535li cups-lpd[11071]: Connection from blackfin (IPv4
 192.168.70.120)
 Jul 21 12:44:36 PC535li cups-lpd[11071]: Receive print job for psprint
 Jul 21 12:44:36 PC535li cups-lpd[11071]: Error while reading file -
 Connection reset by peer
 Jul 21 12:44:36 PC535li cups-lpd[11071]: Closing connection

 Jul 21 12:45:24 PC535li cups-lpd[11072]: Connection from blackfin (IPv4
 192.168.70.120)
 Jul 21 12:45:24 PC535li cups-lpd[11072]: Receive print job for psprint
 Jul 21 12:45:48 PC535li cups-lpd[11072]: Print file - job ID = 91
 Jul 21 12:45:48 PC535li cups-lpd[11072]: Closing connection

One printing was ok (second one), another failed.

 / # lpr
 [EMAIL PROTECTED] /mnt/nfs/testpage.ps
 
 / # strace -f -v -s 1024  lpr
 [EMAIL PROTECTED] /mnt/nfs/testpage.ps
   
 ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0x500, c_oflags=0x5,
 c_cflags=0x1cb1, c_lflags=0x8a3b, c_line=0, c_cc=\x03\x1c\x08\x15\x04
 \x00\x01\x00\x0
...
...

I find it very pleasant to spend 15 minutes unwrapping the strace,
removing extra spaces and the like. However note that some other
developers may have less perverted methods of having fun, and may
resort to simple entertainments like beating the email's author
with big stick. :)

Let's take a look.


# strace -f -v -s 1024 lpr [EMAIL PROTECTED] /mnt/nfs/testpage.ps
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0x500, c_oflags=0x5, 
c_cflags=0x1cb1, c_lflags=0x8a3b, c_line=0, 
c_cc=\x03\x1c\x08\x15\x04\x00\x01\x00\x0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0x500, c_oflags=0x5, 
c_cflags=0x1cb1, c_lflags=0x8a3b, c_line=0, 
c_cc=\x03\x1c\x08\x15\x04\x00\x01\x00\x0
...
close(3)= 0

nothing interesting above.

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
connect(3, {sa_family=AF_INET, sin_port=htons(515), 
sin_addr=inet_addr(192.168.70.12)}, 16) = 0

We opened a TCP connection to 192.168.70.12:515.

getpid()= 260
uname({sysname=Linux, nodename=blackfin, 
release=2.6.22.18-ADI-2008R1-svn, version=#60 Fri Jul 18 13:39:32 CEST 
2008, machine=blackfin}) = 0
write(3, \2psprint\n, 9)  = 9

We say I want to print to queue 'psprint'.

read(3, \0, 1)= 1

Server says ok

open(/mnt/nfs/testpage.ps, O_RDONLY)  = 4
write(3, \00254 cfA260blackfin\n, 19) = 19

We say here goes the controlfile (\002)
of 54 bytes (54) named cfA260blackfin

write(3, Hblackfin\nProot\nJ/mnt/nfs/testpage.ps\nldfA260blackfin\n, 54) = 54

We send controlfile contents:
Hhost\n, Puser\n, Jjobname\n ldatafilename\n

write(3, \0, 1)   = 1

We say is it ok?

read(3, \0, 1)= 1

server says ok

fstat(4, {st_dev=makedev(0, 15), st_ino=696322, st_mode=S_IFREG|0644, 
st_nlink=1, st_uid=0, st_gid=0, st_blksize=8192, st_blocks=520, st_size=260183, 
st_at0
write(3, \003260183 dfA260blackfin\n, 23) = 23

We say here is a datafile, 260183 bytes, named dfA260blackfin

read(4, %!PS-Adobe-2.0\n%%Title: testpage.fig\n%%Creator: fig2dev Version 3.2 
Patchlevel 3d\n%%CreationDate: Mon Dec  3 11:54:07 2001\n%%For: [EMAIL 
PROTECTED]
write(3, %!PS-Adobe-2.0\n%%Title: testpage.fig\n%%Creator: fig2dev Version 3.2 
Patchlevel 3d\n%%CreationDate: Mon Dec  3 11:54:07 2001\n%%For: [EMAIL 
PROTECTED]
read(4, Bold ff 150.00 scf sf\n5700 7800 m\ngs 1 -1 sc (Gold) dup swpop 2 div 
neg 0 rm  col-1 sh gr\n/Helvetica-Bold ff 150.00 scf sf\n69007800 m\ngs 1 6
write(3, Bold ff 150.00 scf sf\n5700 7800 m\ngs 1 -1 sc (Gold) dup swpop 2 div 
neg 0 rm  col-1 sh gr\n/Helvetica-Bold ff 150.00 scf sf\n69007800 m\ngs 16
...
read(4, 00dfff4e4a4e\n009b004e003d024e003d0e4e029b034e005e009b354e\nrestore 
grestore\n%\n% End Imported PIC File: LPRngT-L.gif\n%\n/Times-Roman ff 180.00 5
write(3, 00dfff4e4a4e\n009b004e003d024e003d0e4e029b034e005e009b354e\nrestore 
grestore\n%\n% End Imported PIC File: LPRngT-L.gif\n%\n/Times-Roman ff 180.005

we sent the file

write(3, \0, 1)   = 1

We say is it ok?

read(3, \0, 1)= 1

server says ok

close(3)= 0
_exit(0)

we exit.



What confuses me here is that it looks like server was totally happy
and actually accepted the job. I suspect you sent a strace of
successful lpr.

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

Re: CONFIG

2008-07-21 Thread Denys Vlasenko
On Sunday 20 July 2008 22:00, [EMAIL PROTECTED] wrote:
 *_for_{read,write} introduced and used. Wonder what is the size change?
 
 Please consider applying.

-   fp = fopen(/etc/securetty, r);
-   if (!fp) {
-   /* A missing securetty file is not an error. */
-   return 1;
-   }
-   while (fgets(buf, sizeof(buf)-1, fp)) {
-   for (i = strlen(buf)-1; i = 0; --i) {
-   if (!isspace(buf[i]))
+   char *buf;
+   int ret = 1;
+   parser_t *parser = config_open(/etc/securetty);

Should have used config_open2(..., fopen_for_read) here,
as it shouldn't warn.

I hope you actually tested that securetty code still works.

Size:

--
(add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737)Total: -563 bytes
   textdata bss dec hex filename
 788506 6016696  795803   c249b busybox_old
 787943 6016696  795240   c2268 busybox_unstripped

Good work!!!
Applied.
--
vda
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


Re: Fun w/ test :)

2008-07-21 Thread Chris Larson
Denys Vlasenko wrote:
 Paul, hi. :)

 On Monday 21 July 2008 20:35, Chris Larson wrote:
   
 [EMAIL PROTECTED] busybox% ./busybox test -f =
 [EMAIL PROTECTED] busybox% ./busybox test \( -f = \)
 test: closing paren expected

 Hehe.  I highly doubt anyone would actually name a file =, but what the 
 heck, figured you'd
 want to know about any cases that confuse the parser.  It's interesting to 
 note that -f =
 works, but ( -f = ) does not.  No customer issue on this of course, just 
 made myself try
 lots of combinations during the testing.

 I found a case where the unknown operand error is seen.  If it sees an 
 operand after an
 expression, which is not -o or -a, it gives that error:
 [EMAIL PROTECTED] busybox% ./busybox test -f = -a
 [EMAIL PROTECTED] busybox% ./busybox test -f = -a -e foo
 test: -e: unknown operand

 Due to the precedence, that's seen as two expressions without a -a or -o to 
 join them.
 The error message could be confusing in this case. -e is, of course, a valid
 operator, and -e foo is a valid expression, but -e is not valid -there-, only
 -a or -o are.
 


 So, now, do you see why xstr trick is actually not so silly?
   

I now recall reading about this in the shell portability section of the 
autoconf manual.  Excerpt:

Posix also says that `test ! string', `test -n string' and `test -z 
string' work with any string, but many shells (such as Solaris, AIX 
3.2, unicos 10.0.0.6, Digital Unix 4, etc.) get confused if string looks 
like an operator:

  $ test -n =
  test: argument expected
  $ test ! -n
  test: argument expected
 

Similarly, Posix says that both `test string1 = string2' and `test 
string1 != string2' work for any pairs of strings, but in practice 
this is not true for troublesome strings that look like operators or 
parentheses, or that begin with `-'.

It is best to protect such strings with a leading `X', e.g., `test 
Xstring != X' rather than `test -n string' or `test ! string'.

-- 
Chris Larson
Dedicated Engineer
Montavista, Inc.
Email: clarson AT mvista DOT com
Email: clarson AT kergoth DOT com

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