[PATCH] hush.c - export -n flag support

Bayram Kurumahmut kbayram at ubicom.com
Tue Apr 21 06:55:29 UTC 2009


A new patch and updated test files. Tests previously mentioned are applied and passed.

bayram at bk-pc:/media/disk-1/busybox-trunk$ bash shell/hush_test/hush-misc/export-n.tests
declare -x aaa1="'''"
declare -x aaa2=""
declare -x aaa3="'''abc"
declare -x aaa8="8"
aaa9=9
aaa10=10
Done
bayram at bk-pc:/media/disk-1/busybox-trunk$ ./hush shell/hush_test/hush-misc/export-n.tests
export aaa1="'''"
export aaa2=''
export aaa3="'''"'abc'
export aaa8='8'
aaa9=9
aaa10=10
Done

bayram at bk-pc:/media/disk-1/busybox-trunk$ bash -c 'export -n VVV=z; env | grep VVV'
bayram at bk-pc:/media/disk-1/busybox-trunk$ ./hush -c 'export -n VVV=z; env | grep VVV'

bayram at bk-pc:/media/disk-1/busybox-trunk$ bash -c 'echo $HOME; echo Unexporting; export -n HOME; HOME=z; env | grep HOME'
/home/bayram
Unexporting
bayram at bk-pc:/media/disk-1/busybox-trunk$ ./hush -c 'echo $HOME; echo Unexporting; export -n HOME; HOME=z; env | grep HOME'
/home/bayram
Unexporting

When I disable '-n' support, the following output still exists. As Mike said, there may be provided a common method for option handling.

bayram at bk-pc:/media/disk-1/busybox-trunk$ bash -c 'export -nnnnnnnnn nnnnnnnn; env | grep nnnnn'
bayram at bk-pc:/media/disk-1/busybox-trunk$ ./hush -c 'export -nnnnnnnnn nnnnnnnn; env | grep nnnnn'
-nnnnnnnnn=
nnnnnnnn=


Regards,
Bayram

-----Original Message-----
From: busybox-bounces at busybox.net on behalf of Mike Frysinger
Sent: Mon 20.04.2009 16:06
To: busybox at busybox.net
Subject: Re: [PATCH] hush.c - export -n flag support
 
On Monday 20 April 2009 18:05:09 Denys Vlasenko wrote:
> On Monday 20 April 2009 21:11, Bayram Kurumahmut wrote:
> > Added two new files: shell/hush_test/export-n.tests and
> > shell/hush_test/export-n.right
> > Added set then export -n test and test cases from my first mail
> > Config.in help text changed
>
> Problems:
>
> Did you try to build with HUSH_EXPORT_N off?
> It still accepts -n even then.

this is unrelated to his code.  not throwing an error with unknown option is 
not the same thing as accepting it.  we should add logic that rejects all 
unknown options.  that would result in -n being rejected by common code when 
support is turned off.

so, ignoring his patch completely, current code does not throw errors when 
doing things like:
export -n
export -Z
export -askdlfjasklfjasklf
-mike



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090420/e4bc1a07/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hush-export-n-support.patch
Type: text/x-diff
Size: 2544 bytes
Desc: hush-export-n-support.patch
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090420/e4bc1a07/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: export.right
Type: application/octet-stream
Size: 122 bytes
Desc: export.right
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090420/e4bc1a07/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: export.tests
Type: application/octet-stream
Size: 135 bytes
Desc: export.tests
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090420/e4bc1a07/attachment-0003.obj>


More information about the busybox mailing list