[Toybox] Fixes to mkdir, chown, env

Jacek Bukarewicz j.bukarewicz at samsung.com
Fri Aug 30 07:01:30 PDT 2013


Hi

While testing toybox I encountered a few minor issues with toybox:
1) mkdir:
     - according to the spec umask should be ignored when explicitly 
setting permissions. I simply added umask(0) call to prevent umask from 
affecting mode
      - I believe that in mkdir.c line 60 the intent was to check if 
flag "p" is not set.
      - I added --mode longopt, but I noticed that it's not handled 
correctly. I believe that's because gof.arg is assigned to "" 
(get_optflags function in lib/args.c). gof.arg is incremented afterwards 
so it contains trash then. I removed this line from lib/args.c and it 
works fine now
     - I also added/modified a few mkdir  tests

2) env - there were 2 segfaults when run on my Ubuntu 12.04 machine:
     - one is because eglibc sets environ to NULL on clearenv(). I added 
check for environ being not NULL when iterating over environment variables
     - switched xexec to xexec_optargs because command argument is a 
pointer to optarg which is freed by xexec.

3) chown:
     - Both ":" and "." are used as <user>:<group> delimiter but AFAIK 
only ":" is allowed

I'm attaching patches. I hope they are helpful

Best Regards,
Jacek
-- 
test

cid:image001.png at 01CE518C.41DEB9F0

Jacek Bukarewicz

Samsung R&D Institute Poland

Samsung Electronics

j.bukarewicz at samsung.com <mailto::j.bukarewicz at samsung.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: chgrp.diff
Type: text/x-patch
Size: 399 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130830/c52c5742/attachment-0018.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: env.diff
Type: text/x-patch
Size: 400 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130830/c52c5742/attachment-0019.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mkdir.diff
Type: text/x-patch
Size: 2611 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130830/c52c5742/attachment-0020.bin>


More information about the Toybox mailing list